mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +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
|
@ -211,15 +211,15 @@ class DboSource extends DataSource {
|
|||
if (isset($params[2 + $off])) {
|
||||
$order = $params[2 + $off];
|
||||
}
|
||||
|
||||
if(!isset($params[0])) {
|
||||
|
||||
if(!array_key_exists(0, $params)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$c = 0;
|
||||
$query = array();
|
||||
foreach ($field as $f) {
|
||||
if (!is_array($params[$c])) {
|
||||
if (!is_array($params[$c]) && !empty($params[$c])) {
|
||||
$query[$args[2]->name . '.' . $f] = '= ' . $params[$c];
|
||||
} else {
|
||||
$query[$args[2]->name . '.' . $f] = $params[$c];
|
||||
|
|
|
@ -1381,6 +1381,11 @@ class DboSourceTest extends UnitTestCase {
|
|||
$result = $this->db->query('findByFieldName', array('= a'), $this->model);
|
||||
$expected = array('TestModel.field_name' => '= = a');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->db->query('findByFieldName', array(), $this->model);
|
||||
$expected = false;
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
}
|
||||
|
||||
function testOrderParsing() {
|
||||
|
|
Loading…
Add table
Reference in a new issue