public function getSeoData() { if ($this->owner != null) { $this->seoData = SeoData::findOne(['entity_id' => $this->owner->getPrimaryKey(), 'entity_name' => $this->owner->className()]); } if ($this->seoData == null) { $this->seoData = new SeoData(); } }