MUST be for a specific Entity Kind (as defined by the Schema or Kind passed in on construction)
Автор: Tom Walder (twalder@gmail.com)
Пример #1
0
 /**
  * Produces a persistable GDS entity based on an aggregate root and an event.
  *
  * @param \Atrauzzi\PhpEventSourcing\AggregateRoot $aggregateRoot
  * @param object $event
  * @return \Atrauzzi\PhpEventSourcing\GoogleCloudDatastore\Event
  */
 private function createGdsEvent(AggregateRoot $aggregateRoot, $event)
 {
     $gdsEvent = $this->eventStore->createEntity(['created' => new DateTime(), 'type' => $this->getType($event), 'sequence' => $aggregateRoot->getLastSequence() + 1, 'aggregate_type' => $aggregateRoot->getType(), 'aggregate_id' => $aggregateRoot->getId(), 'discriminator_php' => get_class($event)]);
     // Extract all the POPO event's public properties and prefix them with `event_`.
     foreach (get_object_vars($event) as $property => $value) {
         $eventProperty = 'event_' . snake_case($property);
         $gdsEvent->{$eventProperty} = $value;
     }
     return $gdsEvent;
 }
 /**
  * Run the query as a "select" statement against the connection.
  *
  * @return array
  */
 protected function runSelect()
 {
     //Convert query to GQL string.
     $query = $this->toGql();
     //Get the bindings
     $bindings = $this->getBindings();
     //Create the GS Store.
     $store = new Store($this->from, $this->connection->getGoogleGateway());
     $runQuery = $store->fetchAll($query, $bindings);
     dd($runQuery);
 }