/** * List media info objects by filter and pager * * @action list * @param KalturaMediaInfoFilter $filter * @param KalturaFilterPager $pager * @return KalturaMediaInfoListResponse */ function listAction(KalturaMediaInfoFilter $filter = null, KalturaFilterPager $pager = null) { myDbHelper::$use_alternative_con = myDbHelper::DB_HELPER_CONN_PROPEL2; if (!$filter) { $filter = new KalturaMediaInfoFilter(); } if (!$pager) { $pager = new KalturaFilterPager(); } $mediaInfoFilter = new MediaInfoFilter(); $filter->toObject($mediaInfoFilter); if ($filter->flavorAssetIdEqual) { // Since media_info table does not have partner_id column, enforce partner by getting the asset if (!assetPeer::retrieveById($filter->flavorAssetIdEqual)) { throw new KalturaAPIException(KalturaErrors::FLAVOR_ASSET_ID_NOT_FOUND, $filter->flavorAssetIdEqual); } } $c = new Criteria(); $mediaInfoFilter->attachToCriteria($c); $totalCount = mediaInfoPeer::doCount($c); $pager->attachToCriteria($c); $dbList = mediaInfoPeer::doSelect($c); $list = KalturaMediaInfoArray::fromDbArray($dbList, $this->getResponseProfile()); $response = new KalturaMediaInfoListResponse(); $response->objects = $list; $response->totalCount = $totalCount; return $response; }
/** * List media info objects by filter and pager * * @action list * @param KalturaMediaInfoFilter $filter * @param KalturaFilterPager $pager * @return KalturaMediaInfoListResponse */ function listAction(KalturaMediaInfoFilter $filter = null, KalturaFilterPager $pager = null) { if (!$filter) { $filter = new KalturaMediaInfoFilter(); } if (!$pager) { $pager = new KalturaFilterPager(); } $mediaInfoFilter = new MediaInfoFilter(); $filter->toObject($mediaInfoFilter); $c = new Criteria(); $mediaInfoFilter->attachToCriteria($c); $totalCount = mediaInfoPeer::doCount($c); $pager->attachToCriteria($c); $dbList = mediaInfoPeer::doSelect($c); $list = KalturaMediaInfoArray::fromDbArray($dbList); $response = new KalturaMediaInfoListResponse(); $response->objects = $list; $response->totalCount = $totalCount; return $response; }
/** * Returns the number of related mediaInfo objects. * * @param Criteria $criteria * @param boolean $distinct * @param PropelPDO $con * @return int Count of related mediaInfo objects. * @throws PropelException */ public function countmediaInfos(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(assetPeer::DATABASE_NAME); } else { $criteria = clone $criteria; } if ($distinct) { $criteria->setDistinct(); } $count = null; if ($this->collmediaInfos === null) { if ($this->isNew()) { $count = 0; } else { $criteria->add(mediaInfoPeer::FLAVOR_ASSET_ID, $this->id); $count = mediaInfoPeer::doCount($criteria, false, $con); } } else { // criteria has no effect for a new object if (!$this->isNew()) { // the following code is to determine if a new query is // called for. If the criteria is the same as the last // one, just return count of the collection. $criteria->add(mediaInfoPeer::FLAVOR_ASSET_ID, $this->id); if (!isset($this->lastmediaInfoCriteria) || !$this->lastmediaInfoCriteria->equals($criteria)) { $count = mediaInfoPeer::doCount($criteria, false, $con); } else { $count = count($this->collmediaInfos); } } else { $count = count($this->collmediaInfos); } } return $count; }