Exemplo n.º 1
0
 /**
  * @param Aggregate $aggregate
  */
 public function add(Aggregate $aggregate)
 {
     foreach ($aggregate->getEvents() as $event) {
         $storedEvent = new StoredEvent($aggregate->getAggregateId(), get_class($event), $event);
         $this->repo->save($storedEvent);
     }
 }
Exemplo n.º 2
0
 /**
  * @param Aggregate $aggregate
  */
 public function add(Aggregate $aggregate)
 {
     foreach ($aggregate->getEvents() as $event) {
         $storedEvent = new StoredEvent($aggregate->getAggregateId(), get_class($event), $event);
         $this->manager->persist($storedEvent);
     }
     $this->manager->flush();
 }