Commit 1acdbb74 by Carsten Brandt

moved indexBy() trait -> interface + removed findWith from interface

parent 51faa62e
...@@ -27,6 +27,25 @@ interface ActiveQueryInterface extends QueryInterface ...@@ -27,6 +27,25 @@ interface ActiveQueryInterface extends QueryInterface
public function asArray($value = true); 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. * 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 * The parameters to this method can be either one or multiple strings, or a single array
......
...@@ -103,28 +103,6 @@ trait ActiveQueryTrait ...@@ -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 * Converts found rows into model instances
* @param array $rows * @param array $rows
* @return array|ActiveRecord[] * @return array|ActiveRecord[]
......
...@@ -26,13 +26,4 @@ interface ActiveRelationInterface extends ActiveQueryInterface ...@@ -26,13 +26,4 @@ interface ActiveRelationInterface extends ActiveQueryInterface
* @return static the relation object itself. * @return static the relation object itself.
*/ */
public function via($relationName, $callable = null); 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);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment