/** * Look up this stub in the DB, get an API endpoint, fetch data * and return us an event * * @param string $stub The short url bit of the event (e.g. phpbnl14) * @return EventEntity The event we found, or false if something went wrong */ public function getByStub($stub) { $item = $this->eventDb->load('stub', $stub); if (!$item) { return false; } return $this->getEvent($item['uri']); }
public function quick($talkStub) { $cache = $this->getCache(); $talkDb = new TalkDb($cache); $talk = $talkDb->load('stub', $talkStub); $eventDb = new EventDb($cache); $event = $eventDb->load('uri', $talk['event_uri']); if (!$event) { return \Slim\Slim::getInstance()->notFound(); } $this->application->redirect($this->application->urlFor('talk', array('eventSlug' => $event['url_friendly_name'], 'talkSlug' => $talk['slug']))); }
public function quickById($talkId) { $cache = $this->getCache(); $eventDb = new EventDb($cache); $talkApi = $this->getTalkApi(); $talk = $talkApi->getTalkByTalkId($talkId); if (!$talk) { return \Slim\Slim::getInstance()->notFound(); } $event = $eventDb->load('uri', $talk->getEventUri()); if (!$event) { return \Slim\Slim::getInstance()->notFound(); } $this->application->redirect($this->application->urlFor('talk', array('eventSlug' => $event['url_friendly_name'], 'talkSlug' => $talk->getUrlFriendlyTalkTitle()))); }