/** * * Apply current condition will be applied to a query using this function. * * @param \yii\db\ActiveQuery $query The query object which current condition must be applied to */ public function prepareQuery($query) { $field = $this->functionObj->prepareSql(); if (!$field) { return NULL; } switch ($this->operation) { case 'select': // Here I need to add property to the target class accroding to alias $query->addSelect([$this->alias => $field]); break; case 'where': $query->andWhere($field); break; case 'group': $query->addGroupBy($field); break; case 'order': $query->addOrderBy($field); break; case 'order_inv': $query->addOrderBy([$field => SORT_DESC]); break; } }