key() public method

Example: $key = $entity->key();
public key ( ) : Key
return Key
Exemplo n.º 1
0
 public function testKey()
 {
     $entity = new Entity($this->key, []);
     $this->assertEquals($this->key, $entity->key());
 }
 /**
  * Translate an Entity to a datastore representation.
  *
  * @param Entity $entity The input entity.
  * @return array A Datastore [Entity](https://cloud.google.com/datastore/reference/rest/v1/Entity)
  */
 public function objectToRequest(Entity $entity)
 {
     $data = $entity->get();
     $properties = [];
     foreach ($data as $key => $value) {
         $exclude = in_array($key, $entity->excludedProperties());
         $meaning = isset($entity->meanings()[$key]) ? $entity->meanings()[$key] : null;
         $properties[$key] = $this->valueObject($value, $exclude, $meaning);
     }
     return array_filter(['key' => $entity->key(), 'properties' => $properties]);
 }