Adding fix for association query when the association has a null value

for a FK


git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3473 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-09-14 02:11:38 +00:00
parent 9fa1748678
commit 10ad71b30c
2 changed files with 15 additions and 8 deletions
cake/libs/model/datasources

View file

@ -418,6 +418,9 @@ class DataSource extends Object{
}
break;
}
if(empty($val)){
return false;
}
$query = r($key, $this->value($val, $model->getColumnType($model->primaryKey)), $query);
}
}

View file

@ -666,7 +666,11 @@ class DboSource extends DataSource {
$row =& $resultSet[$i];
$q = $this->insertQueryData($query, $resultSet[$i], $association, $assocData, $model, $linkModel, $stack);
if($q != false){
$fetch = $this->fetchAll($q, $model->cacheQueries, $model->name);
} else {
$fetch = null;
}
if (!empty($fetch) && is_array($fetch)) {
if ($recursive > 0) {