I have a Category table where a row can be associated with a parent row (if it is a second level category) via the parentId column. In my AR model file i putted:
public function relations() { // NOTE: you may need to adjust the relation name and the related // class name for the relations automatically generated below. return array( 'categories' => array(self::HAS_MANY, 'Category', 'parentId'), 'parentCategory' => array(self::HAS_ONE, 'Category', 'parentId'), ); }
but it seems it doesn't work why?