mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
fixing check in magic methods for a value otherwise it will return false adding test to dbosource
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4746 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
a1e535a05d
commit
ed342c307d
2 changed files with 8 additions and 3 deletions
|
@ -212,14 +212,14 @@ class DboSource extends DataSource {
|
||||||
$order = $params[2 + $off];
|
$order = $params[2 + $off];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($params[0])) {
|
if(!array_key_exists(0, $params)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$c = 0;
|
$c = 0;
|
||||||
$query = array();
|
$query = array();
|
||||||
foreach ($field as $f) {
|
foreach ($field as $f) {
|
||||||
if (!is_array($params[$c])) {
|
if (!is_array($params[$c]) && !empty($params[$c])) {
|
||||||
$query[$args[2]->name . '.' . $f] = '= ' . $params[$c];
|
$query[$args[2]->name . '.' . $f] = '= ' . $params[$c];
|
||||||
} else {
|
} else {
|
||||||
$query[$args[2]->name . '.' . $f] = $params[$c];
|
$query[$args[2]->name . '.' . $f] = $params[$c];
|
||||||
|
|
|
@ -1381,6 +1381,11 @@ class DboSourceTest extends UnitTestCase {
|
||||||
$result = $this->db->query('findByFieldName', array('= a'), $this->model);
|
$result = $this->db->query('findByFieldName', array('= a'), $this->model);
|
||||||
$expected = array('TestModel.field_name' => '= = a');
|
$expected = array('TestModel.field_name' => '= = a');
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
|
$result = $this->db->query('findByFieldName', array(), $this->model);
|
||||||
|
$expected = false;
|
||||||
|
$this->assertEqual($result, $expected);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testOrderParsing() {
|
function testOrderParsing() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue