当前位置: 首页>>代码示例>>PHP>>正文


PHP categoryPeer::retrieveByPK方法代码示例

本文整理汇总了PHP中categoryPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP categoryPeer::retrieveByPK方法的具体用法?PHP categoryPeer::retrieveByPK怎么用?PHP categoryPeer::retrieveByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在categoryPeer的用法示例。


在下文中一共展示了categoryPeer::retrieveByPK方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save(PropelPDO $con = null)
 {
     if ($this->isNew()) {
         $numOfCatsForPartner = categoryPeer::doCount(new Criteria());
         if ($numOfCatsForPartner >= Partner::MAX_NUMBER_OF_CATEGORIES) {
             throw new kCoreException("Max number of categories was reached", kCoreException::MAX_NUMBER_OF_CATEGORIES_REACHED);
         }
     }
     // set the depth of the parent category + 1
     if ($this->isNew() || $this->isColumnModified(categoryPeer::PARENT_ID)) {
         $parentCat = $this->getParentCategory();
         if ($this->getParentId() !== 0) {
             $this->setDepth($parentCat->getDepth() + 1);
         } else {
             $this->setDepth(0);
         }
         $this->setChildsDepth();
     }
     if ($this->getDepth() >= self::MAX_CATEGORY_DEPTH) {
         throw new kCoreException("Max depth was reached", kCoreException::MAX_CATEGORY_DEPTH_REACHED);
     }
     if ($this->isColumnModified(categoryPeer::NAME) || $this->isColumnModified(categoryPeer::PARENT_ID)) {
         $this->updateFullName();
         $this->renameOnEntries();
     }
     // happens in 3 cases:
     // 1. name of the current category was updated
     // 2. full name of the parent category was updated and it was set here as child
     // 3. parent id was changed
     if ($this->isColumnModified(categoryPeer::FULL_NAME)) {
         $this->setChildsFullNames();
     }
     // save the childs
     foreach ($this->childs_for_save as $child) {
         $child->save();
     }
     $this->childs_for_save = array();
     if ($this->isColumnModified(categoryPeer::DELETED_AT) && $this->getDeletedAt() !== null) {
         $this->moveEntriesToParent();
     }
     if ($this->isColumnModified(categoryPeer::PARENT_ID) && !$this->isNew()) {
         // decrease for the old parent category
         if ($this->old_parent_id) {
             $oldParentCat = categoryPeer::retrieveByPK($this->old_parent_id);
         }
         if ($oldParentCat) {
             $oldParentCat->decrementEntriesCount($this->entries_count);
         }
         // increase for the new parent category
         $newParentCat = categoryPeer::retrieveByPK($this->parent_id);
         if ($newParentCat) {
             $newParentCat->incrementEntriesCount($this->entries_count);
         }
         $this->old_parent_id = null;
     }
     parent::save($con);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:57,代码来源:category.php

示例2: 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];
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:12,代码来源:kCategoryIdentifier.php

示例3: 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);
         }
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:12,代码来源:KalturaCategory.php

示例4: 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);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:26,代码来源:categoryFilter.class.php

示例5: retrievePermittedKuserInCategory

 /**
  *  this function return categoryUser if the user has explicit or implicit (by group) required permissions on the category
  *
  * @param int $categoryId
  * @param int $kuserId
  * @param array $requiredPermissions
  * @param bool $supportGroups
  * @param null $con
  * @return categoryKuser|null
  */
 public static function retrievePermittedKuserInCategory($categoryId, $kuserId = null, $requiredPermissions = null, $supportGroups = true, $con = null)
 {
     $category = categoryPeer::retrieveByPK($categoryId);
     if (!$category) {
         return null;
     }
     if ($category->getInheritedParentId()) {
         $categoryId = $category->getInheritedParentId();
     }
     if (is_null($kuserId)) {
         $kuserId = kCurrentContext::getCurrentKsKuserId();
     }
     if (is_null($requiredPermissions)) {
         $requiredPermissions = array(PermissionName::CATEGORY_VIEW);
     }
     $categoryKuser = self::retrieveByCategoryIdAndActiveKuserId($categoryId, $kuserId, $requiredPermissions, $con);
     if (!is_null($categoryKuser)) {
         return $categoryKuser;
     }
     //check if kuserId has permission in category by a junction group
     if ($supportGroups) {
         $kgroupIds = KuserKgroupPeer::retrieveKgroupIdsByKuserId($kuserId);
         if (count($kgroupIds) == 0) {
             return null;
         }
         $criteria = new Criteria();
         $criteria->add(categoryKuserPeer::CATEGORY_ID, $categoryId);
         $criteria->add(categoryKuserPeer::KUSER_ID, $kgroupIds, Criteria::IN);
         $criteria->add(categoryKuserPeer::STATUS, CategoryKuserStatus::ACTIVE);
         $categoryKusers = categoryKuserPeer::doSelect($criteria, $con);
         if (!$categoryKusers) {
             return null;
         }
         foreach ($categoryKusers as $categoryKuser) {
             foreach ($requiredPermissions as $requiredPermission) {
                 if ($categoryKuser->hasPermission($requiredPermission)) {
                     return $categoryKuser;
                 }
             }
         }
     }
     return null;
 }
