Beispiel #1
0
 protected function searchModelByActiveQuery($searchValue)
 {
     Yii::info('Model implements \\yii\\db\\ActiveRecordInterface', __METHOD__);
     if (empty($searchValue) && $this->searchFallback) {
         $searchValue = Yii::$app->getRequest()->get($this->searchKey = $this->requestKey = $this->model->primaryKey()[0]);
         Yii::info('Search value is empty and fallback is on, trying to get ActiveRecord by primary key' . " ({$this->searchKey} = {$searchValue}," . ' multiple = ' . ($this->multiple ? 'true' : 'false') . ')', __METHOD__);
     }
     $query = $this->buildActiveQuery(['=', $this->searchKey, $searchValue]);
     return $this->model = $this->multiple ? $query->all() : $query->one();
 }