Fix for PodcastController index action when station podcast does not exist
This commit is contained in:
parent
335c2fea11
commit
569ea00787
1 changed files with 14 additions and 6 deletions
|
@ -27,12 +27,20 @@ class Rest_PodcastController extends Zend_Rest_Controller
|
||||||
$sortColumn = $this->_getParam('sort', PodcastPeer::ID);
|
$sortColumn = $this->_getParam('sort', PodcastPeer::ID);
|
||||||
$sortDir = $this->_getParam('sort_dir', Criteria::ASC);
|
$sortDir = $this->_getParam('sort_dir', Criteria::ASC);
|
||||||
|
|
||||||
// Don't return the Station podcast - we fetch it separately
|
$stationPodcastId = Application_Model_Preference::getStationPodcastId();
|
||||||
|
if (!empty($stationPodcastId)) {
|
||||||
$query = PodcastQuery::create()
|
$query = PodcastQuery::create()
|
||||||
->filterByDbId(Application_Model_Preference::getStationPodcastId(), Criteria::NOT_EQUAL)
|
// Don't return the Station podcast - we fetch it separately
|
||||||
|
->filterByDbId($stationPodcastId, Criteria::NOT_EQUAL)
|
||||||
->setLimit($limit)
|
->setLimit($limit)
|
||||||
->setOffset($offset)
|
->setOffset($offset)
|
||||||
->orderBy($sortColumn, $sortDir);
|
->orderBy($sortColumn, $sortDir);
|
||||||
|
} else {
|
||||||
|
$query = PodcastQuery::create()
|
||||||
|
->setLimit($limit)
|
||||||
|
->setOffset($offset)
|
||||||
|
->orderBy($sortColumn, $sortDir);
|
||||||
|
}
|
||||||
|
|
||||||
$queryResult = $query->find();
|
$queryResult = $query->find();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue