protected function getLinks() { if (!is_null($this->frontendLink) || !is_null($this->backendLink)) { return true; } /** @var Image $image */ $image = Image::findById($this->img_id); if (is_null($image) || is_null($object = Object::findById($image->object_id))) { return false; } /** @var \app\models\Object $object */ switch ($object->object_class) { case Page::className(): $this->getPageLinks($image->object_model_id); break; case Category::className(): $this->getCategoryLinks($image->object_model_id); break; case Product::className(): $this->getProductLinks($image->object_model_id); break; default: return false; } return true; }