开发者ID:DBezemer,项目名称:server,代码行数:53,代码来源:categoryKuserPeer.php

示例6: getRootObjects

 public function getRootObjects(IRelatedObject $object)
 {
     /* @var $object categoryEntry */
     $roots = array();
     $category = categoryPeer::retrieveByPK($object->getCategoryId());
     if ($category) {
         $roots = categoryPeer::getRootObjects($category);
         $roots[] = $category;
     }
     $entry = entryPeer::retrieveByPK($object->getEntryId());
     if ($entry) {
         $roots[] = $entry;
     }
     return $roots;
 }
开发者ID:GElkayam,项目名称:server,代码行数:15,代码来源:categoryEntryPeer.php

示例7: reSetCategoryFullIds

 public function reSetCategoryFullIds()
 {
     $category = categoryPeer::retrieveByPK($this->getCategoryId());
     if (!$category) {
         throw new kCoreException('category id [' . $this->getCategoryId() . 'was not found', kCoreException::ID_NOT_FOUND);
     }
     $this->setCategoryFullIds($category->getFullIds());
 }
开发者ID:panigh,项目名称:server,代码行数:8,代码来源:categoryEntry.php

示例8: getObject

 /**
  * @return BaseObject
  */
 public function getObject()
 {
     switch ($this->getObjectType()) {
         case BatchJobObjectType::ENTRY:
             entryPeer::setUseCriteriaFilter(false);
             $object = entryPeer::retrieveByPK($this->getObjectId());
             entryPeer::setUseCriteriaFilter(true);
             return $object;
         case BatchJobObjectType::ASSET:
             assetPeer::setUseCriteriaFilter(false);
             $object = assetPeer::retrieveById($this->getObjectId());
             assetPeer::setUseCriteriaFilter(true);
             return $object;
         case BatchJobObjectType::CATEGORY:
             categoryPeer::setUseCriteriaFilter(false);
             $object = categoryPeer::retrieveByPK($this->getObjectId());
             categoryPeer::setUseCriteriaFilter(true);
             return $object;
         case BatchJobObjectType::FILE_SYNC:
             FileSyncPeer::setUseCriteriaFilter(false);
             $object = FileSyncPeer::retrieveByPK($this->getObjectId());
             FileSyncPeer::setUseCriteriaFilter(true);
             return $object;
         default:
             // TODO implement IBatchable in relevant plugins
             return KalturaPluginManager::loadObject('IBatchable', $this->getObjectId());
     }
     return $this->aRootJob;
 }
开发者ID:DBezemer,项目名称:server,代码行数:32,代码来源:BatchJob.php

示例9: 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);
             }
         }
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:37,代码来源:KalturaBaseEntry.php

示例10: getByFullIdsWildcardMatchForCategoryId

 /**
  * Get categories by id using full ids wildcard match (returns an array)
  *  
  * @param $id
  * @param $con
  * @return array
  */
 public static function getByFullIdsWildcardMatchForCategoryId($id, $con = null)
 {
     if (trim($id) == '') {
         return null;
     }
     $category = categoryPeer::retrieveByPK($id);
     if (!$category) {
         return null;
     }
     $fullIds = $category->getFullIds();
     $c = KalturaCriteria::create(categoryPeer::OM_CLASS);
     $c->add(categoryPeer::FULL_IDS, "{$fullIds}\\*", Criteria::LIKE);
     return categoryPeer::doSelect($c, $con);
 }
开发者ID:AdiTal,项目名称:server,代码行数:21,代码来源:categoryPeer.php

示例11: deleteAction

 /**
  * Delete a Category
  * 
  * @action delete
  * @param int $id
  */
 function deleteAction($id)
 {
     $categoryDb = categoryPeer::retrieveByPK($id);
     if (!$categoryDb) {
         throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $id);
     }
     $categoryDb->setDeletedAt(time());
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:14,代码来源:CategoryService.php

