CategoryX::finder PHP Method

finder() public static method

public static finder ( $class = __CLASS__ )
    public static function finder($class = __CLASS__)
    {
        return parent::finder($class);
    }

Usage Example

 function testParentChild()
 {
     $obj = CategoryX::finder()->withChild_Categories()->withParent_Category()->findByPk(2);
     $this->assertEquals($obj->cat_id, '2');
     $this->assertEquals(count($obj->child_categories), 2);
     $this->assertNotNull($obj->parent_category);
     $this->assertEquals($obj->child_categories[0]->cat_id, 3);
     $this->assertEquals($obj->child_categories[1]->cat_id, 4);
     $this->assertEquals($obj->parent_category->cat_id, 1);
 }
CategoryX