public static function add(Conference $model) { if ($model->getId()) { throw new \Exception('This entity is not new'); } self::$insertObjectPool[] = $model; }
private static function update(Conference $model) { $db = Database::getInstance('app'); $query = "UPDATE conference SET name= :name, date= :date, hall_id= :hall_id, break1= :break1, break2= :break2 WHERE id = :id"; $result = $db->prepare($query); $result->execute([':id' => $model->getId(), ':name' => $model->getName(), ':date' => $model->getDate(), ':hall_id' => $model->getHall_id(), ':break1' => $model->getBreak1(), ':break2' => $model->getBreak2()]); }
private static function insert(Conference $model) { $db = Database::getInstance('app'); $query = "INSERT INTO conferences (ownerid,administratorid,venueid,name,startdatatime,enddatatime)\r\n VALUES (':ownerid', ':administratorid', ':venueid', ':name', ':startdatatime', ':enddatatime')"; $result = $db->prepare($query); $result->execute([':ownerid' => $model->getOwnerId(), ':administratorid' => $model->getAdministratorId(), ':id' => $model->getId(), ':venueid' => $model->getVenueId(), ':name' => $model->getName(), ':startdatatime' => $model->getStartDateTime(), ':enddatatime' => $model->getEndDateTime()]); $model->setId((int) $db->lastId()); }