PHP Класс Pantheon\Terminus\Collections\TerminusCollection

Наследование: implements Pantheon\Terminus\Request\RequestAwareInterface, implements League\Container\ContainerAwareInterface, use trait Pantheon\Terminus\Request\RequestAwareTrait, use trait League\Container\ContainerAwareTrait
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$args array
$collected_class string
$models TerminusModel[]
$paged boolean
$url string

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

Метод Описание
__construct ( array $options = [] ) Instantiates the collection, sets param members as properties
add ( object $model_data, array $options = [] ) : TerminusModel Adds a model to this collection
all ( ) : TerminusModel[] Retrieves all models TODO: Remove automatic fetching and make fetches explicit
fetch ( array $options = [] ) : TerminusCollection Fetches model data from API and instantiates its model instances
get ( string $id ) : TerminusModel Retrieves the model of the given ID
getFilteredMemberList ( array $filters, string $key = 'id', string | array $value = 'name' ) : array Returns an array of data where the keys are the attribute $key and the values are the attribute $value, filtered by the given array
getMemberList ( string $key = 'id', string $value = 'name' ) : array Returns an array of data where the keys are the attribute $key and the values are the attribute $value
getUrl ( ) : string Get the listing URL for this collection
ids ( ) : string[] List Model IDs
listing ( string $key = 'id', mixed $value = 'name' ) : array Returns an array of data where the keys are the attribute $key and the values are the attribute $value

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

Метод Описание
getCollectionData ( array $options = [] ) : array Retrieves collection data from the API
getMembers ( ) : TerminusModel[] Retrieves all members of this collection

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

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

Instantiates the collection, sets param members as properties
public __construct ( array $options = [] )
$options array Options with which to configure this collection

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

Adds a model to this collection
public add ( object $model_data, array $options = [] ) : TerminusModel
$model_data object Data to feed into attributes of new model
$options array Data to make properties of the new model
Результат TerminusModel

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

Retrieves all models TODO: Remove automatic fetching and make fetches explicit
public all ( ) : TerminusModel[]
Результат TerminusModel[]

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

Fetches model data from API and instantiates its model instances
public fetch ( array $options = [] ) : TerminusCollection
$options array params to pass to url request
Результат TerminusCollection $this

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

Retrieves the model of the given ID
public get ( string $id ) : TerminusModel
$id string ID of desired model instance
Результат TerminusModel $this->models[$id]

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

Retrieves collection data from the API
protected getCollectionData ( array $options = [] ) : array
$options array params to pass to url request
Результат array

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

Returns an array of data where the keys are the attribute $key and the values are the attribute $value, filtered by the given array
public getFilteredMemberList ( array $filters, string $key = 'id', string | array $value = 'name' ) : array
$filters array Attributes to match during filtration e.g. array('category' => 'other')
$key string Name of attribute to make array keys
$value string | array Name(s) of attribute to make array values
Результат array Array rendered as requested $this->attribute->$key = $this->attribute->$value

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

Returns an array of data where the keys are the attribute $key and the values are the attribute $value
public getMemberList ( string $key = 'id', string $value = 'name' ) : array
$key string Name of attribute to make array keys
$value string Name of attribute to make array values
Результат array Array rendered as requested $this->attribute->$key = $this->attribute->$value

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

Retrieves all members of this collection
protected getMembers ( ) : TerminusModel[]
Результат TerminusModel[]

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

Get the listing URL for this collection
public getUrl ( ) : string
Результат string

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

List Model IDs
public ids ( ) : string[]
Результат string[] Array of all model IDs

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

Returns an array of data where the keys are the attribute $key and the values are the attribute $value
public listing ( string $key = 'id', mixed $value = 'name' ) : array
$key string Name of attribute to make array keys
$value mixed Name(s) of attribute(s) to comprise array values
Результат array Array rendered as requested $this->attribute->$key = $this->attribute->$value

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

$args защищенное свойство

protected array $args
Результат array

$collected_class защищенное свойство

protected string $collected_class
Результат string

$models защищенное свойство

protected TerminusModel[] $models
Результат TerminusModel[]

$paged защищенное свойство

protected bool $paged
Результат boolean

$url защищенное свойство

protected string $url
Результат string