/** * List metadata objects by filter and pager * * @action list * @param KalturaMetadataFilter $filter * @param KalturaFilterPager $pager * @return KalturaMetadataListResponse */ function listAction(KalturaMetadataFilter $filter = null, KalturaFilterPager $pager = null) { if (!$filter) { $filter = new KalturaMetadataFilter(); } $metadataFilter = new MetadataFilter(); $filter->toObject($metadataFilter); $c = new Criteria(); $metadataFilter->attachToCriteria($c); $count = MetadataPeer::doCount($c); if ($pager) { $pager->attachToCriteria($c); } $list = MetadataPeer::doSelect($c); $response = new KalturaMetadataListResponse(); $response->objects = KalturaMetadataArray::fromDbArray($list); $response->totalCount = $count; return $response; }
/** * List metadata objects by filter and pager * * @action list * @param KalturaMetadataFilter $filter * @param KalturaFilterPager $pager * @return KalturaMetadataListResponse */ function listAction(KalturaMetadataFilter $filter = null, KalturaFilterPager $pager = null) { if (!$filter) { $filter = new KalturaMetadataFilter(); } if (kEntitlementUtils::getEntitlementEnforcement() && (is_null($filter->objectIdIn) && is_null($filter->objectIdEqual))) { throw new KalturaAPIException(MetadataErrors::MUST_FILTER_ON_OBJECT_ID); } $entryIds = null; if ($filter->metadataObjectTypeEqual == MetadataObjectType::ENTRY) { if ($filter->objectIdEqual) { $entryIds = array($filter->objectIdEqual); } else { if ($filter->objectIdIn) { $entryIds = explode(',', $filter->objectIdIn); } } } if (is_null($entryIds)) { myPartnerUtils::addPartnerToCriteria(new MetadataPeer(), $this->getPartnerId(), $this->private_partner_data, $this->partnerGroup()); } else { $entryIds = entryPeer::filterEntriesByPartnerOrKalturaNetwork($entryIds, $this->getPartnerId()); $filter->objectIdEqual = null; $filter->objectIdIn = implode(',', $entryIds); } $metadataFilter = new MetadataFilter(); $filter->toObject($metadataFilter); $c = new Criteria(); $metadataFilter->attachToCriteria($c); if ($entryIds === array()) { $c->addAnd(MetadataPeer::OBJECT_ID, array(), Criteria::IN); } $count = MetadataPeer::doCount($c); if (!$pager) { $pager = new KalturaFilterPager(); } $pager->attachToCriteria($c); $list = MetadataPeer::doSelect($c); $response = new KalturaMetadataListResponse(); $response->objects = KalturaMetadataArray::fromDbArray($list); $response->totalCount = $count; return $response; }