Ejemplo n.º 1
0
 private function handleCommand($aggregate, $command)
 {
     $method = $this->aggregates->handleMethod($command);
     if (!method_exists($aggregate, $method)) {
         throw new \Exception("Missing method " . get_class($aggregate) . "::{$method}()");
     }
     return $aggregate->{$method}($command);
 }
Ejemplo n.º 2
0
 /**
  * @param mixed $command
  * @return object
  */
 public function buildAggregateRoot($command)
 {
     return $this->first->buildAggregateRoot($command) ?: $this->second->buildAggregateRoot($command);
 }