PHP Class 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
Author: Tom Walder ([email protected])
Afficher le fichier Open project: tomwalder/php-gds

Protected Properties

Свойство Type Description
$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

Méthodes publiques

Méthode Description
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)

Méthodes protégées

Méthode Description
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

Method Details

beginTransaction() abstract public méthode

Start a transaction
abstract public beginTransaction ( boolean $bol_cross_group = FALSE ) : mixed
$bol_cross_group boolean
Résultat mixed

configureObjectValueParamForQuery() abstract protected méthode

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() protected méthode

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

createMapper() abstract protected méthode

Create a mapper that's right for this Gateway
abstract protected createMapper ( ) : Mapper
Résultat Mapper

delete() public méthode

Delete an Entity
public delete ( Entity $obj_key ) : boolean
$obj_key Entity
Résultat boolean

deleteMulti() abstract public méthode

Delete 1-many entities
abstract public deleteMulti ( array $arr_entities ) : mixed
$arr_entities array
Résultat mixed

determineMapper() protected méthode

Determine Mapper (early stage [draft] support for cross-entity upserts)
protected determineMapper ( Entity $obj_gds_entity ) : Mapper
$obj_gds_entity Entity
Résultat Mapper

ensureSchema() protected méthode

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

extractAutoIDs() abstract protected méthode

Extract Auto Insert IDs from the last response
abstract protected extractAutoIDs ( ) : array
Résultat array

fetchById() public méthode

Fetch one entity by Key ID
public fetchById ( $int_key_id ) : mixed
$int_key_id
Résultat mixed

fetchByIds() public méthode

Consumes Schema (deferred)
public fetchByIds ( array $arr_key_ids ) : array
$arr_key_ids array
Résultat array

fetchByKeyPart() abstract protected méthode

Consumes Schema
abstract protected fetchByKeyPart ( array $arr_key_parts, $str_setter ) : mixed
$arr_key_parts array
$str_setter
Résultat mixed

fetchByName() public méthode

Fetch entity data by Key Name
public fetchByName ( $str_key_name ) : mixed
$str_key_name
Résultat mixed

fetchByNames() public méthode

Consume Schema (deferred)
public fetchByNames ( array $arr_key_names ) : array
$arr_key_names array
Résultat array

getEndCursor() abstract public méthode

Get the end cursor from the last response
abstract public getEndCursor ( ) : mixed
Résultat mixed

gql() abstract public méthode

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
Résultat mixed

mapAutoIDs() protected méthode

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

put() public méthode

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

putMulti() public méthode

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

upsert() abstract protected méthode

Put an array of Entities into the Datastore. Return any that need AutoIDs
abstract protected upsert ( array $arr_entities ) : Entity[]
$arr_entities array
Résultat Entity[]

withSchema() public méthode

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

withTransaction() public méthode

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

Property Details

$arr_kind_mappers protected_oe property

An array of Mappers, keyed on Entity Kind
protected Mapper[],GDS $arr_kind_mappers
Résultat Mapper[]

$obj_last_response protected_oe property

The last response - usually a Commit or Query response
protected object|null $obj_last_response
Résultat object | null

$obj_schema protected_oe property

The current Schema
protected Schema,gds|null $obj_schema
Résultat Schema | null

$str_dataset_id protected_oe property

The dataset ID
protected string|null $str_dataset_id
Résultat string | null

$str_namespace protected_oe property

Optional namespace (for multi-tenant applications)
protected string|null $str_namespace
Résultat string | null

$str_next_transaction protected_oe property

The transaction ID to use on the next commit
protected null|string $str_next_transaction
Résultat null | string