Example #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);
 }
 /**
  * @param mixed $command
  * @return object
  */
 public function buildAggregateRoot($command)
 {
     return $this->first->buildAggregateRoot($command) ?: $this->second->buildAggregateRoot($command);
 }