public function getParent()
    {
        // Load the "current" level from the tree
        $currentLevel = CActiveRecord::model($this->treeClass)->findByAttributes(
            array('descendantId' => $this->owner->{$this->idAttribute}, 'depth' => 1)
        );

        if ($currentLevel->ancestorId > 0) {
            return CActiveRecord::model(get_class($this->owner))->findByPk($currentLevel->ancestorId);
        } else {
            return null;
        }
    }
public function getParent()
    {
        // Load the "current" level from the tree
        $currentLevel = CActiveRecord::model($this->treeClass)->findByAttributes(
            array('descendantId' => $this->owner->{$this->idAttribute}, 'depth' => 1)
        );

        if ($currentLevel->ancestorId > 0) {
            return CActiveRecord::model(get_class($this->owner))->findByPk($currentLevel->ancestorId);
        } else {
            return null;
        }
    }
public function getParent ( ) { // Load the "current" level from the tree $ currentLevel = CActiveRecord :: model ( $ this -> treeClass ) -> findByAttributes ( array ( 'descendantId' => $ this -> owner -> { $ this -> idAttribute } , 'depth' => 1 ) ) ; if ( $ currentLevel -> ancestorId > 0 ) { return CActiveRecord :: model ( get_class ( $ this -> owner ) ) -> findByPk ( $ currentLevel -> ancestorId ) ; } else { return null ; } }
Get the parent of a model.
@return CActiveRecord
Get the parent of a model .