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 update(Conference $model) { $db = Db::getInstance(\ConferenceScheduler\Configs\DatabaseConfig::DB_INSTANCE); $query = "UPDATE conferences SET Name= :Name, VenueId= :VenueId, Start= :Start, End= :End, OwnerId= :OwnerId WHERE id = :id"; $result = $db->prepare($query); $result->execute([':id' => $model->getId(), ':Name' => $model->getName(), ':VenueId' => $model->getVenueId(), ':Start' => $model->getStart(), ':End' => $model->getEnd(), ':OwnerId' => $model->getOwnerId()]); }