function __construct(Lecture $lecture) { $this->id = $lecture->getId(); $this->title = $lecture->getTitle(); $this->description = $lecture->getDescription(); $this->startDate = $lecture->getStartDate(); $this->endDate = $lecture->getEndDate(); $this->conferenceId = $lecture->getConferenceId(); $this->hallId = $lecture->getHall_Id(); $this->speakerId = $lecture->getSpeaker_Id(); }
private static function insert(Lecture $model) { $db = DatabaseData::getInstance(\RedDevil\Config\DatabaseConfig::DB_INSTANCE); $query = "INSERT INTO lectures (Title,Description,StartDate,EndDate,ConferenceId,Hall_Id,Speaker_Id) VALUES (:Title, :Description, :StartDate, :EndDate, :ConferenceId, :Hall_Id, :Speaker_Id);"; $result = $db->prepare($query); $result->execute([':Title' => $model->getTitle(), ':Description' => $model->getDescription(), ':StartDate' => $model->getStartDate(), ':EndDate' => $model->getEndDate(), ':ConferenceId' => $model->getConferenceId(), ':Hall_Id' => $model->getHall_Id(), ':Speaker_Id' => $model->getSpeaker_Id()]); $model->setId($db->lastInsertId()); }