Skip to content
This repository
Browse code

Fixing unnecessary extra calls to 'afterFind' callback of 'hasMany' a…

…ssociated models. Closes #995
  • Loading branch information...
commit bfaaa6b8ba2422c7b9cec5c67a1ed81a8950388f 1 parent 82fffe6
ADmad authored
8  cake/libs/model/datasources/dbo_source.php
@@ -54,7 +54,7 @@ class DboSource extends DataSource {
54 54
 
55 55
 /**
56 56
  * Caches result from query parsing operations.  Cached results for both DboSource::name() and
57  
- * DboSource::conditions() will be stored here.  Method caching uses `crc32()` which is 
  57
+ * DboSource::conditions() will be stored here.  Method caching uses `crc32()` which is
58 58
  * fast but can collisions more easily than other hashing algorithms.  If you have problems
59 59
  * with collisions, set DboSource::$cacheMethods to false.
60 60
  *
@@ -519,7 +519,7 @@ function cacheMethod($method, $key, $value = null) {
519 519
  * because the method uses a simple hashing algorithm it can infrequently have collisions.
520 520
  * Setting DboSource::$cacheMethods to false will disable the memory cache.
521 521
  *
522  
- * @param mixed $data Either a string with a column to quote. An array of columns to quote or an 
  522
+ * @param mixed $data Either a string with a column to quote. An array of columns to quote or an
523 523
  *   object from DboSource::expression() or DboSource::identifier()
524 524
  * @return string SQL field
525 525
  * @access public
@@ -845,6 +845,10 @@ function read(&$model, $queryData = array(), $recursive = null) {
845 845
 						$stack = array($assoc);
846 846
 						$db->queryAssociation($model, $linkModel, $type, $assoc, $assocData, $array, true, $resultSet, $model->recursive - 1, $stack);
847 847
 						unset($db);
  848
+
  849
+						if ($type === 'hasMany') {
  850
+							$filtered []= $assoc;
  851
+						}
848 852
 					}
849 853
 				}
850 854
 			}

0 notes on commit bfaaa6b

Please sign in to comment.
Something went wrong with that request. Please try again.