示例12: moveAction

 /**
  * Move categories that belong to the same parent category to a target categroy - enabled only for ks with disable entitlement
  * 
  * @action move
  * @param string $categoryIds
  * @param int $targetCategoryParentId
  * @return KalturaCategoryListResponse
  */
 function moveAction($categoryIds, $targetCategoryParentId)
 {
     if (kEntitlementUtils::getEntitlementEnforcement()) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_MOVE_CATEGORIES_FROM_DIFFERENT_PARENT_CATEGORY);
     }
     if ($this->getPartner()->getFeaturesStatusByType(IndexObjectType::LOCK_CATEGORY)) {
         throw new KalturaAPIException(KalturaErrors::CATEGORIES_LOCKED);
     }
     $categories = explode(',', $categoryIds);
     $dbCategories = array();
     $parentId = category::CATEGORY_ID_THAT_DOES_NOT_EXIST;
     foreach ($categories as $categoryId) {
         if ($categoryId == '') {
             continue;
         }
         $dbCategory = categoryPeer::retrieveByPK($categoryId);
         if (!$dbCategory) {
             throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $categoryId);
         }
         if ($parentId == category::CATEGORY_ID_THAT_DOES_NOT_EXIST) {
             $parentId = $dbCategory->getParentId();
         }
         if ($parentId != $dbCategory->getParentId()) {
             throw new KalturaAPIException(KalturaErrors::CANNOT_MOVE_CATEGORIES_FROM_DIFFERENT_PARENT_CATEGORY);
         }
         $dbCategories[] = $dbCategory;
     }
     // if $targetCategoryParentId = 0 - it means that categories should be with no parent category
     if ($targetCategoryParentId != 0) {
         $dbTargetCategory = categoryPeer::retrieveByPK($targetCategoryParentId);
         if (!$dbTargetCategory) {
             throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $targetCategoryParentId);
         }
     }
     foreach ($dbCategories as $dbCategory) {
         $dbCategory->setParentId($targetCategoryParentId);
         $dbCategory->save();
     }
 }
开发者ID:dozernz,项目名称:server,代码行数:47,代码来源:CategoryService.php

示例13: toInsertableObject

 public function toInsertableObject($dbObject = null, $skip = array())
 {
     if (is_null($this->permissionLevel)) {
         $category = categoryPeer::retrieveByPK($this->categoryId);
         if (!$category) {
             throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $this->categoryId);
         }
         $this->permissionLevel = $category->getDefaultPermissionLevel();
     }
     return parent::toInsertableObject($dbObject, $skip);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:11,代码来源:KalturaCategoryUser.php

