Exemplo n.º 1
0
 public static function fromDomainEvent(DomainEvent $domainEvent)
 {
     $dbEvent = new DbEvent();
     $dbEvent->setId($domainEvent->getId());
     $dbEvent->setTitle($domainEvent->getTitle());
     $dbEvent->setDateWithTimeRange(DbDateWithTimeRangeFactory::fromDomainDateWithRimeRange($domainEvent->getScheduledDateWithTimeRange()));
     return $dbEvent;
 }
Exemplo n.º 2
0
 /**
  * @return Event
  */
 public function getUnScheduledEvent()
 {
     $unscheduledEvent = new Event($this->id, $this->title);
     $this->assertFalse($unscheduledEvent->isScheduled());
     $this->assertEquals($this->id, $unscheduledEvent->getId());
     $this->assertEquals($this->title, $unscheduledEvent->getTitle());
     return $unscheduledEvent;
 }
Exemplo n.º 3
0
 /**
  * @param DbEvent $dbEvent
  * @return DomainEvent
  * @throws \CoreDomain\Exception\DomainRuleException
  */
 public static function fromDbEvent(DbEvent $dbEvent)
 {
     $domainEvent = new DomainEvent(new UUId($dbEvent->getId()), new String($dbEvent->getTitle()));
     $dateWithTimeRange = DomainDateWithTimeRangeFactory::fromDateWithTimeRangeEmbeddable($dbEvent->getDateWithTimeRange());
     if ($dateWithTimeRange) {
         $domainEvent->schedule($dateWithTimeRange);
     }
     return $domainEvent;
 }