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
파일 보기 프로젝트 열기: pantheon-systems/terminus 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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