mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding array_filter() to remove empty conditions that can be caused by array casting an empty string.
This commit is contained in:
parent
daf02cad61
commit
190066fd51
1 changed files with 3 additions and 3 deletions
|
@ -1370,10 +1370,10 @@ class Model extends Overloadable {
|
|||
}
|
||||
|
||||
if ($this->hasAndBelongsToMany[$assoc]['unique']) {
|
||||
$conditions = array_merge(
|
||||
$conditions = array_filter(array_merge(
|
||||
array($join . '.' . $this->hasAndBelongsToMany[$assoc]['foreignKey'] => $id),
|
||||
(array)$this->hasAndBelongsToMany[$assoc]['conditions']
|
||||
);
|
||||
));
|
||||
$links = $this->{$join}->find('all', array(
|
||||
'conditions' => $conditions,
|
||||
'recursive' => empty($this->hasAndBelongsToMany[$assoc]['conditions']) ? -1 : 0,
|
||||
|
@ -1397,7 +1397,7 @@ class Model extends Overloadable {
|
|||
}
|
||||
|
||||
if (!empty($newValues)) {
|
||||
$fields = implode(',', $fields);
|
||||
$fields = implode(',', $fields);
|
||||
$db->insertMulti($this->{$join}, $fields, $newValues);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue