/** * @return array - ModelCategory associated with parent */ public function getModelCategories() { $parentType = $this->categoryType; return $this->hasMany(ModelCategory::className(), ['parentId' => 'id'])->where("parentType='{$parentType}'"); }