/**
  * Define a property
  * @param string $name
  * @param Type|string $type
  * @param boolean $indexed
  * @throws DatastoreHelperException
  */
 public function defineProperty($name, $type, $indexed = true)
 {
     if (isset($this->definedProperties[$name])) {
         throw new DatastoreHelperException('Property `' . $name . '` has already been defined.');
     }
     $this->definedProperties[$name] = ['type' => Type::get($type), 'indexed' => $indexed];
 }
Exemplo n.º 2
0
 /**
  * @param mixed $datum
  * @param Type|string $type
  * @return Google_Service_Datastore_Value
  */
 public static function newValue($datum, $type)
 {
     $value = new \Google_Service_Datastore_Value();
     call_user_func([$value, Type::get($type)->getFuncName('set')], $datum);
     return $value;
 }