function __construct(Conference $conference)
 {
     $this->id = $conference->getId();
     $this->title = $conference->getName();
     $this->startDate = $conference->getStart();
     $this->endDate = $conference->getEnd();
     $this->venueId = $conference->getVenueId();
 }
 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();
     }
 }
 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());
 }