Skip to content
This repository was archived by the owner on Dec 29, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/Controller/Component/PrgComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Behavior/SearchableBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'),
Expand Down