From e498baa0e19d626f4df1e8d06fe1c906518e5a34 Mon Sep 17 00:00:00 2001 From: REZ1DENT3 Date: Tue, 11 Apr 2017 15:54:57 +0300 Subject: [PATCH] upgrade orm --- composer.json | 2 +- demo/orm.php | 9 +++++---- demo/simple.php | 2 +- src/Paginate/Pager.php | 8 ++++---- src/Paginate/Paginate.php | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 467244b..8416583 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ } ], "require": { - "deimos/orm": "~2.0" + "deimos/orm": "~3.0" }, "require-dev": { "phpunit/phpunit": "^6.0" diff --git a/demo/orm.php b/demo/orm.php index 293015b..6aa4793 100644 --- a/demo/orm.php +++ b/demo/orm.php @@ -2,15 +2,16 @@ include_once dirname(__DIR__) . '/vendor/autoload.php'; -$builder = new \Deimos\Builder\Builder(); +$helper = new \Deimos\Helper\Helper(); -$db = new \Deimos\Database\Database(new \Deimos\Config\ConfigObject($builder, [ +$db = new \Deimos\Database\Database(new \Deimos\Slice\Slice($helper, [ 'adapter' => 'mysql', 'database' => 'test', 'username' => 'root', 'password' => 'root' ])); -$orm = new \Deimos\ORM\ORM($builder, $db); + +$orm = new \Deimos\ORM\ORM($helper, $db); $userQuery = $orm->repository('user'); @@ -22,4 +23,4 @@ var_dump($simple->currentPage()); var_dump($simple->itemCount()); -var_dump($simple->currentItems(false)); \ No newline at end of file +var_dump($simple->currentItems(false)); diff --git a/demo/simple.php b/demo/simple.php index ac254a0..044a740 100644 --- a/demo/simple.php +++ b/demo/simple.php @@ -10,4 +10,4 @@ var_dump($simple->currentPage()); var_dump($simple->itemCount()); -var_dump($simple->currentItems()); \ No newline at end of file +var_dump($simple->currentItems()); diff --git a/src/Paginate/Pager.php b/src/Paginate/Pager.php index 75ac504..6408b0c 100644 --- a/src/Paginate/Pager.php +++ b/src/Paginate/Pager.php @@ -8,7 +8,7 @@ abstract class Pager /** * @var int */ - protected $defaultTake = 50; + protected $defaultLimit = 50; /** * @var array @@ -43,8 +43,8 @@ protected function reset() $this->loaded = false; $this->storage = null; $this->itemCount = null; - $this->limit = $this->defaultTake; - $this->page = 1; + $this->limit = $this->defaultLimit; + $this->page = 1; } /** @@ -131,4 +131,4 @@ protected function offset() return ($this->page - 1) * $this->limit; } -} \ No newline at end of file +} diff --git a/src/Paginate/Paginate.php b/src/Paginate/Paginate.php index 4c1d521..eb30dfd 100644 --- a/src/Paginate/Paginate.php +++ b/src/Paginate/Paginate.php @@ -116,4 +116,4 @@ public function itemCount() return $this->itemCount; } -} \ No newline at end of file +}