public function createConference(CreateConference $conference) { $this->headerData(); $this->view->showView(); $venueName = $conference->getName(); $venueAddress = $conference->getAddress(); $confName = $conference->getConfName(); $startDate = $conference->getStartDate(); $endDate = $conference->getEndDate(); $userId = $_SESSION['id']; /** * this part added venue's data */ $venue = new VenueModel($venueName, $venueAddress); $venue->save(); $venueId = \Repository\Venue::createInstance()->selectId(); $conference = new ConferenceModel($confName, $startDate, $endDate, $venueId, $userId); $conference->save(); $conf = Conference::createInstance()->selectAllConferencesDetails(); $confId = array_pop($conf); $confId = $confId->getId(); // $confId = array_pop($conf['id']); if ($conference->getConfName() != null) { // var_dump($venueId); $_SESSION['venue_id'] = $venueId; $_SESSION['conferenceId'] = $confId; $user = \Repository\User::createInstance()->editUserId($userId); $this->redirectControllers('hall', 'createHall'); } $this->view->part('footer'); exit; }
public function save(\Models\ConferenceModel $conf) { $query = 'INSERT INTO conferences (confName, startDate, endDate, venue_id, user_id) VALUES (?, ?, ?, ?, ?)'; $param = [$conf->getConfName(), $conf->getStartDate(), $conf->getEndDate(), $conf->getVenueId(), $conf->getUserId()]; $this->db->query($query, $param); return $this->db->row(); }
public function createConference(CreateConference $conference) { $this->headerData(); $this->view->showView(); if ($this->getSession()->getSessionParams('user') == null) { $this->redirectControllers('user', 'index'); } /** * get object property value * $this->getRequest()->getPost()->getPostParams()->name; */ $venueName = $conference->getName(); $venueAddress = $conference->getAddress(); $confName = $conference->getConfName(); $startDate = $conference->getStartDate(); $endDate = $conference->getEndDate(); $userId = $this->getSession()->getSessionParams('id'); /** * this part added venue's data */ $venue = new VenueModel($venueName, $venueAddress); $venue->save(); $venueId = \Repository\Venue::createInstance()->selectId(); $conference = new ConferenceModel($confName, $startDate, $endDate, $venueId, $userId); $conference->save(); $conf = Conference::createInstance()->selectAllConferencesDetails(); $confId = array_pop($conf); $confId = $confId->getId(); if ($conference->getConfName() != null) { $this->getSession()->setSessionParams(['venue_id' => $venueId, 'conferenceId' => $confId]); // $user = \Repository\User::createInstance() // ->editUserId($userId); $this->redirectControllers('hall', 'createHall'); } $this->view->part('footer'); exit; }