mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +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']) {
|
if ($this->hasAndBelongsToMany[$assoc]['unique']) {
|
||||||
$conditions = array_merge(
|
$conditions = array_filter(array_merge(
|
||||||
array($join . '.' . $this->hasAndBelongsToMany[$assoc]['foreignKey'] => $id),
|
array($join . '.' . $this->hasAndBelongsToMany[$assoc]['foreignKey'] => $id),
|
||||||
(array)$this->hasAndBelongsToMany[$assoc]['conditions']
|
(array)$this->hasAndBelongsToMany[$assoc]['conditions']
|
||||||
);
|
));
|
||||||
$links = $this->{$join}->find('all', array(
|
$links = $this->{$join}->find('all', array(
|
||||||
'conditions' => $conditions,
|
'conditions' => $conditions,
|
||||||
'recursive' => empty($this->hasAndBelongsToMany[$assoc]['conditions']) ? -1 : 0,
|
'recursive' => empty($this->hasAndBelongsToMany[$assoc]['conditions']) ? -1 : 0,
|
||||||
|
|
Loading…
Reference in a new issue