Term::isInVocabulary PHP Method

isInVocabulary() public method

Convenience method to check whether term exists within a vocabulary
public isInVocabulary ( integer $id, integer $vocabularyId, integer $taxonomyId = null ) : boolean
$id integer Term Id
$vocabularyId integer Vocabulary Id
$taxonomyId integer Taxonomy Id
return boolean True if Term exists in Vocabulary
    public function isInVocabulary($id, $vocabularyId, $taxonomyId = null)
    {
        $conditions = array('term_id' => $id, 'vocabulary_id' => $vocabularyId);
        if (!is_null($taxonomyId)) {
            $conditions['Taxonomy.id !='] = $taxonomyId;
        }
        return $this->Vocabulary->Taxonomy->hasAny($conditions);
    }