Permalink
Browse files

Re-expose DboSource::fetchAssociated() for BC.

Internally use protected methods to fetch hasMany and hasAndBelongsToMany
associations.
  • Loading branch information...
bar committed Dec 21, 2013
1 parent 5ccb77e commit c15f7de164e4346ec24daf56f4d2acbe1a3dba99
Showing with 19 additions and 4 deletions.
  1. +19 −4 lib/Cake/Model/Datasource/DboSource.php
@@ -1248,7 +1248,7 @@ public function queryAssociation(Model $Model, Model $LinkModel, $type, $associa
// Fetch
$assocResultSet = array();
if (!empty($assocIds)) {
- $assocResultSet = $this->fetchHasMany($Model, $queryTemplate, $assocIds);
+ $assocResultSet = $this->_fetchHasMany($Model, $queryTemplate, $assocIds);
}
// Recursively query associations
@@ -1286,7 +1286,7 @@ public function queryAssociation(Model $Model, Model $LinkModel, $type, $associa
// Fetch
$assocResultSet = array();
if (!empty($assocIds)) {
- $assocResultSet = $this->fetchHasAndBelongsToMany($Model, $queryTemplate, $assocIds, $association);
+ $assocResultSet = $this->_fetchHasAndBelongsToMany($Model, $queryTemplate, $assocIds, $association);
}
$habtmAssocData = $Model->hasAndBelongsToMany[$association];
@@ -1379,6 +1379,21 @@ public function queryAssociation(Model $Model, Model $LinkModel, $type, $associa
}
}
+/**
+ * Fetch 'hasMany' associations.
+ *
+ * This is just a proxy to maintain BC.
+ *
+ * @param Model $Model Primary model object.
+ * @param string $query Association query template.
+ * @param array $ids Array of IDs of associated records.
+ * @return array Association results.
+ * @see DboSource::_fetchHasMany()
+ */
+ public function fetchAssociated(Model $Model, $query, $ids) {
+ return $this->_fetchHasMany($Model, $query, $ids);
+ }
+
/**
* Fetch 'hasMany' associations.
*
@@ -1387,7 +1402,7 @@ public function queryAssociation(Model $Model, Model $LinkModel, $type, $associa
* @param array $ids Array of IDs of associated records.
* @return array Association results.
*/
- public function fetchHasMany(Model $Model, $query, $ids) {
+ protected function _fetchHasMany(Model $Model, $query, $ids) {
$ids = array_unique($ids);
$query = str_replace('{$__cakeID__$}', implode(', ', $ids), $query);
@@ -1407,7 +1422,7 @@ public function fetchHasMany(Model $Model, $query, $ids) {
* @param string $association Association name.
* @return array Association results.
*/
- public function fetchHasAndBelongsToMany(Model $Model, $query, $ids, $association) {
+ protected function _fetchHasAndBelongsToMany(Model $Model, $query, $ids, $association) {
$ids = array_unique($ids);
if (count($ids) > 1) {

0 comments on commit c15f7de

Please sign in to comment.