Skip to content

Commit

Permalink
fixes #6506, notice on 5.2.10 for habtm save with empty value
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8251 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
gwoo committed Jul 23, 2009
1 parent 93d64c4 commit 30281d6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cake/libs/model/model.php
Expand Up @@ -372,7 +372,7 @@ function __construct($id = false, $table = null, $ds = null) {
} elseif ($table) {
$this->useTable = $table;
}

if ($ds !== null) {
$this->useDbConfig = $ds;
}
Expand Down Expand Up @@ -827,7 +827,7 @@ function deconstruct($field, $data) {
$type = $this->getColumnType($field);

if (in_array($type, array('datetime', 'timestamp', 'date', 'time'))) {
$useNewDate = (isset($data['year']) || isset($data['month']) ||
$useNewDate = (isset($data['year']) || isset($data['month']) ||
isset($data['day']) || isset($data['hour']) || isset($data['minute']));

$dateFields = array('Y' => 'year', 'm' => 'month', 'd' => 'day', 'H' => 'hour', 'i' => 'min', 's' => 'sec');
Expand Down Expand Up @@ -1343,7 +1343,7 @@ function __saveMulti($joined, $id) {
unset($values);
} elseif (isset($row[$this->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
$newData[] = $row;
} elseif (isset($row[$join][$this->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
} elseif (isset($row[$join]) && isset($row[$join][$this->hasAndBelongsToMany[$assoc]['associationForeignKey']])) {
$newData[] = $row[$join];
}
}
Expand Down

0 comments on commit 30281d6

Please sign in to comment.