function addDataToEventBeforeSave(EventModel $eventModel) { $this->addDataToEventBeforeCheck($eventModel); if ($this->draftEvent->getDetailsValue('event.newvenue')) { $venueModel = new VenueModel(); $venueModel->setSiteId($this->site->getId()); $venueModel->setCountryId($this->draftEvent->getDetailsValue('event.country_id')); $venueModel->setTitle($this->draftEvent->getDetailsValue('venue.title')); $venueModel->setAddress($this->draftEvent->getDetailsValue('venue.address')); $venueModel->setAddressCode($this->draftEvent->getDetailsValue('venue.address_code')); $venueModel->setDescription($this->draftEvent->getDetailsValue('venue.description')); if ($this->draftEvent->getDetailsValue('venue.lat')) { $venueModel->setLat($this->draftEvent->getDetailsValue('venue.lat')); $venueModel->setLng($this->draftEvent->getDetailsValue('venue.lng')); } if ($this->draftEvent->getDetailsValue('area.id')) { $venueModel->setAreaId($this->draftEvent->getDetailsValue('area.id')); } foreach ($this->application['extensions']->getExtensionsIncludingCore() as $extension) { $extension->addDetailsToVenue($venueModel); } $vee = new VenueEditMetaDataModel(); $vee->setUserAccount($this->application['currentUser']); // TODO $vee->setFromRequest(); $venueRepository = new VenueRepository(); $venueRepository->createWithMetaData($venueModel, $this->site, $vee); $eventModel->setVenueId($venueModel->getId()); } }