public function populate($rows)
    {
        if (empty($rows)) {
            return [];
        }

        $indexBy = $this->indexBy;
        $this->indexBy = null;
        $rows = parent::populate($rows);
        $this->indexBy = $indexBy;

        $models = $this->createModels($rows);

        if (!empty($this->with)) {
            $this->findWith($this->with, $models);
        }
        if (!$this->asArray) {
            foreach ($models as $model) {
                $model->afterFind();
            }
        }

        return parent::populate($models);
    }
public function populate($rows)
    {
        if (empty($rows)) {
            return [];
        }

        $indexBy = $this->indexBy;
        $this->indexBy = null;
        $rows = parent::populate($rows);
        $this->indexBy = $indexBy;

        $models = $this->createModels($rows);

        if (!empty($this->with)) {
            $this->findWith($this->with, $models);
        }
        if (!$this->asArray) {
            foreach ($models as $model) {
                $model->afterFind();
            }
        }

        return parent::populate($models);
    }
public function populate ( $ rows ) { if ( empty ( $ rows ) ) { return [ ] ; } $ indexBy = $ this -> indexBy ; $ this -> indexBy = null ; $ rows = parent :: populate ( $ rows ) ; $ this -> indexBy = $ indexBy ; $ models = $ this -> createModels ( $ rows ) ; if ( ! empty ( $ this -> with ) ) { $ this -> findWith ( $ this -> with , $ models ) ; } if ( ! $ this -> asArray ) { foreach ( $ models as $ model ) { $ model -> afterFind ( ) ; } } return parent :: populate ( $ models ) ; }
Converts the raw query results into the format as specified by this query.
This method is internally used to convert the data fetched from MongoDB
into the format as required by this query.
@param array $rows the raw query result from MongoDB
@return array the converted query result
Converts the raw query results into the format as specified by this query . This method is internally used to convert the data fetched from MongoDB into the format as required by this query .