コード例 #1
0
 function __construct(Conference $conference)
 {
     $this->id = $conference->getId();
     $this->title = $conference->getName();
     $this->startDate = $conference->getStart();
     $this->endDate = $conference->getEnd();
     $this->venueId = $conference->getVenueId();
 }
コード例 #2
0
 public function __construct(Conference $conference = null)
 {
     if (!$conference) {
         $context = HttpContext::getInstance();
         $this->setStartDate($context->post('startDate'));
         $this->setEndDate($context->post('endDate'));
         $this->setTitle($context->post('title'));
         $this->setVenueId($context->post('venueId', 'int'));
     } else {
         $this->venueId = intval($conference->getVenueId());
         $this->endDate = $conference->getEnd();
         $this->startDate = $conference->getStart();
         $this->title = $conference->getName();
         $this->id = $conference->getId();
     }
 }
コード例 #3
0
 private static function insert(Conference $model)
 {
     $db = Db::getInstance(\ConferenceScheduler\Configs\DatabaseConfig::DB_INSTANCE);
     $query = "INSERT INTO conferences (Name,VenueId,Start,End,OwnerId) VALUES (:Name, :VenueId, :Start, :End, :OwnerId);";
     $result = $db->prepare($query);
     $result->execute([':Name' => $model->getName(), ':VenueId' => $model->getVenueId(), ':Start' => $model->getStart(), ':End' => $model->getEnd(), ':OwnerId' => $model->getOwnerId()]);
     $model->setId($db->lastInsertId());
 }