Fix for PodcastController index action when station podcast does not exist

This commit is contained in:
drigato 2015-11-03 11:45:01 -05:00
parent 335c2fea11
commit 569ea00787

View file

@ -27,12 +27,20 @@ class Rest_PodcastController extends Zend_Rest_Controller
$sortColumn = $this->_getParam('sort', PodcastPeer::ID);
$sortDir = $this->_getParam('sort_dir', Criteria::ASC);
// Don't return the Station podcast - we fetch it separately
$query = PodcastQuery::create()
->filterByDbId(Application_Model_Preference::getStationPodcastId(), Criteria::NOT_EQUAL)
->setLimit($limit)
->setOffset($offset)
->orderBy($sortColumn, $sortDir);
$stationPodcastId = Application_Model_Preference::getStationPodcastId();
if (!empty($stationPodcastId)) {
$query = PodcastQuery::create()
// Don't return the Station podcast - we fetch it separately
->filterByDbId($stationPodcastId, Criteria::NOT_EQUAL)
->setLimit($limit)
->setOffset($offset)
->orderBy($sortColumn, $sortDir);
} else {
$query = PodcastQuery::create()
->setLimit($limit)
->setOffset($offset)
->orderBy($sortColumn, $sortDir);
}
$queryResult = $query->find();