PHP 클래스 Google\Cloud\Datastore\Entity

Entity implements PHP's ArrayAccess, allowing access via the array syntax (example below). Properties are mapped automatically to their corresponding Datastore value types. Refer to the table below for a guide to how types are stored. | **PHP Type** | **Datastore Value Type** | |--------------------------------------------|--------------------------------------| | \DateTimeInterface | timestampValue | | {@see \Google\Cloud\Datastore\Key} | keyValue | | {@see \Google\Cloud\Datastore\GeoPoint} | geoPointValue | | {@see \Google\Cloud\Datastore\Entity} | entityValue | | {@see \Google\Cloud\Datastore\Blob} | blobValue | | {@see \Google\Cloud\Int64} | integerValue | | Associative Array | entityValue (No Key) | | Non-Associative Array | arrayValue | | float | doubleValue | | int | integerValue | | string | stringValue | | resource | blobValue | | NULL | nullValue | | bool | booleanValue | | object (Outside types specified above) | **ERROR** InvalidArgumentException | Example: use Google\Cloud\ServiceBuilder; $cloud = new ServiceBuilder(); $datastore = $cloud->datastore(); $key = $datastore->key('Person', 'Bob'); $entity = $datastore->entity($key, [ 'firstName' => 'Bob', 'lastName' => 'Testguy' ]); echo $entity['firstName']; // 'Bob' $entity['location'] = 'Detroit, MI';
상속: implements ArrayAcces\ArrayAccess, use trait DatastoreTrait
파일 보기 프로젝트 열기: GoogleCloudPlatform/gcloud-php 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( Key $key, array $entity = [], array $options = [] )
__get ( string $property ) : mixed
__isset ( string $property ) : boolean
__set ( string $property, mixed $value ) : void
__unset ( string $property ) : void
baseVersion ( ) : string | null Fetch the baseVersion
cursor ( ) : string | null Fetch the cursor
excludedProperties ( ) : array Return a list of properties excluded from datastore indexes
get ( ) : array Get the entity data
key ( ) : Key Get the Entity Key
meanings ( ) : array return a list of meaning values
offsetExists ( string $key ) : boolean
offsetGet ( string $key ) : mixed
offsetSet ( string $key, $val ) : void
offsetUnset ( string $key ) : void
populatedByService ( ) : boolean Indicate whether the entity was created as the result of an API call.
set ( array $entity ) : void Set the entity data
setExcludeFromIndexes ( array $properties ) : void A list of entity properties to exclude from datastore indexes.

메소드 상세

__construct() 공개 메소드

public __construct ( Key $key, array $entity = [], array $options = [] )
$key Key The Entity's Key, defining its unique identifier.
$entity array [optional] The entity body.
$options array [optional] { Configuration Options @type string $cursor Set only when the entity is obtained by a query result. If set, the entity cursor can be retrieved from {@see \Google\Cloud\Datastore\Entity::cursor()}. @type string $baseVersion Set only when the entity is obtained by a query result. If set, the entity cursor can be retrieved from {@see \Google\Cloud\Datastore\Entity::baseVersion()}. @type array $excludeFromIndexes A list of entity keys to exclude from datastore indexes. @type array $meanings A list of meaning values for entity properties. @type bool $populatedByService Indicates whether the entity was created as the result of a service request. }

__get() 공개 메소드

public __get ( string $property ) : mixed
$property string
리턴 mixed

__isset() 공개 메소드

public __isset ( string $property ) : boolean
$property string
리턴 boolean

__set() 공개 메소드

public __set ( string $property, mixed $value ) : void
$property string
$value mixed
리턴 void

__unset() 공개 메소드

public __unset ( string $property ) : void
$property string
리턴 void

baseVersion() 공개 메소드

This is only set when the entity was obtained from a query result. It is used for concurrency control internally. Example: $baseVersion = $entity->baseVersion();
public baseVersion ( ) : string | null
리턴 string | null

cursor() 공개 메소드

This is only set when the entity was obtained from a query result. It can be used to manually paginate results. Example: $cursor = $entity->cursor();
public cursor ( ) : string | null
리턴 string | null

excludedProperties() 공개 메소드

Example: $excludedFromIndexes = $entity->excludedProperties();
public excludedProperties ( ) : array
리턴 array

get() 공개 메소드

Example: $data = $entity->get();
public get ( ) : array
리턴 array

key() 공개 메소드

Example: $key = $entity->key();
public key ( ) : Key
리턴 Key

meanings() 공개 메소드

Example: $meanings = $entity->meanings();
public meanings ( ) : array
리턴 array

offsetExists() 공개 메소드

public offsetExists ( string $key ) : boolean
$key string the value to check.
리턴 boolean

offsetGet() 공개 메소드

public offsetGet ( string $key ) : mixed
$key string the value to retrieve.
리턴 mixed

offsetSet() 공개 메소드

public offsetSet ( string $key, $val ) : void
$key string The value name.
리턴 void

offsetUnset() 공개 메소드

public offsetUnset ( string $key ) : void
$key string the value to remove.
리턴 void

populatedByService() 공개 메소드

Example: $populatedByService = $entity->populatedByService();
public populatedByService ( ) : boolean
리턴 boolean

set() 공개 메소드

Calling this method replaces the entire entity body. To add or modify a single value on the entity, use the array syntax for assignment. Example: $entity->set([ 'firstName' => 'Dave' ]);
public set ( array $entity ) : void
$entity array The new entity body.
리턴 void

setExcludeFromIndexes() 공개 메소드

Example: $entity['birthDate'] = new DateTime('December 31, 1969'); $entity->setExcludeFromIndexes([ 'birthDate' ]);
public setExcludeFromIndexes ( array $properties ) : void
$properties array A list of properties to exclude from indexes.
리턴 void