本文整理汇总了PHP中categoryPeer类的典型用法代码示例。如果您正苦于以下问题:PHP categoryPeer类的具体用法?PHP categoryPeer怎么用?PHP categoryPeer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了categoryPeer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clearMemory
public function clearMemory()
{
accessControlPeer::clearInstancePool();
BatchJobPeer::clearInstancePool();
BulkUploadResultPeer::clearInstancePool();
categoryPeer::clearInstancePool();
EmailIngestionProfilePeer::clearInstancePool();
entryPeer::clearInstancePool();
FileSyncPeer::clearInstancePool();
flavorAssetPeer::clearInstancePool();
flavorParamsConversionProfilePeer::clearInstancePool();
flavorParamsOutputPeer::clearInstancePool();
flavorParamsPeer::clearInstancePool();
kshowPeer::clearInstancePool();
mediaInfoPeer::clearInstancePool();
moderationFlagPeer::clearInstancePool();
moderationPeer::clearInstancePool();
notificationPeer::clearInstancePool();
roughcutEntryPeer::clearInstancePool();
SchedulerConfigPeer::clearInstancePool();
SchedulerPeer::clearInstancePool();
SchedulerStatusPeer::clearInstancePool();
SchedulerWorkerPeer::clearInstancePool();
StorageProfilePeer::clearInstancePool();
syndicationFeedPeer::clearInstancePool();
TrackEntryPeer::clearInstancePool();
uiConfPeer::clearInstancePool();
UploadTokenPeer::clearInstancePool();
// TODO clear default filters
// TODO call all memory cleaner plugins
if (function_exists('gc_collect_cycles')) {
// php 5.3 and above
gc_collect_cycles();
}
}
示例2: getByFullNameWildcardMatch
/**
* Get categories by full name using full name wildcard match (returns an array)
*
* @param $partnerId
* @param $fullName
* @param $con
* @return array
*/
public static function getByFullNameWildcardMatch($fullName, $con = null)
{
$fullName = str_replace(array('\\', '%', '_'), array('\\\\', '\\%', '\\_'), $fullName);
$c = new Criteria();
$c->add(categoryPeer::FULL_NAME, $fullName . "%", Criteria::LIKE);
return categoryPeer::doSelect($c, $con);
}
示例3: retrieveByIdentifier
public function retrieveByIdentifier($value)
{
switch ($this->identifier) {
case CategoryIdentifierField::FULL_NAME:
return categoryPeer::getByFullNameExactMatch($value);
case CategoryIdentifierField::ID:
return categoryPeer::retrieveByPK($value);
case CategoryIdentifierField::REFERENCE_ID:
$objects = categoryPeer::getByReferenceId($value);
return $objects[0];
}
}
示例4: validateParentId
public function validateParentId(KalturaCategory $category)
{
if ($category->parentId === null) {
$category->parentId = 0;
}
if ($category->parentId !== 0) {
$parentCategoryDb = categoryPeer::retrieveByPK($category->parentId);
if (!$parentCategoryDb) {
throw new KalturaAPIException(KalturaErrors::PARENT_CATEGORY_NOT_FOUND, $category->parentId);
}
}
}
示例5: getListResponse
public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
{
if (kEntitlementUtils::getEntitlementEnforcement() && (is_null($this->objectIdIn) && is_null($this->objectIdEqual))) {
throw new KalturaAPIException(MetadataErrors::MUST_FILTER_ON_OBJECT_ID);
}
if (!$this->metadataObjectTypeEqual) {
throw new KalturaAPIException(MetadataErrors::MUST_FILTER_ON_OBJECT_TYPE);
}
if ($this->metadataObjectTypeEqual == MetadataObjectType::CATEGORY) {
if ($this->objectIdEqual) {
$categoryIds = array($this->objectIdEqual);
} else {
if ($this->objectIdIn) {
$categoryIds = explode(',', $this->objectIdIn);
}
}
if ($categoryIds) {
$categories = categoryPeer::retrieveByPKs($categoryIds);
if (!count($categories)) {
KalturaLog::debug("No categories found");
$response = new KalturaMetadataListResponse();
$response->objects = new KalturaMetadataArray();
$response->totalCount = 0;
return $response;
}
$categoryIds = array();
foreach ($categories as $category) {
$categoryIds[] = $category->getId();
}
$this->objectIdEqual = null;
$this->objectIdIn = implode(',', $categoryIds);
}
}
$metadataFilter = $this->toObject();
$c = KalturaCriteria::create(MetadataPeer::OM_CLASS);
$metadataFilter->attachToCriteria($c);
$pager->attachToCriteria($c);
$list = MetadataPeer::doSelect($c);
$response = new KalturaMetadataListResponse();
$response->objects = KalturaMetadataArray::fromDbArray($list, $responseProfile);
if ($c instanceof SphinxMetadataCriteria) {
$response->totalCount = $c->getRecordsCount();
} elseif ($pager->pageIndex == 1 && count($response->objects) < $pager->pageSize) {
$response->totalCount = count($response->objects);
} else {
$pager->detachFromCriteria($c);
$response->totalCount = MetadataPeer::doCount($c);
}
return $response;
}
示例6: categoryNamesToIds
/**
* Convert the categories to categories ids
*
* @param string $cats Categories full names
* @return string Categogories indexes ids
*/
public static function categoryNamesToIds($cats)
{
if ($cats === "") {
$cats = array();
} else {
$cats = explode(",", $cats);
}
kArray::trim($cats);
$catsIds = array();
foreach ($cats as $cat) {
$categories = categoryPeer::getByFullNameWildcardMatch($cat);
foreach ($categories as $category) {
$catsIds[] = $category->getId();
}
}
return implode(",", $catsIds);
}
示例7: getListResponse
public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
{
if ($this->orderBy === null) {
$this->orderBy = KalturaCategoryOrderBy::DEPTH_ASC;
}
$categoryFilter = $this->toObject();
$c = KalturaCriteria::create(categoryPeer::OM_CLASS);
$categoryFilter->attachToCriteria($c);
$pager->attachToCriteria($c);
$dbList = categoryPeer::doSelect($c);
$totalCount = $c->getRecordsCount();
$list = KalturaCategoryArray::fromDbArray($dbList, $responseProfile);
$response = new KalturaCategoryListResponse();
$response->objects = $list;
$response->totalCount = $totalCount;
return $response;
}
示例8: categoryIdsToAllSubCategoriesIdsParsed
/**
* Convert the categories to categories ids - not includes the category itself (only sub categories)
*
* @param string $cats Categories full names
* @param string $statuses comma seperated
* @return string Comma seperated fullIds
*/
public static function categoryIdsToAllSubCategoriesIdsParsed($cats)
{
if ($cats === "") {
$cats = array();
} else {
$cats = explode(",", $cats);
}
kArray::trim($cats);
$categoryFullIdsToIds = array();
foreach ($cats as $cat) {
$category = categoryPeer::retrieveByPK($cat);
//all sub categories and not the category itself
if (!$category) {
continue;
}
$categoryFullIdsToIds[] = $category->getFullIds() . '>';
}
return implode(",", $categoryFullIdsToIds);
}
示例9: copyCategories
public static function copyCategories(Partner $fromPartner, Partner $toPartner)
{
KalturaLog::log("Copying categories from partner [" . $fromPartner->getId() . "] to partner [" . $toPartner->getId() . "]");
categoryPeer::setUseCriteriaFilter(false);
$c = new Criteria();
$c->addAnd(categoryPeer::PARTNER_ID, $fromPartner->getId());
$c->addAnd(categoryPeer::STATUS, CategoryStatus::ACTIVE);
$c->addAscendingOrderByColumn(categoryPeer::DEPTH);
$c->addAscendingOrderByColumn(categoryPeer::CREATED_AT);
$categories = categoryPeer::doSelect($c);
categoryPeer::setUseCriteriaFilter(true);
foreach ($categories as $category) {
/* @var $category category */
$category->setPuserId(null);
$newCategory = $category->copy();
$newCategory->setPartnerId($toPartner->getId());
if ($category->getParentId()) {
$newCategory->setParentId(kObjectCopyHandler::getMappedId('category', $category->getParentId()));
}
$newCategory->save();
$newCategory->setIsIndex(true);
categoryPeer::setUseCriteriaFilter(false);
$newCategory->reSetFullIds();
$newCategory->reSetInheritedParentId();
$newCategory->reSetDepth();
$newCategory->reSetFullName();
categoryPeer::setUseCriteriaFilter(true);
$newCategory->setEntriesCount(0);
$newCategory->setMembersCount(0);
$newCategory->setPendingMembersCount(0);
$newCategory->setDirectSubCategoriesCount(0);
$newCategory->setDirectEntriesCount(0);
$newCategory->save();
KalturaLog::log("Copied [" . $category->getId() . "], new id is [" . $newCategory->getId() . "]");
}
}
示例10: retrieveByPKs
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = KalturaCriteria::create(categoryPeer::OM_CLASS);
$criteria->add(categoryPeer::ID, $pks, Criteria::IN);
$objs = categoryPeer::doSelect($criteria, $con);
}
return $objs;
}
示例11: getListResponse
public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
{
if ($this->entryIdEqual == null && $this->categoryIdIn == null && $this->categoryIdEqual == null && (kEntitlementUtils::getEntitlementEnforcement() || !kCurrentContext::$is_admin_session)) {
throw new KalturaAPIException(KalturaErrors::MUST_FILTER_ON_ENTRY_OR_CATEGORY);
}
if (kEntitlementUtils::getEntitlementEnforcement()) {
//validate entitl for entry
if ($this->entryIdEqual != null) {
$entry = entryPeer::retrieveByPK($this->entryIdEqual);
if (!$entry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $this->entryIdEqual);
}
}
//validate entitl for entryIn
if ($this->entryIdIn != null) {
$entry = entryPeer::retrieveByPKs($this->entryIdIn);
if (!$entry) {
throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $this->entryIdIn);
}
}
//validate entitl categories
if ($this->categoryIdIn != null) {
$categoryIdInArr = explode(',', $this->categoryIdIn);
if (!categoryKuserPeer::areCategoriesAllowed($categoryIdInArr)) {
$categoryIdInArr = array_unique($categoryIdInArr);
}
$entitledCategories = categoryPeer::retrieveByPKs($categoryIdInArr);
if (!count($entitledCategories) || count($entitledCategories) != count($categoryIdInArr)) {
throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $this->categoryIdIn);
}
$categoriesIdsUnlisted = array();
foreach ($entitledCategories as $category) {
if ($category->getDisplayInSearch() == DisplayInSearchType::CATEGORY_MEMBERS_ONLY) {
$categoriesIdsUnlisted[] = $category->getId();
}
}
if (count($categoriesIdsUnlisted)) {
if (!categoryKuserPeer::areCategoriesAllowed($categoriesIdsUnlisted)) {
throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $this->categoryIdIn);
}
}
}
//validate entitl category
if ($this->categoryIdEqual != null) {
$category = categoryPeer::retrieveByPK($this->categoryIdEqual);
if (!$category && kCurrentContext::$master_partner_id != Partner::BATCH_PARTNER_ID) {
throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $this->categoryIdEqual);
}
if ($category->getDisplayInSearch() == DisplayInSearchType::CATEGORY_MEMBERS_ONLY && !categoryKuserPeer::retrievePermittedKuserInCategory($category->getId(), kCurrentContext::getCurrentKsKuserId())) {
throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $this->categoryIdEqual);
}
}
}
$categoryEntryFilter = $this->toObject();
$c = KalturaCriteria::create(categoryEntryPeer::OM_CLASS);
$categoryEntryFilter->attachToCriteria($c);
if (!kEntitlementUtils::getEntitlementEnforcement() || $this->entryIdEqual == null) {
$pager->attachToCriteria($c);
}
$dbCategoriesEntry = categoryEntryPeer::doSelect($c);
if (kEntitlementUtils::getEntitlementEnforcement() && count($dbCategoriesEntry) && $this->entryIdEqual != null) {
//remove unlisted categories: display in search is set to members only
$categoriesIds = array();
foreach ($dbCategoriesEntry as $dbCategoryEntry) {
$categoriesIds[] = $dbCategoryEntry->getCategoryId();
}
$c = KalturaCriteria::create(categoryPeer::OM_CLASS);
$c->add(categoryPeer::ID, $categoriesIds, Criteria::IN);
$pager->attachToCriteria($c);
$c->applyFilters();
$categoryIds = $c->getFetchedIds();
foreach ($dbCategoriesEntry as $key => $dbCategoryEntry) {
if (!in_array($dbCategoryEntry->getCategoryId(), $categoryIds)) {
KalturaLog::info('Category [' . print_r($dbCategoryEntry->getCategoryId(), true) . '] is not listed to user');
unset($dbCategoriesEntry[$key]);
}
}
$totalCount = $c->getRecordsCount();
} else {
$resultCount = count($dbCategoriesEntry);
if ($resultCount && $resultCount < $pager->pageSize) {
$totalCount = ($pager->pageIndex - 1) * $pager->pageSize + $resultCount;
} else {
KalturaFilterPager::detachFromCriteria($c);
$totalCount = categoryEntryPeer::doCount($c);
}
}
$categoryEntrylist = KalturaCategoryEntryArray::fromDbArray($dbCategoriesEntry, $responseProfile);
$response = new KalturaCategoryEntryListResponse();
$response->objects = $categoryEntrylist;
$response->totalCount = $totalCount;
// no pager since category entry is limited to ENTRY::MAX_CATEGORIES_PER_ENTRY
return $response;
}
示例12: syncEntriesCategories
public static function syncEntriesCategories(entry $entry, $isCategoriesModified)
{
self::$skipEntrySave = true;
if ($entry->getNewCategories() != null && $entry->getNewCategories() !== "") {
$newCats = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getNewCategories());
} else {
$newCats = array();
}
if (!$isCategoriesModified) {
if ($entry->getNewCategoriesIds() != null && $entry->getNewCategoriesIds() !== "") {
$newCatsIds = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getNewCategoriesIds());
} else {
$newCatsIds = array();
}
KalturaCriterion::disableTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
$dbCategories = categoryPeer::retrieveByPKs($newCatsIds);
KalturaCriterion::restoreTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
foreach ($dbCategories as $dbCategory) {
//skip categoy with privacy contexts.
if ($dbCategory->getPrivacyContexts() != null && $dbCategory->getPrivacyContexts() != '') {
continue;
}
$newCats[] = $dbCategory->getFullName();
}
}
$newCats = array_unique($newCats);
$allIds = array();
$allCats = array();
$allIdsWithParents = array();
$addedCats = array();
$removedCats = array();
$remainingCats = array();
$oldCats = array();
$oldCatsIds = array();
$dbOldCategoriesEntry = categoryEntryPeer::selectByEntryId($entry->getId());
foreach ($dbOldCategoriesEntry as $dbOldCategoryEntry) {
$oldCatsIds[] = $dbOldCategoryEntry->getCategoryId();
}
$oldCategoris = categoryPeer::retrieveByPKsNoFilter($oldCatsIds);
foreach ($oldCategoris as $category) {
if ($category->getPrivacyContexts() != '' && $category->getPrivacyContexts() != null) {
continue;
}
$oldCats[] = $category->getFullName();
}
foreach ($oldCats as $cat) {
if (array_search($cat, $newCats) === false) {
$removedCats[] = $cat;
}
}
foreach ($newCats as $cat) {
if (array_search($cat, $oldCats) === false) {
$addedCats[] = $cat;
} else {
$remainingCats[] = $cat;
}
}
foreach ($remainingCats as $cat) {
KalturaCriterion::disableTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
$category = categoryPeer::getByFullNameExactMatch($cat);
KalturaCriterion::restoreTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
if ($category) {
if ($category->getPrivacyContext() == '' || $category->getPrivacyContext() == null) {
$allCats[] = $category->getFullName();
$allIds[] = $category->getId();
}
$allIdsWithParents[] = $category->getId();
$allIdsWithParents = array_merge($allIdsWithParents, $category->getAllParentsIds());
}
}
$alreadyAddedCatIds = $allIdsWithParents;
foreach ($addedCats as $cat) {
$category = categoryPeer::getByFullNameExactMatch($cat);
if (!$category) {
KalturaCriterion::disableTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
$unentitedCategory = categoryPeer::getByFullNameExactMatch($cat);
KalturaCriterion::restoreTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
if (!$unentitedCategory) {
$category = category::createByPartnerAndFullName($entry->getPartnerId(), $cat);
//it is possible to add on an entry a few new categories on the same new parent -
//and we need to sync sphinx once we add so the category will not be duplicated
kEventsManager::flushEvents();
}
} else {
$categoryKuser = categoryKuserPeer::retrieveByCategoryIdAndActiveKuserId($category->getId(), kCurrentContext::$ks_kuser_id);
if (kEntitlementUtils::getEntitlementEnforcement() && $category->getContributionPolicy() != ContributionPolicyType::ALL && (!$categoryKuser || $categoryKuser->getPermissionLevel() == CategoryKuserPermissionLevel::MEMBER)) {
//user is not entitled to add entry to this category
$category = null;
}
}
if (!$category) {
continue;
}
//when use caetgoryEntry->add categoryEntry object was alreay created - and no need to create it.
//when using baseEntry->categories = 'my category' will need to add the new category.
$categoryEntry = categoryEntryPeer::retrieveByCategoryIdAndEntryId($category->getId(), $entry->getId());
if (!$categoryEntry) {
$categoryEntry = new categoryEntry();
$categoryEntry->setEntryId($entry->getId());
$categoryEntry->setCategoryId($category->getId());
//.........这里部分代码省略.........
示例13: doCountOnPeer
public static function doCountOnPeer(Criteria $c)
{
return categoryPeer::doCount($c);
}
示例14: dirname
}
$countLimitEachLoop = 200;
//------------------------------------------------------
require_once dirname(__FILE__) . '/../bootstrap.php';
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
KalturaStatement::setDryRun($dryRun);
$lastCategoryId = 0;
while (1) {
$c = new Criteria();
$c->add(categoryPeer::STATUS, CategoryStatus::ACTIVE, Criteria::EQUAL);
$c->add(categoryPeer::ID, $lastCategoryId, Criteria::GREATER_THAN);
$c->add(categoryPeer::PRIVACY_CONTEXTS, null, Criteria::ISNOTNULL);
$c->add(categoryPeer::PRIVACY_CONTEXTS, '', Criteria::NOT_EQUAL);
$c->addAscendingOrderByColumn(categoryPeer::ID);
$c->setLimit($countLimitEachLoop);
$categories = categoryPeer::doSelect($c, $con);
if (!count($categories)) {
break;
}
foreach ($categories as $category) {
/* @var $category category */
KalturaLog::debug('Category [' . $category->getId() . ']');
$lastCategoryEntryId = 0;
while (1) {
$c = new Criteria();
$c->add(categoryEntryPeer::CATEGORY_ID, $category->getId(), Criteria::EQUAL);
$c->add(categoryEntryPeer::STATUS, CategoryEntryStatus::ACTIVE, Criteria::EQUAL);
$c->add(categoryEntryPeer::ID, $lastCategoryEntryId, Criteria::GREATER_THAN);
$c->addAscendingOrderByColumn(categoryEntryPeer::ID);
$c->setLimit($countLimitEachLoop);
$categoryEntries = categoryEntryPeer::doSelect($c, $con);
示例15: validateCategories
/**
* To validate if user is entitled to the category � all needed is to select from the db.
*
* @throws KalturaErrors::ENTRY_CATEGORY_FIELD_IS_DEPRECATED
*/
public function validateCategories()
{
$partnerId = kCurrentContext::$ks_partner_id ? kCurrentContext::$ks_partner_id : kCurrentContext::$partner_id;
if (implode(',', kEntitlementUtils::getKsPrivacyContext()) != kEntitlementUtils::DEFAULT_CONTEXT . $partnerId && ($this->categoriesIds != null || $this->categories != null)) {
throw new KalturaAPIException(KalturaErrors::ENTRY_CATEGORY_FIELD_IS_DEPRECATED);
}
if ($this->categoriesIds != null) {
$catsNames = array();
$cats = explode(",", $this->categoriesIds);
foreach ($cats as $cat) {
$catName = categoryPeer::retrieveByPK($cat);
if (is_null($catName)) {
throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $cat);
}
}
}
if ($this->categories != null) {
$catsNames = array();
$cats = explode(",", $this->categories);
foreach ($cats as $cat) {
$catName = categoryPeer::getByFullNameExactMatch($cat);
if (is_null($catName)) {
KalturaCriterion::disableTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
$catName = categoryPeer::getByFullNameExactMatch($cat);
if ($catName) {
throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_PERMITTED, $cat);
}
KalturaCriterion::restoreTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
}
}
}
}