PHP Class Term

Inheritance: extends BaseModel
Afficher le fichier Open project: croogo/croogo Class Usage Examples

Méthodes publiques

Свойство Type Description
$actsAs array Behaviors used by the Model
$findMethods
$hasAndBelongsToMany array Model associations: hasAndBelongsToMany
$name string Model name
$validate array Validation

Méthodes publiques

Méthode Description
add ( $data, $vocabularyId ) : array | boolean Save term
beforeDelete ( $cascade = true ) : boolean Allow delete on whether given Term has any association left with Taxonomy
edit ( $data, $vocabularyId ) : array | boolean Edit term
hasSlugChanged ( integer $id, string $slug ) : boolean Checks wether slug has changed for given Term id
isInVocabulary ( integer $id, integer $vocabularyId, integer $taxonomyId = null ) : boolean Convenience method to check whether term exists within a vocabulary
remove ( integer $id, integer $vocabularyId ) Remove term
saveAndGetId ( array $data ) : integer Save Term and return ID.
setScopeForTaxonomy ( integer $vocabularyId ) Set Scope
slugExists ( $slug ) : boolean Convenience check for slug

Méthodes protégées

Méthode Description
_findByVocabulary ( $state, $query, $results = [] )
_save ( array $data, integer $vocabularyId, integer $taxonomyId = null ) Save new/updated term data

Method Details

_findByVocabulary() protected méthode

protected _findByVocabulary ( $state, $query, $results = [] )

_save() protected méthode

Save new/updated term data
protected _save ( array $data, integer $vocabularyId, integer $taxonomyId = null )
$data array Term data
$vocabularyId integer Vocabulary Id
$taxonomyId integer Taxonomy Id

add() public méthode

Save term
See also: Term::_save()
public add ( $data, $vocabularyId ) : array | boolean
Résultat array | boolean Array of saved term or boolean false

beforeDelete() public méthode

Allow delete on whether given Term has any association left with Taxonomy
public beforeDelete ( $cascade = true ) : boolean
Résultat boolean

edit() public méthode

Edit term
See also: Term::_save()
public edit ( $data, $vocabularyId ) : array | boolean
Résultat array | boolean Array of saved term or boolean false

hasSlugChanged() public méthode

Checks wether slug has changed for given Term id
public hasSlugChanged ( integer $id, string $slug ) : boolean
$id integer Term Id
$slug string Slug
Résultat boolean True if slug has changed

isInVocabulary() public méthode

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
Résultat boolean True if Term exists in Vocabulary

remove() public méthode

Remove term
public remove ( integer $id, integer $vocabularyId )
$id integer Term Id
$vocabularyId integer Vocabulary Id

saveAndGetId() public méthode

Save Term and return ID.
public saveAndGetId ( array $data ) : integer
$data array
Résultat integer

setScopeForTaxonomy() public méthode

Set Scope
public setScopeForTaxonomy ( integer $vocabularyId )
$vocabularyId integer Vocabulary Id

slugExists() public méthode

Convenience check for slug
public slugExists ( $slug ) : boolean
Résultat boolean

Property Details

$actsAs public_oe property

Behaviors used by the Model
public array $actsAs
Résultat array

$findMethods public_oe property

public $findMethods

$hasAndBelongsToMany public_oe property

Model associations: hasAndBelongsToMany
public array $hasAndBelongsToMany
Résultat array

$name public_oe property

Model name
public string $name
Résultat string

$validate public_oe property

Validation
public array $validate
Résultat array