Skip to content
Permalink
Browse files

Adding array_filter() to remove empty conditions that can be caused b…

…y array casting an empty string.
  • Loading branch information...
markstory committed Mar 16, 2010
1 parent daf02ca commit 190066fd51c222de91989aec97b0042d7bcda7c9
Showing with 3 additions and 3 deletions.
  1. +3 −3 cake/libs/model/model.php
@@ -1370,10 +1370,10 @@ function __saveMulti($joined, $id) {
}
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 @@ function __saveMulti($joined, $id) {
}
if (!empty($newValues)) {
$fields = implode(',', $fields);
$fields = implode(',', $fields);
$db->insertMulti($this->{$join}, $fields, $newValues);
}
}

0 comments on commit 190066f

Please sign in to comment.
You can’t perform that action at this time.