createEntity() final public méthode

Create a new instance of this GDS Entity class
final public createEntity ( array | null $arr_data = null ) : Entity
$arr_data array | null
Résultat Entity
 /**
  * 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;
 }