From dcf64033ed3d2e069626b6a72ef7ea2278abb6b3 Mon Sep 17 00:00:00 2001 From: phpnut Date: Mon, 9 Apr 2007 09:40:56 +0000 Subject: [PATCH] Adding fix for undefined index git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4827 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/model/datasources/dbo_source.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index 4d5234bab..76df4808d 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -803,7 +803,7 @@ class DboSource extends DataSource { $merged[$association] = array(); $count = 0; foreach ($merge as $assoc => $data) { - if($value[$model->name][$model->primaryKey] === $data[$association][$model->hasMany[$association]['foreignKey']]) { + if(isset($value[$model->name]) && $value[$model->name][$model->primaryKey] === $data[$association][$model->hasMany[$association]['foreignKey']]) { if(count($data) > 1) { $temp[] = Set::pushDiff($data[$association], $data); unset($temp[$count][$association]); @@ -814,9 +814,11 @@ class DboSource extends DataSource { } $count++; } - $resultSet[$key] = Set::pushDiff($resultSet[$key], $merged); - unset($merged); - unset($temp); + if(isset($value[$model->name])){ + $resultSet[$key] = Set::pushDiff($resultSet[$key], $merged); + unset($merged); + unset($temp); + } } }