PHP Класс GDS\Gateway

Persists and retrieves Entities to/from Google Cloud Datastore. This class is designed to work FOR the \GDS\Store, it is not generally expected to be used directly by the application developer
Автор: Tom Walder ([email protected])
Показать файл Открыть проект

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

Свойство Тип Описание
$arr_kind_mappers Mapper[] An array of Mappers, keyed on Entity Kind
$obj_last_response object | null The last response - usually a Commit or Query response
$obj_schema Schema | null The current Schema
$str_dataset_id string | null The dataset ID
$str_namespace string | null Optional namespace (for multi-tenant applications)
$str_next_transaction null | string The transaction ID to use on the next commit

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

Метод Описание
beginTransaction ( boolean $bol_cross_group = FALSE ) : mixed Start a transaction
delete ( Entity $obj_key ) : boolean Delete an Entity
deleteMulti ( array $arr_entities ) : mixed Delete 1-many entities
fetchById ( $int_key_id ) : mixed Fetch one entity by Key ID
fetchByIds ( array $arr_key_ids ) : array Fetch one or more entities by KeyID
fetchByName ( $str_key_name ) : mixed Fetch entity data by Key Name
fetchByNames ( array $arr_key_names ) : array Fetch one or more entities by KeyName
getEndCursor ( ) : mixed Get the end cursor from the last response
gql ( string $str_gql, null | array $arr_params = null ) : mixed Fetch some Entities, based on the supplied GQL and, optionally, parameters
put ( Entity $obj_entity ) Put a single Entity into the Datastore
putMulti ( array $arr_entities ) Put an array of Entities into the Datastore
withSchema ( Schema $obj_schema ) Set the Schema to be used next (once?)
withTransaction ( $str_transaction_id ) Set the transaction ID to be used next (once)

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

Метод Описание
configureObjectValueParamForQuery ( object $obj_val, object $mix_value ) Configure a Value parameter, based on the supplied object-type value
configureValueParamForQuery ( $obj_val, $mix_value ) Part of our "add parameters to query" sequence.
createMapper ( ) : Mapper Create a mapper that's right for this Gateway
determineMapper ( Entity $obj_gds_entity ) : Mapper Determine Mapper (early stage [draft] support for cross-entity upserts)
ensureSchema ( Entity[] $arr_entities ) Default Kind & Schema support for "new" Entities
extractAutoIDs ( ) : array Extract Auto Insert IDs from the last response
fetchByKeyPart ( array $arr_key_parts, $str_setter ) : mixed Fetch 1-many Entities, using the Key parts provided
mapAutoIDs ( array $arr_auto_id_requested ) Record the Auto-generated Key IDs against the GDS Entities.
upsert ( array $arr_entities ) : Entity[] Put an array of Entities into the Datastore. Return any that need AutoIDs

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

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

Start a transaction
abstract public beginTransaction ( boolean $bol_cross_group = FALSE ) : mixed
$bol_cross_group boolean
Результат mixed

configureObjectValueParamForQuery() абстрактный защищенный Метод

Configure a Value parameter, based on the supplied object-type value
abstract protected configureObjectValueParamForQuery ( object $obj_val, object $mix_value )
$obj_val object
$mix_value object

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

Shared between multiple Gateway implementations.
protected configureValueParamForQuery ( $obj_val, $mix_value )
$obj_val
$mix_value

createMapper() абстрактный защищенный Метод

Create a mapper that's right for this Gateway
abstract protected createMapper ( ) : Mapper
Результат Mapper

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

Delete an Entity
public delete ( Entity $obj_key ) : boolean
$obj_key Entity
Результат boolean

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

Delete 1-many entities
abstract public deleteMulti ( array $arr_entities ) : mixed
$arr_entities array
Результат mixed

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

Determine Mapper (early stage [draft] support for cross-entity upserts)
protected determineMapper ( Entity $obj_gds_entity ) : Mapper
$obj_gds_entity Entity
Результат Mapper

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

Default Kind & Schema support for "new" Entities
protected ensureSchema ( Entity[] $arr_entities )
$arr_entities Entity[]

extractAutoIDs() абстрактный защищенный Метод

Extract Auto Insert IDs from the last response
abstract protected extractAutoIDs ( ) : array
Результат array

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

Fetch one entity by Key ID
public fetchById ( $int_key_id ) : mixed
$int_key_id
Результат mixed

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

Consumes Schema (deferred)
public fetchByIds ( array $arr_key_ids ) : array
$arr_key_ids array
Результат array

fetchByKeyPart() абстрактный защищенный Метод

Consumes Schema
abstract protected fetchByKeyPart ( array $arr_key_parts, $str_setter ) : mixed
$arr_key_parts array
$str_setter
Результат mixed

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

Fetch entity data by Key Name
public fetchByName ( $str_key_name ) : mixed
$str_key_name
Результат mixed

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

Consume Schema (deferred)
public fetchByNames ( array $arr_key_names ) : array
$arr_key_names array
Результат array

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

Get the end cursor from the last response
abstract public getEndCursor ( ) : mixed
Результат mixed

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

Fetch some Entities, based on the supplied GQL and, optionally, parameters
abstract public gql ( string $str_gql, null | array $arr_params = null ) : mixed
$str_gql string
$arr_params null | array
Результат mixed

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

Record the Auto-generated Key IDs against the GDS Entities.
protected mapAutoIDs ( array $arr_auto_id_requested )
$arr_auto_id_requested array

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

Put a single Entity into the Datastore
public put ( Entity $obj_entity )
$obj_entity Entity

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

Consumes Schema
public putMulti ( array $arr_entities )
$arr_entities array

upsert() абстрактный защищенный Метод

Put an array of Entities into the Datastore. Return any that need AutoIDs
abstract protected upsert ( array $arr_entities ) : Entity[]
$arr_entities array
Результат Entity[]

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

Set the Schema to be used next (once?)
public withSchema ( Schema $obj_schema )
$obj_schema Schema

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

Set the transaction ID to be used next (once)
public withTransaction ( $str_transaction_id )
$str_transaction_id

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

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

An array of Mappers, keyed on Entity Kind
protected Mapper[],GDS $arr_kind_mappers
Результат Mapper[]

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

The last response - usually a Commit or Query response
protected object|null $obj_last_response
Результат object | null

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

The current Schema
protected Schema,gds|null $obj_schema
Результат Schema | null

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

The dataset ID
protected string|null $str_dataset_id
Результат string | null

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

Optional namespace (for multi-tenant applications)
protected string|null $str_namespace
Результат string | null

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

The transaction ID to use on the next commit
protected null|string $str_next_transaction
Результат null | string