From f51b16648c20af796aa2558ca29e82f78156840a Mon Sep 17 00:00:00 2001 From: VD Date: Mon, 7 May 2018 23:43:08 +0200 Subject: [PATCH 1/3] add cakephp 3.6 support --- src/Controller/Component/PrgComponent.php | 19 ++++++++++--------- src/Model/Behavior/SearchableBehavior.php | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/Controller/Component/PrgComponent.php b/src/Controller/Component/PrgComponent.php index 005d1df..c64360a 100644 --- a/src/Controller/Component/PrgComponent.php +++ b/src/Controller/Component/PrgComponent.php @@ -181,7 +181,7 @@ public function presetForm($options) { } extract(Hash::merge($this->_config['presetForm'], $options)); - $args = $this->controller->request->query; + $args = $this->controller->request->getQuery(); $parsedParams = []; $data = []; @@ -219,9 +219,10 @@ public function presetForm($options) { } if ($formName) { - $this->controller->request->data[$formName] = $data; + $newRequest = $this->controller->request->withData($formName, $data); + $this->controller->setRequest($newRequest); } else { - $this->controller->request->data = $data; + $this->controller->request->withParsedBody($data); } $this->_parsedParams = $parsedParams; @@ -315,18 +316,18 @@ public function commonProcess($tableName = null, array $options = []) { } if (empty($action)) { - $action = $this->controller->request->params['action']; + $action = $this->controller->request->getParam('action'); } if (!empty($formName) && isset($this->controller->request->data[$formName])) { - $searchParams = $this->controller->request->data[$formName]; - } elseif (isset($this->controller->request->data[$tableName])) { - $searchParams = $this->controller->request->data[$tableName]; + $searchParams = $this->controller->request->getData($formName); + } elseif ($this->controller->request->getData($tableName)) { + $searchParams = $this->controller->request->getData($tableName); if (empty($formName)) { $formName = $tableName; } } else { - $searchParams = $this->controller->request->data; + $searchParams = $this->controller->request->getData(); } if (!empty($searchParams)) { @@ -368,7 +369,7 @@ public function commonProcess($tableName = null, array $options = []) { } else { $this->controller->Flash->error(__d('search', 'Please correct the errors below.')); } - } elseif (!empty($this->controller->request->query)) { + } elseif ($this->controller->request->getQuery()) { $this->presetForm(['table' => $tableName, 'formName' => $formName]); } } diff --git a/src/Model/Behavior/SearchableBehavior.php b/src/Model/Behavior/SearchableBehavior.php index 962337a..25eb6c0 100755 --- a/src/Model/Behavior/SearchableBehavior.php +++ b/src/Model/Behavior/SearchableBehavior.php @@ -241,7 +241,7 @@ protected function _addCondLike($data, $field) { $cond = []; foreach ($fieldNames as $fieldName) { if (strpos($fieldName, '.') === false) { - $fieldName = $this->_table->alias() . '.' . $fieldName; + $fieldName = $this->_table->getAlias() . '.' . $fieldName; } if ($field['before'] === true) { @@ -326,7 +326,7 @@ protected function _addCondValue($data, $field) { $cond = []; foreach ($fieldNames as $fieldName) { if (strpos($fieldName, '.') === false) { - $fieldName = $this->_table->alias() . '.' . $fieldName; + $fieldName = $this->_table->getAlias() . '.' . $fieldName; } if (is_array($fieldValue) && empty($fieldValue)) { continue; From 6ea7b46817602fb43611d80f7e7139ba81b45db6 Mon Sep 17 00:00:00 2001 From: VD Date: Tue, 8 May 2018 22:32:53 +0200 Subject: [PATCH 2/3] remove deprecated method --- tests/bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index db40c89..67d4514 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -74,7 +74,7 @@ function find_app() { ] ]; -Cake\Cache\Cache::config($cache); +Cake\Cache\Cache::setConfig($cache); Cake\Core\Plugin::load('Search', ['path' => './']); // Ensure default test connection is defined From 3734eab669ef36e3f930f87b6b0dddeb32985342 Mon Sep 17 00:00:00 2001 From: VD Date: Tue, 8 May 2018 22:51:24 +0200 Subject: [PATCH 3/3] remove deprecated method --- tests/bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 67d4514..66c5713 100755 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -83,7 +83,7 @@ function find_app() { putenv('db_dsn=sqlite::memory:'); } -Cake\Datasource\ConnectionManager::config('test', [ +Cake\Datasource\ConnectionManager::setConfig('test', [ 'className' => 'Cake\Database\Connection', 'driver' => getenv('db_class'), 'dsn' => getenv('db_dsn'),