Example #1
0
 /**
  * @param ActiveQuery $query
  * @return array
  * @throws NotSupportedException
  */
 public function build($query)
 {
     $options = $parts = [];
     $query->prepare();
     $this->buildSelect($query->select, $parts);
     $this->buildLimit($query->limit, $parts);
     $this->buildPage($query->offset, $query->limit, $parts);
     $parts = ArrayHelper::merge($parts, $this->buildCondition($query->where));
     return ['queryParts' => $parts, 'index' => $query->index, 'type' => $query->type, 'options' => $options];
 }
Example #2
0
 /**
  * {@inheritdoc}
  *
  * @return ActiveQuery the newly created [[ActiveQuery]] instance.
  */
 public static function find()
 {
     return \Yii::createObject(ActiveQuery::className(), [get_called_class()]);
 }
 /**
  * {@inheritdoc}
  *
  * @return ActiveQuery the newly created [[ActiveQuery]] instance.
  */
 public static function find($options = [])
 {
     $config = ['class' => ActiveQuery::className(), 'options' => $options];
     return \Yii::createObject($config, [get_called_class()]);
 }
 /**
  * @inheritdoc
  * @return Article|array|null
  */
 public function one($db = null)
 {
     return parent::one($db);
 }