public function findWith($with, &$models)
    {
        $primaryModel = reset($models);
        if (!$primaryModel instanceof ActiveRecordInterface) {
            /* @var $modelClass ActiveRecordInterface */
            $modelClass = $this->modelClass;
            $primaryModel = $modelClass::instance();
        }
        $relations = $this->normalizeRelations($primaryModel, $with);
        /* @var $relation ActiveQuery */
        $promises = [];
        foreach ($relations as $name => $relation) {
            if ($relation->asArray === null) {
                // inherit asArray from primary query
                $relation->asArray($this->asArray);
            }
            $promises[] = $relation->populateRelation($name, $models);
        }
        return !empty($promises) ? all($promises) : resolve(true);
    }
public function findWith($with, &$models)
    {
        $primaryModel = reset($models);
        if (!$primaryModel instanceof ActiveRecordInterface) {
            /* @var $modelClass ActiveRecordInterface */
            $modelClass = $this->modelClass;
            $primaryModel = $modelClass::instance();
        }
        $relations = $this->normalizeRelations($primaryModel, $with);
        /* @var $relation ActiveQuery */
        $promises = [];
        foreach ($relations as $name => $relation) {
            if ($relation->asArray === null) {
                // inherit asArray from primary query
                $relation->asArray($this->asArray);
            }
            $promises[] = $relation->populateRelation($name, $models);
        }
        return !empty($promises) ? all($promises) : resolve(true);
    }
public function findWith ( $ with , & $ models ) { $ primaryModel = reset ( $ models ) ; if ( ! $ primaryModel instanceof ActiveRecordInterface ) { /* @var $modelClass ActiveRecordInterface */ $ modelClass = $ this -> modelClass ; $ primaryModel = $ modelClass :: instance ( ) ; } $ relations = $ this -> normalizeRelations ( $ primaryModel , $ with ) ; /* @var $relation ActiveQuery */ $ promises = [ ] ; foreach ( $ relations as $ name => $ relation ) { if ( $ relation -> asArray === null ) { // inherit asArray from primary query $ relation -> asArray ( $ this -> asArray ) ; } $ promises [ ] = $ relation -> populateRelation ( $ name , $ models ) ; } return ! empty ( $ promises ) ? all ( $ promises ) : resolve ( true ) ; }
Finds records corresponding to one or multiple relations and populates them into the primary models.
@param array                         $with a list of relations that this query should be performed with. Please
refer to [[with()]] for details about specifying this parameter.
@param array|ActiveRecordInterface[] $models the primary models (can be either AR instances or arrays)
@return \Reaction\Promise\ExtendedPromiseInterface
Finds records corresponding to one or multiple relations and populates them into the primary models .