Beispiel #1
0
 public function getParent()
 {
     switch ($row['type']) {
         case self::TYPE_PAGE:
             return $this->hasOne(Page::className(), ['id' => 'parentId']);
         case self::TYPE_POST:
             return $this->hasOne(Post::className(), ['id' => 'parentId']);
     }
 }