Merge pull request #813 from Robbt/fix-podcast-paging

Fix podcast paging
This commit is contained in:
Kyle Robbertze 2019-05-04 11:41:04 +02:00 committed by GitHub
commit e80b7390fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,6 +37,7 @@ class Rest_PodcastController extends Zend_Rest_Controller
$result = PodcastQuery::create()
// Don't return the Station podcast - we fetch it separately
->filterByDbId($stationPodcastId, Criteria::NOT_EQUAL);
$total = $result->count();
if ($limit > 0) { $result->setLimit($limit); }
$result->setOffset($offset)
->orderBy($sortColumn, $sortDir);
@ -44,9 +45,10 @@ class Rest_PodcastController extends Zend_Rest_Controller
$podcastArray = $result->toArray(null, false, BasePeer::TYPE_FIELDNAME);
$this->getResponse()
->setHttpResponseCode(200)
->setHeader('X-TOTAL-COUNT', $result->count())
->setHeader('X-TOTAL-COUNT', $total)
->appendBody(json_encode($podcastArray));
}