/**
  * Create a Datastore Entity from a GDS Entity
  *
  * @param Entity $obj_gds_entity
  * @return \Google_Service_Datastore_Entity
  */
 public function mapToGoogle(Entity $obj_gds_entity)
 {
     $obj_entity = new \Google_Service_Datastore_Entity();
     $obj_entity->setKey($this->createKey($obj_gds_entity));
     $obj_entity->setProperties($this->createProperties($obj_gds_entity));
     return $obj_entity;
 }
function create_entity()
{
    $entity = new Google_Service_Datastore_Entity();
    $entity->setKey(createKeyForTestItem());
    $string_prop = new Google_Service_Datastore_Property();
    $string_prop->setStringValue("test field string value");
    $property_map = [];
    $property_map["testfield"] = $string_prop;
    $entity->setProperties($property_map);
    return $entity;
}
예제 #3
0
 /**
  * Creates the basic entity for PubSubMessage, with properties "created"
  * and "message"
  */
 public function createEntity(\Google_Service_Datastore_Key $key, $message)
 {
     $entity = new \Google_Service_Datastore_Entity();
     $entity->setKey($key);
     $messageProp = new \Google_Service_Datastore_Property();
     $messageProp->setStringValue($message);
     $createdProp = new \Google_Service_Datastore_Property();
     $createdProp->setDateTimeValue(date('c'));
     $properties = ['message' => $messageProp, 'created' => $createdProp];
     $entity->setProperties($properties);
     return $entity;
 }
 /**
  * Creates the basic entity for DatastoreComment, with properties "created"
  * "name", and "body"
  */
 public function createEntity(\Google_Service_Datastore_Key $key, $name, $body)
 {
     $entity = new \Google_Service_Datastore_Entity();
     $entity->setKey($key);
     $nameProp = new \Google_Service_Datastore_Property();
     $nameProp->setStringValue($name);
     $bodyProp = new \Google_Service_Datastore_Property();
     $bodyProp->setStringValue($body);
     $createdProp = new \Google_Service_Datastore_Property();
     $createdProp->setDateTimeValue(date('c'));
     $properties = ['name' => $nameProp, 'body' => $bodyProp, 'created' => $createdProp];
     $entity->setProperties($properties);
     return $entity;
 }
예제 #5
0
function create_entity($hashkey, $text)
{
    $entity = new Google_Service_Datastore_Entity();
    $entity->setKey(createKeyForTestItem());
    $string_prop_hash = new Google_Service_Datastore_Property();
    $string_prop_hash->setStringValue($hashkey);
    $string_prop_text = new Google_Service_Datastore_Property();
    $string_prop_text->setStringValue($text);
    $property_map = [];
    $property_map["hash"] = $string_prop_hash;
    $property_map["text"] = $string_prop_text;
    $entity->setProperties($property_map);
    return $entity;
}
 protected function create_entity()
 {
     $entity = new Google_Service_Datastore_Entity();
     $entity->setKey(self::createKeyForItem($this));
     $entity->setProperties($this->getKindProperties());
     return $entity;
 }
 /**
  * @return \Google_Service_Datastore_Entity
  * @throws DatastoreHelperException
  */
 public function exportEntity()
 {
     if (empty($this->definedProperties)) {
         throw new DatastoreHelperException('No properties were defined in ' . self::class);
     }
     $entity = new \Google_Service_Datastore_Entity();
     if ($this->getKey() === null) {
         $entity->setKey($this->getKey());
     } else {
         $entity->setKey($this->getKey());
     }
     $properties = [];
     foreach ($this->definedProperties as $name => $spec) {
         $properties[$name] = \DatastoreHelper::newProperty($this->{$name}, $spec['type'], $spec['indexed']);
     }
     $entity->setProperties($properties);
     return $entity;
 }
예제 #8
0
 protected function createEntity()
 {
     $entity = new \Google_Service_Datastore_Entity();
     $entity->setKey($this->createKey($this));
     $entity->setProperties($this->getKindProperties());
     return $entity;
 }