public function getImages() { $result = $this->hasMany(RImages::className(), ['id_item' => 'id']); if (count($result->all()) == 0) { $result = RImages::find()->where(["id" => 1])->all(); } return $result; }
public function getImages() { if (!$this->id_item) { $result = RImages::find()->where(["id" => 1])->all(); } else { $result = RImages::find()->where(["id_item" => $this->id_item])->all(); } return $result; }