/** * @param string|\Atrauzzi\PhpEventSourcing\AggregateRoot $aggregateType * @param int|string $aggregateId * @return \Atrauzzi\PhpEventSourcing\AggregateRoot */ public function find($aggregateType, $aggregateId) { $gdsEvents = $this->eventStore->fetchAll('SELECT * FROM Event WHERE aggregate_type = @aggregateType AND aggregate_id = @aggregateId ORDER BY sequence ASC', [$aggregateType::getType(), $aggregateId]); /** @var \Atrauzzi\PhpEventSourcing\AggregateRoot $aggregateRoot */ $aggregateRoot = new $aggregateType(); $aggregateRoot->absorb($this->hydrateEvents($gdsEvents)); return $aggregateRoot; }
/** * 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); }