buildCursor() публичный Метод

Builds the Mongo cursor for this query.
public buildCursor ( Connection $db = null ) : MongoDB\Driver\Cursor
$db Connection the database connection used to execute the query.
Результат MongoDB\Driver\Cursor mongo cursor instance.
Пример #1
0
 /**
  * @inheritdoc
  */
 protected function buildCursor($db = null)
 {
     if ($this->primaryModel !== null) {
         // lazy loading
         if ($this->via instanceof self) {
             // via pivot collection
             $viaModels = $this->via->findJunctionRows([$this->primaryModel]);
             $this->filterByModels($viaModels);
         } elseif (is_array($this->via)) {
             // via relation
             /* @var $viaQuery ActiveQuery */
             list($viaName, $viaQuery) = $this->via;
             if ($viaQuery->multiple) {
                 $viaModels = $viaQuery->all();
                 $this->primaryModel->populateRelation($viaName, $viaModels);
             } else {
                 $model = $viaQuery->one();
                 $this->primaryModel->populateRelation($viaName, $model);
                 $viaModels = $model === null ? [] : [$model];
             }
             $this->filterByModels($viaModels);
         } else {
             $this->filterByModels([$this->primaryModel]);
         }
     }
     return parent::buildCursor($db);
 }
Пример #2
0
 public function buildCursor($db = null)
 {
     return parent::buildCursor($db);
 }