MenuItem::deleteWithChild PHP Method

deleteWithChild() public method

public deleteWithChild ( ) : boolean
return boolean
    public function deleteWithChild()
    {
        $transaction = Yii::app()->getDb()->beginTransaction();
        try {
            $this->deleteAll('parent_id = :id', [':id' => $this->id]);
            $this->delete();
            $transaction->commit();
            return true;
        } catch (Exception $e) {
            $transaction->rollback();
            Yii::log($e->__toString(), CLogger::LEVEL_ERROR);
            return false;
        }
    }