PHP Класс Term

Наследование: extends BaseModel
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$actsAs array Behaviors used by the Model
$findMethods
$hasAndBelongsToMany array Model associations: hasAndBelongsToMany
$name string Model name
$validate array Validation

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
_findByVocabulary ( $state, $query, $results = [] )
_save ( array $data, integer $vocabularyId, integer $taxonomyId = null ) Save new/updated term data

Описание методов

_findByVocabulary() защищенный Метод

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

_save() защищенный Метод

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() публичный Метод

Save term
См. также: Term::_save()
public add ( $data, $vocabularyId ) : array | boolean
Результат array | boolean Array of saved term or boolean false

beforeDelete() публичный Метод

Allow delete on whether given Term has any association left with Taxonomy
public beforeDelete ( $cascade = true ) : boolean
Результат boolean

edit() публичный Метод

Edit term
См. также: Term::_save()
public edit ( $data, $vocabularyId ) : array | boolean
Результат array | boolean Array of saved term or boolean false

hasSlugChanged() публичный Метод

Checks wether slug has changed for given Term id
public hasSlugChanged ( integer $id, string $slug ) : boolean
$id integer Term Id
$slug string Slug
Результат boolean True if slug has changed

isInVocabulary() публичный Метод

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
Результат boolean True if Term exists in Vocabulary

remove() публичный Метод

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

saveAndGetId() публичный Метод

Save Term and return ID.
public saveAndGetId ( array $data ) : integer
$data array
Результат integer

setScopeForTaxonomy() публичный Метод

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

slugExists() публичный Метод

Convenience check for slug
public slugExists ( $slug ) : boolean
Результат boolean

Описание свойств

$actsAs публичное свойство

Behaviors used by the Model
public array $actsAs
Результат array

$findMethods публичное свойство

public $findMethods

$hasAndBelongsToMany публичное свойство

Model associations: hasAndBelongsToMany
public array $hasAndBelongsToMany
Результат array

$name публичное свойство

Model name
public string $name
Результат string

$validate публичное свойство

Validation
public array $validate
Результат array