public function viewAction() { $id = (int) $this->getParam('id'); $podcast = Podcast::find($id); if (!$podcast instanceof Podcast) { throw new \DF\Exception\DisplayOnly('Podcast not found!'); } $this->view->podcast = $podcast; $this->view->social_types = Podcast::getSocialTypes(); // Stringify list of stations that play this podcast. $airs_on = ''; if (count($podcast->stations) > 0) { $airs_on_array = array(); foreach ($podcast->stations as $station) { $airs_on_array[] = '<a href="' . $station->web_url . '" target="_blank">' . $station->name . '</a>'; } $airs_on = 'Airs on ' . \DF\Utilities::joinCompound($airs_on_array); } $this->view->podcast_airs_on = $airs_on; // Paginate episodes. $query = $this->em->createQuery('SELECT pe FROM Entity\\PodcastEpisode pe WHERE pe.podcast_id = :podcast AND pe.is_active = 1 ORDER BY pe.timestamp DESC')->setParameter('podcast', $id); $this->view->pager = new \DF\Paginator\Doctrine($query, $this->getParam('page', 1), 25); }