From 1acdbb741c1f2b6a0a3c9329c85512d3e62c41e8 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 13 Nov 2013 19:57:32 +0100 Subject: [PATCH] moved indexBy() trait -> interface + removed findWith from interface --- framework/yii/ar/ActiveQueryInterface.php | 19 +++++++++++++++++++ framework/yii/ar/ActiveQueryTrait.php | 22 ---------------------- framework/yii/ar/ActiveRelationInterface.php | 9 --------- 3 files changed, 19 insertions(+), 31 deletions(-) diff --git a/framework/yii/ar/ActiveQueryInterface.php b/framework/yii/ar/ActiveQueryInterface.php index ddcb027..7a1efa1 100644 --- a/framework/yii/ar/ActiveQueryInterface.php +++ b/framework/yii/ar/ActiveQueryInterface.php @@ -27,6 +27,25 @@ interface ActiveQueryInterface extends QueryInterface public function asArray($value = true); /** + * Sets the [[indexBy]] property. + * @param string|callable $column the name of the column by which the query results should be indexed by. + * This can also be a callable (e.g. anonymous function) that returns the index value based on the given + * row or model data. The signature of the callable should be: + * + * ~~~ + * // $model is an AR instance when `asArray` is false, + * // or an array of column values when `asArray` is true. + * function ($model) + * { + * // return the index value corresponding to $model + * } + * ~~~ + * + * @return static the query object itself + */ + public function indexBy($column); + + /** * Specifies the relations with which this query should be performed. * * The parameters to this method can be either one or multiple strings, or a single array diff --git a/framework/yii/ar/ActiveQueryTrait.php b/framework/yii/ar/ActiveQueryTrait.php index e45f72a..98e7870 100644 --- a/framework/yii/ar/ActiveQueryTrait.php +++ b/framework/yii/ar/ActiveQueryTrait.php @@ -103,28 +103,6 @@ trait ActiveQueryTrait } /** - * Sets the [[indexBy]] property. - * @param string|callable $column the name of the column by which the query results should be indexed by. - * This can also be a callable (e.g. anonymous function) that returns the index value based on the given - * row or model data. The signature of the callable should be: - * - * ~~~ - * // $model is an AR instance when `asArray` is false, - * // or an array of column values when `asArray` is true. - * function ($model) - * { - * // return the index value corresponding to $model - * } - * ~~~ - * - * @return static the query object itself - */ - public function indexBy($column) - { - return parent::indexBy($column); - } - - /** * Converts found rows into model instances * @param array $rows * @return array|ActiveRecord[] diff --git a/framework/yii/ar/ActiveRelationInterface.php b/framework/yii/ar/ActiveRelationInterface.php index 1d58a7d..706d394 100644 --- a/framework/yii/ar/ActiveRelationInterface.php +++ b/framework/yii/ar/ActiveRelationInterface.php @@ -26,13 +26,4 @@ interface ActiveRelationInterface extends ActiveQueryInterface * @return static the relation object itself. */ public function via($relationName, $callable = null); - - /** - * Finds the related records and populates them into the primary models. - * This method is internally used by [[ActiveQuery]]. Do not call it directly. - * @param string $name the relation name - * @param array $primaryModels primary models - * @return array the related models - */ - public function findWith($name, &$primaryModels); }