コード例 #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;
 }
コード例 #2
0
ファイル: EventTest.php プロジェクト: row-b/venue-organizer
 /**
  * @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;
 }
コード例 #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;
 }