@@ -9,8 +9,8 @@ discard block |
||
| 9 | 9 | private $table; |
| 10 | 10 | |
| 11 | 11 | private $fields = '*'; |
| 12 | - private $databaseSelect; |
|
| 13 | - private $databaseCrud; |
|
| 12 | + private $databaseSelect; |
|
| 13 | + private $databaseCrud; |
|
| 14 | 14 | |
| 15 | 15 | public function __construct($db, $table, $primaryKey = 'id', array $options = []) { |
| 16 | 16 | $options = new DatabaseOptions($db, $options); |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | $defaultSort = $options->read('defaultSort') !== false ? $options->read('defaultSort') : implode(', ', $this->primaryKey); |
| 25 | 25 | |
| 26 | - $databaseModify = new DatabaseModify($adapter, $options->getEditMode(), $table); |
|
| 26 | + $databaseModify = new DatabaseModify($adapter, $options->getEditMode(), $table); |
|
| 27 | 27 | |
| 28 | - $this->databaseSelect = new DatabaseSelect($adapter, $databaseModify, $table, $defaultSort, $options->getCacheMode()); |
|
| 29 | - $this->databaseCrud = new DatabaseCrud($adapter, $databaseModify, $this->databaseSelect, $table, $this->primaryKey); |
|
| 28 | + $this->databaseSelect = new DatabaseSelect($adapter, $databaseModify, $table, $defaultSort, $options->getCacheMode()); |
|
| 29 | + $this->databaseCrud = new DatabaseCrud($adapter, $databaseModify, $this->databaseSelect, $table, $this->primaryKey); |
|
| 30 | 30 | |
| 31 | 31 | $databaseModify->optimizeColumns(); |
| 32 | 32 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function findByField(array $fields, $options = []) { |
| 55 | - return $this->databaseSelect->findByField($fields, $options); |
|
| 55 | + return $this->databaseSelect->findByField($fields, $options); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function deleteByField(array $fields, array $options = []) { |
@@ -60,6 +60,6 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function save($data) { |
| 63 | - $this->databaseCrud->save($data, true); |
|
| 63 | + $this->databaseCrud->save($data, true); |
|
| 64 | 64 | } |
| 65 | 65 | } |
@@ -19,9 +19,9 @@ |
||
| 19 | 19 | $this->primaryKey = is_array($primaryKey) ? $primaryKey : [$primaryKey]; |
| 20 | 20 | $this->table = $table; |
| 21 | 21 | |
| 22 | - $this->fields = implode(',', array_map([$adapter, 'quote'], (array) $options->read('fields'))); |
|
| 22 | + $this->fields = implode(',', array_map([$adapter, 'quote'], (array)$options->read('fields'))); |
|
| 23 | 23 | |
| 24 | - $defaultSort = $options->read('defaultSort') !== false ? $options->read('defaultSort') : implode(', ', $this->primaryKey); |
|
| 24 | + $defaultSort = $options->read('defaultSort') !== false ? $options->read('defaultSort') : implode(', ', $this->primaryKey); |
|
| 25 | 25 | |
| 26 | 26 | $databaseModify = new DatabaseModify($adapter, $options->getEditMode(), $table); |
| 27 | 27 | |