示例14: getListResponse

 public function getListResponse(KalturaFilterPager $pager, KalturaDetachedResponseProfile $responseProfile = null)
 {
     if ($this->userIdIn) {
         $usersIds = explode(',', $this->userIdIn);
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $c = new Criteria();
         $c->add(kuserPeer::PARTNER_ID, $partnerId, Criteria::EQUAL);
         $c->add(kuserPeer::PUSER_ID, $usersIds, Criteria::IN);
         $kusers = kuserPeer::doSelect($c);
         $usersIds = array();
         foreach ($kusers as $kuser) {
             /* @var $kuser kuser */
             $usersIds[] = $kuser->getId();
         }
         $this->userIdIn = implode(',', $usersIds);
     }
     if ($this->relatedGroupsByUserId) {
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $userIds = array();
         $c = new Criteria();
         $c->add(kuserPeer::PARTNER_ID, $partnerId);
         $c->add(kuserPeer::PUSER_ID, $this->relatedGroupsByUserId);
         $c->add(kuserPeer::TYPE, KuserType::USER);
         $kuser = kuserPeer::doSelectOne($c);
         if (!$kuser) {
             $response = new KalturaCategoryUserListResponse();
             $response->objects = new KalturaCategoryUserArray();
             $response->totalCount = 0;
             return $response;
         }
         $kgroupIds = KuserKgroupPeer::retrieveKgroupIdsByKuserId($kuser->getId());
         if (!is_null($kgroupIds) && is_array($kgroupIds)) {
             $userIds = $kgroupIds;
         }
         $userIds[] = $kuser->getId();
         // if userIdIn is also set in the filter need to intersect the two arrays.
         if (isset($this->userIdIn)) {
             $curUserIds = explode(',', $this->userIdIn);
             $userIds = array_intersect($curUserIds, $userIds);
         }
         $this->userIdIn = implode(',', $userIds);
     }
     if ($this->userIdEqual) {
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $c = new Criteria();
         $c->add(kuserPeer::PARTNER_ID, $partnerId);
         $c->add(kuserPeer::PUSER_ID, $this->userIdEqual);
         if (kCurrentContext::$ks_partner_id == Partner::BATCH_PARTNER_ID) {
             //batch should be able to get categoryUser of deleted users.
             kuserPeer::setUseCriteriaFilter(false);
         }
         // in case of more than one deleted kusers - get the last one
         $c->addDescendingOrderByColumn(kuserPeer::UPDATED_AT);
         $kuser = kuserPeer::doSelectOne($c);
         kuserPeer::setUseCriteriaFilter(true);
         if (!$kuser) {
             KalturaLog::debug('User not found');
             $response = new KalturaCategoryUserListResponse();
             $response->objects = new KalturaCategoryUserArray();
             $response->totalCount = 0;
             return $response;
         }
         $this->userIdEqual = $kuser->getId();
     }
     $categories = array();
     if ($this->categoryIdEqual) {
         $categories[] = categoryPeer::retrieveByPK($this->categoryIdEqual);
     } elseif ($this->categoryIdIn) {
         $categories = categoryPeer::retrieveByPKs(explode(',', $this->categoryIdIn));
     }
     $categoriesInheritanceRoot = array();
     foreach ($categories as $category) {
         /* @var $category category */
         if (is_null($category)) {
             continue;
         }
         if ($category->getInheritanceType() == InheritanceType::INHERIT) {
             if ($this->categoryDirectMembers && kCurrentContext::$master_partner_id == Partner::BATCH_PARTNER_ID) {
                 $categoriesInheritanceRoot[$category->getId()] = $category->getId();
             } else {
                 //if category inheris members - change filter to -> inherited from parent id = category->getIheritedParent
                 $categoriesInheritanceRoot[$category->getInheritedParentId()] = $category->getInheritedParentId();
             }
         } else {
             $categoriesInheritanceRoot[$category->getId()] = $category->getId();
         }
     }
     $this->categoryDirectMembers = null;
     $this->categoryIdEqual = null;
     $this->categoryIdIn = implode(',', $categoriesInheritanceRoot);
     //if filter had categories that doesn't exists or not entitled - should return 0 objects.
     if (count($categories) && !count($categoriesInheritanceRoot)) {
         $response = new KalturaCategoryUserListResponse();
         $response->totalCount = 0;
         return $response;
     }
     $categoryKuserFilter = $this->toObject();
     $c = KalturaCriteria::create(categoryKuserPeer::OM_CLASS);
     $categoryKuserFilter->attachToCriteria($c);
     $pager->attachToCriteria($c);
//.........这里部分代码省略.........
开发者ID:kubrickfr,项目名称:server,代码行数:101,代码来源:KalturaCategoryUserFilter.php

示例15: validateForUpdate

 public function validateForUpdate($sourceObject, $propertiesToSkip = null)
 {
     /* @var $sourceObject categoryKuser */
     $category = categoryPeer::retrieveByPK($sourceObject->getCategoryId());
     if (!$category) {
         throw new KalturaAPIException(KalturaErrors::CATEGORY_NOT_FOUND, $sourceObject->getCategoryId());
     }
     if ($this->permissionNames && $this->permissionNames != $sourceObject->getPermissionNames()) {
         if ($sourceObject->getKuserId() == $category->getKuserId()) {
             if (strpos($this->permissionNames, PermissionName::CATEGORY_EDIT) === false) {
                 throw new KalturaAPIException(KalturaErrors::CANNOT_UPDATE_CATEGORY_USER_OWNER);
             }
         }
     }
     $currentKuserCategoryKuser = categoryKuserPeer::retrievePermittedKuserInCategory($sourceObject->getCategoryId(), kCurrentContext::getCurrentKsKuserId());
     if (kEntitlementUtils::getEntitlementEnforcement() && (!$currentKuserCategoryKuser || !$currentKuserCategoryKuser->hasPermission(PermissionName::CATEGORY_EDIT))) {
         throw new KalturaAPIException(KalturaErrors::CANNOT_UPDATE_CATEGORY_USER, $sourceObject->getCategoryId());
     }
     return parent::validateForUpdate($sourceObject, $propertiesToSkip);
 }
开发者ID:GElkayam,项目名称:server,代码行数:20,代码来源:KalturaCategoryUser.php


注:本文中的categoryPeer::retrieveByPK方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。