PHP Класс GDS\Store

MUST be for a specific Entity Kind (as defined by the Schema or Kind passed in on construction)
Автор: Tom Walder ([email protected])
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( Schema | string | null $kind_schema = null, Gateway $obj_gateway = null ) Gateway and Schema/Kind can be supplied on construction
beginTransaction ( boolean $bol_cross_group = FALSE ) Begin a transaction
createEntity ( array | null $arr_data = null ) : Entity Create a new instance of this GDS Entity class
delete ( $entities ) : boolean Delete one or more Model objects from the Datastore
fetchAll ( $str_query = null, array | null $arr_params = null ) : Entity[] Fetch Entities (optionally based on a GQL query)
fetchById ( $str_id ) : Entity | null Fetch a single Entity from the Datastore, by it's Key ID
fetchByIds ( array $arr_ids ) : Entity[] Fetch multiple entities by Key ID
fetchByName ( $str_name ) : Entity | null Fetch a single Entity from the Datastore, by it's Key Name
fetchByNames ( array $arr_names ) : Entity | null Fetch one or more Entities from the Datastore, by their Key Name
fetchEntityGroup ( Entity $obj_entity ) : Entity[] Fetch all of the entities in a particular group
fetchOne ( $str_query = null, array | null $arr_params = null ) : Entity Fetch ONE Entity based on a GQL query
fetchPage ( $int_page_size, null $mix_offset = null ) : Entity[] Fetch (a page of) Entities (optionally based on a GQL query)
getCursor ( ) : null | string Get the last result cursor
query ( $str_query, array | null $arr_params = null ) Fetch Entities based on a GQL query
setCursor ( $str_cursor ) Set the query cursor
setEntityClass ( $str_class ) Set the class to use when instantiating new Entity objects
upsert ( $entities ) Write one or more new/changed Entity objects to the Datastore

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

Метод Описание
buildSchema ( ) : Schema | null Optionally build and return a Schema object describing the data model

Приватные методы

Метод Описание
consumeTransaction ( ) : string | null Clear and return the current transaction ID
determineSchema ( Schema | string | null $mix_schema ) : Schema Set up the Schema for the current data model, based on the provided Kind/Schema/buildSchema

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

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

Gateway and Schema/Kind can be supplied on construction
public __construct ( Schema | string | null $kind_schema = null, Gateway $obj_gateway = null )
$kind_schema Schema | string | null
$obj_gateway Gateway

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

Begin a transaction
public beginTransaction ( boolean $bol_cross_group = FALSE )
$bol_cross_group boolean

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

This method is intended to be overridden in any extended Store classes
protected buildSchema ( ) : Schema | null
Результат Schema | null

createEntity() закрытый публичный Метод

Create a new instance of this GDS Entity class
final public createEntity ( array | null $arr_data = null ) : Entity
$arr_data array | null
Результат Entity

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

Delete one or more Model objects from the Datastore
public delete ( $entities ) : boolean
Результат boolean

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

Fetch Entities (optionally based on a GQL query)
public fetchAll ( $str_query = null, array | null $arr_params = null ) : Entity[]
$str_query
$arr_params array | null
Результат Entity[]

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

Only works for root Entities (i.e. those without parent Entities)
public fetchById ( $str_id ) : Entity | null
$str_id
Результат Entity | null

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

Fetch multiple entities by Key ID
public fetchByIds ( array $arr_ids ) : Entity[]
$arr_ids array
Результат Entity[]

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

Only works for root Entities (i.e. those without parent Entities)
public fetchByName ( $str_name ) : Entity | null
$str_name
Результат Entity | null

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

Only works for root Entities (i.e. those without parent Entities)
public fetchByNames ( array $arr_names ) : Entity | null
$arr_names array
Результат Entity | null

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

Fetch all of the entities in a particular group
public fetchEntityGroup ( Entity $obj_entity ) : Entity[]
$obj_entity Entity
Результат Entity[]

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

Fetch ONE Entity based on a GQL query
public fetchOne ( $str_query = null, array | null $arr_params = null ) : Entity
$str_query
$arr_params array | null
Результат Entity

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

Fetch (a page of) Entities (optionally based on a GQL query)
public fetchPage ( $int_page_size, null $mix_offset = null ) : Entity[]
$int_page_size
$mix_offset null
Результат Entity[]

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

Get the last result cursor
public getCursor ( ) : null | string
Результат null | string

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

Supported parameter types: String, Integer, DateTime, GDS\Entity
public query ( $str_query, array | null $arr_params = null )
$str_query
$arr_params array | null

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

Usually before continuing through a paged result set
public setCursor ( $str_cursor )
$str_cursor

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

Must be GDS\Entity, or a sub-class of it This method is here to maintain backwards compatibility. The Schema is responsible in 2.0+
public setEntityClass ( $str_class )
$str_class

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

Write one or more new/changed Entity objects to the Datastore
public upsert ( $entities )