Browse Source

adjusted ActiveRelationTrait phpdoc

ar-bug
Carsten Brandt 8 years ago
parent
commit
ea2cab8876
  1. 8
      framework/db/ActiveRelationTrait.php

8
framework/db/ActiveRelationTrait.php

@ -56,7 +56,7 @@ trait ActiveRelationTrait
* is the "orders", and the inverse of the "orders" relation is the "customer". * is the "orders", and the inverse of the "orders" relation is the "customer".
* If this property is set, the primary record(s) will be referenced through the specified relation. * If this property is set, the primary record(s) will be referenced through the specified relation.
* For example, `$customer->orders[0]->customer` and `$customer` will be the same object, * For example, `$customer->orders[0]->customer` and `$customer` will be the same object,
* and accessing the customer of an order will not trigger new DB query. * and accessing the customer of an order will not trigger a new DB query.
* This property is only used in relational context. * This property is only used in relational context.
* @see inverseOf() * @see inverseOf()
*/ */
@ -139,8 +139,8 @@ trait ActiveRelationTrait
/** /**
* Finds the related records for the specified primary record. * Finds the related records for the specified primary record.
* This method is invoked when a relation of an ActiveRecord is being accessed in a lazy fashion. * This method is invoked when a relation of an ActiveRecord is being accessed in a lazy fashion.
* @param string $name the relation name * @param string $name the relation name.
* @param ActiveRecordInterface|BaseActiveRecord $model the primary model * @param ActiveRecordInterface|BaseActiveRecord $model the primary model.
* @return mixed the related record(s) * @return mixed the related record(s)
* @throws InvalidParamException if the relation is invalid * @throws InvalidParamException if the relation is invalid
*/ */
@ -441,6 +441,7 @@ trait ActiveRelationTrait
} }
/** /**
* Adjust this query's condition to match related models primary keys only, i.e. to limit query to related records only.
* @param array $models * @param array $models
*/ */
private function filterByModels($models) private function filterByModels($models)
@ -456,6 +457,7 @@ trait ActiveRelationTrait
foreach ($models as $model) { foreach ($models as $model) {
if (($value = $model[$attribute]) !== null) { if (($value = $model[$attribute]) !== null) {
if (is_array($value)) { if (is_array($value)) {
// relation via multi value column
$values = array_merge($values, $value); $values = array_merge($values, $value);
} else { } else {
$values[] = $value; $values[] = $value;

Loading…
Cancel
Save