Term::beforeDelete PHP Method

beforeDelete() public method

Allow delete on whether given Term has any association left with Taxonomy
public beforeDelete ( $cascade = true ) : boolean
return boolean
    public function beforeDelete($cascade = true)
    {
        $Taxonomy = ClassRegistry::init('Taxonomy.Taxonomy');
        $count = $Taxonomy->find('count', array('recursive' => -1, 'conditions' => array($Taxonomy->escapeField('term_id') => $this->id)));
        return $count === 0;
    }