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


PHP categoryPeer::setUseCriteriaFilter方法代码示例

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


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

示例1: postUpdate

 public function postUpdate(PropelPDO $con = null)
 {
     parent::postUpdate($con);
     categoryPeer::setUseCriteriaFilter(false);
     $category = categoryPeer::retrieveByPK($this->getCategoryId());
     categoryPeer::setUseCriteriaFilter(true);
     if (!$category) {
         throw new kCoreException('category id [' . $this->getCategoryId() . 'was not found', kCoreException::ID_NOT_FOUND);
     }
     $entry = entryPeer::retrieveByPK($this->getEntryId());
     if (!$entry && $this->getStatus() != CategoryEntryStatus::DELETED) {
         throw new kCoreException('entry id [' . $this->getEntryId() . 'was not found', kCoreException::ID_NOT_FOUND);
     }
     if ($entry && $this->getStatus() == CategoryEntryStatus::ACTIVE && $this->getColumnsOldValue(categoryEntryPeer::STATUS) == CategoryEntryStatus::PENDING) {
         $entry = $this->setEntryOnCategory($category, $entry);
     }
     if ($this->getStatus() == CategoryEntryStatus::REJECTED && $this->getColumnsOldValue(categoryEntryPeer::STATUS) == CategoryEntryStatus::PENDING) {
         $category->decrementPendingEntriesCount();
     }
     if ($this->getStatus() == CategoryEntryStatus::PENDING && $this->getColumnsOldValue(categoryEntryPeer::STATUS) == CategoryEntryStatus::REJECTED) {
         $category->incrementPendingEntriesCount();
     }
     if ($this->getStatus() == CategoryEntryStatus::DELETED) {
         if ($this->getColumnsOldValue(categoryEntryPeer::STATUS) == CategoryEntryStatus::ACTIVE) {
             $category->decrementEntriesCount($this->getEntryId());
             $category->decrementDirectEntriesCount($this->getEntryId());
             if ($entry && !categoryEntryPeer::getSkipSave()) {
                 $categories = array();
                 if (trim($entry->getCategories()) != '') {
                     $categories = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getCategories());
                     foreach ($categories as $index => $entryCategoryFullName) {
                         if ($entryCategoryFullName == $category->getFullName()) {
                             unset($categories[$index]);
                         }
                     }
                 }
                 $categoriesIds = array();
                 if (trim($entry->getCategoriesIds()) != '') {
                     $categoriesIds = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getCategoriesIds());
                     foreach ($categories as $index => $entryCategoryId) {
                         if ($entryCategoryId == $category->getId()) {
                             unset($categoriesIds[$index]);
                         }
                     }
                 }
                 $entry->setCategories(implode(entry::ENTRY_CATEGORY_SEPARATOR, $categories));
                 $entry->setCategoriesIds(implode(entry::ENTRY_CATEGORY_SEPARATOR, $categoriesIds));
                 $entry->save();
             }
             kEventsManager::raiseEvent(new kObjectDeletedEvent($this));
         }
         if ($this->getColumnsOldValue(categoryEntryPeer::STATUS) == CategoryEntryStatus::PENDING) {
             $category->decrementPendingEntriesCount();
         }
     }
     $category->save();
     if ($entry && !categoryEntryPeer::getSkipSave()) {
         $entry->indexToSearchIndex();
     }
 }
开发者ID:panigh,项目名称:server,代码行数:60,代码来源:categoryEntry.php

示例2: 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

示例3: 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() . "]");
     }
 }
开发者ID:dozernz,项目名称:server,代码行数:36,代码来源:myPartnerUtils.class.php

示例4: copyEntry

 public static function copyEntry(entry $entry, Partner $toPartner = null, $dontCopyUsers = false)
 {
     KalturaLog::log("copyEntry - Copying entry [" . $entry->getId() . "] to partner [" . $toPartner->getId() . "]");
     $newEntry = $entry->copy();
     $newEntry->setIntId(null);
     $newEntry->setCategories(null);
     $newEntry->setCategoriesIds(null);
     if ($toPartner instanceof Partner) {
         $newEntry->setPartnerId($toPartner->getId());
         $newEntry->setSubpId($toPartner->getId() * 100);
         $newEntry->setAccessControlId($toPartner->getDefaultAccessControlId());
     }
     $newKuser = null;
     if (!$dontCopyUsers) {
         // copy the kuser (if the same puser id exists its kuser will be used)
         kuserPeer::setUseCriteriaFilter(false);
         $kuser = $entry->getKuser();
         $newKuser = kuserPeer::createKuserForPartner($newEntry->getPartnerId(), $kuser->getPuserId());
         $newEntry->setKuserId($newKuser->getId());
         $newEntry->setCreatorKuserId($newKuser->getId());
         kuserPeer::setUseCriteriaFilter(true);
     }
     // copy the kshow
     kshowPeer::setUseCriteriaFilter(false);
     $kshow = $entry->getKshow();
     if ($kshow) {
         $newKshow = $kshow->copy();
         $newKshow->setIntId(null);
         $newKshow->setPartnerId($toPartner->getId());
         $newKshow->setSubpId($toPartner->getId() * 100);
         if ($newKuser) {
             $newKshow->setProducerId($newKuser->getId());
         }
         $newKshow->save();
         $newEntry->setKshowId($newKshow->getId());
     }
     kshowPeer::setUseCriteriaFilter(true);
     // reset the statistics
     myEntryUtils::resetEntryStatistics($newEntry);
     // set the new partner id into the default category criteria filter
     $defaultCategoryFilter = categoryPeer::getCriteriaFilter()->getFilter();
     $oldPartnerId = $defaultCategoryFilter->get(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $newEntry->getPartnerId());
     // save the entry
     $newEntry->save();
     // restore the original partner id in the default category criteria filter
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $oldPartnerId);
     KalturaLog::log("copyEntry - New entry [" . $newEntry->getId() . "] was created");
     if ($entry->getStatus() != entryStatus::READY) {
         $clonePendingEntries = $entry->getClonePendingEntries();
         $clonePendingEntries[] = $newEntry->getId();
         $entry->setClonePendingEntries($clonePendingEntries);
         $entry->save();
     } else {
         self::copyEntryData($entry, $newEntry);
     }
     //if entry is a static playlist, link between it and its new child entries
     if ($entry->getType() == entryType::PLAYLIST) {
         switch ($entry->getMediaType()) {
             case entry::ENTRY_MEDIA_TYPE_TEXT:
                 $from = $entry->getDataContent();
                 KalturaLog::debug("Entries to copy from source static playlist: [{$from}]");
                 $fromEntryIds = explode(",", $from);
                 $toEntryIds = array();
                 foreach ($fromEntryIds as $fromEntryId) {
                     $toEntryIds[] = kObjectCopyHandler::getMappedId(entryPeer::OM_CLASS, $fromEntryId);
                 }
                 $newEntry->setDataContent(implode(",", $toEntryIds));
                 break;
             case entry::ENTRY_MEDIA_TYPE_XML:
                 list($totalResults, $fromFiltersList) = myPlaylistUtils::getPlaylistFilterListStruct($entry->getDataContent());
                 $toPlaylistXml = new SimpleXMLElement("<playlist/>");
                 $toPlaylistXml->addChild("total_results", $totalResults);
                 $toFiltersXml = $toPlaylistXml->addChild("filters");
                 foreach ($fromFiltersList as $filterXML) {
                     $entryFilter = new entryFilter();
                     $entryFilter->fillObjectFromXml($filterXML, "_");
                     if (isset($entryFilter->fields["_matchand_categories_ids"])) {
                         $categoriesIds = explode(",", $entryFilter->fields["_matchand_categories_ids"]);
                         $newCategoriesIds = array();
                         foreach ($categoriesIds as $categoryId) {
                             $newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
                         }
                         $entryFilter->fields["_matchand_categories_ids"] = implode(",", $newCategoriesIds);
                     }
                     if (isset($entryFilter->fields["_matchor_categories_ids"])) {
                         $categoriesIds = explode(",", $entryFilter->fields["_matchor_categories_ids"]);
                         $newCategoriesIds = array();
                         foreach ($categoriesIds as $categoryId) {
                             $newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
                         }
                         $entryFilter->fields["_matchor_categories_ids"] = implode(",", $newCategoriesIds);
                     }
                     if (isset($entryFilter->fields["_in_category_ancestor_id"])) {
                         $categoriesIds = explode(",", $entryFilter->fields["_in_category_ancestor_id"]);
                         $newCategoriesIds = array();
                         foreach ($categoriesIds as $categoryId) {
                             $newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
//.........这里部分代码省略.........
开发者ID:DBezemer,项目名称:server,代码行数:101,代码来源:myEntryUtils.class.php

示例5: updateCategroy

 private function updateCategroy($isDelete = false)
 {
     categoryPeer::setUseCriteriaFilter(false);
     $category = categoryPeer::retrieveByPK($this->category_id);
     categoryPeer::setUseCriteriaFilter(true);
     if (!$category) {
         throw new kCoreException('category not found');
     }
     if ($this->isNew()) {
         if ($this->status == CategoryKuserStatus::PENDING) {
             $category->setPendingMembersCount($category->getPendingMembersCount() + 1);
         }
         if ($this->status == CategoryKuserStatus::ACTIVE) {
             $category->setMembersCount($category->getMembersCount() + 1);
         }
         $category->save();
     } elseif ($this->isColumnModified(categoryKuserPeer::STATUS)) {
         if ($this->status == CategoryKuserStatus::PENDING) {
             $category->setPendingMembersCount($category->getPendingMembersCount() + 1);
         }
         if ($this->status == CategoryKuserStatus::ACTIVE) {
             $category->setMembersCount($category->getMembersCount() + 1);
         }
         if ($this->old_status == CategoryKuserStatus::PENDING) {
             $category->setPendingMembersCount($category->getPendingMembersCount() - 1);
         }
         if ($this->old_status == CategoryKuserStatus::ACTIVE) {
             $category->setMembersCount($category->getMembersCount() - 1);
         }
         $category->save();
     }
     if ($isDelete) {
         if ($this->status == CategoryKuserStatus::PENDING) {
             $category->setPendingMembersCount($category->getPendingMembersCount() - 1);
         }
         if ($this->status == CategoryKuserStatus::ACTIVE) {
             $category->setMembersCount($category->getMembersCount() - 1);
         }
         $category->save();
     }
     $this->addIndexCategoryInheritedTreeJob($category->getFullIds());
     $category->indexToSearchIndex();
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:43,代码来源:categoryKuser.php

示例6: copyEntry

 public static function copyEntry(entry $entry, Partner $toPartner = null, $dontCopyUsers = false)
 {
     KalturaLog::log("copyEntry - Copying entry [" . $entry->getId() . "] to partner [" . $toPartner->getId() . "]");
     $newEntry = $entry->copy();
     $newEntry->setIntId(null);
     $newEntry->setCategories(null);
     $newEntry->setCategoriesIds(null);
     if ($toPartner instanceof Partner) {
         $newEntry->setPartnerId($toPartner->getId());
         $newEntry->setSubpId($toPartner->getId() * 100);
         $newEntry->setAccessControlId($toPartner->getDefaultAccessControlId());
     }
     $newKuser = null;
     if (!$dontCopyUsers) {
         // copy the kuser (if the same puser id exists its kuser will be used)
         kuserPeer::setUseCriteriaFilter(false);
         $kuser = $entry->getKuser();
         $newKuser = kuserPeer::createKuserForPartner($newEntry->getPartnerId(), $kuser->getPuserId());
         $newEntry->setKuserId($newKuser->getId());
         $newEntry->setCreatorKuserId($newKuser->getId());
         kuserPeer::setUseCriteriaFilter(true);
     }
     // copy the kshow
     kshowPeer::setUseCriteriaFilter(false);
     $kshow = $entry->getKshow();
     if ($kshow) {
         $newKshow = $kshow->copy();
         $newKshow->setIntId(null);
         $newKshow->setPartnerId($toPartner->getId());
         $newKshow->setSubpId($toPartner->getId() * 100);
         if ($newKuser) {
             $newKshow->setProducerId($newKuser->getId());
         }
         $newKshow->save();
         $newEntry->setKshowId($newKshow->getId());
     }
     kshowPeer::setUseCriteriaFilter(true);
     // reset the statistics
     myEntryUtils::resetEntryStatistics($newEntry);
     // set the new partner id into the default category criteria filter
     $defaultCategoryFilter = categoryPeer::getCriteriaFilter()->getFilter();
     $oldPartnerId = $defaultCategoryFilter->get(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $newEntry->getPartnerId());
     // save the entry
     $newEntry->save();
     // restore the original partner id in the default category criteria filter
     $defaultCategoryFilter->remove(categoryPeer::PARTNER_ID);
     $defaultCategoryFilter->addAnd(categoryPeer::PARTNER_ID, $oldPartnerId);
     KalturaLog::log("copyEntry - New entry [" . $newEntry->getId() . "] was created");
     // for any type that does not require assets:
     $shouldCopyDataForNonClip = true;
     if ($entry->getType() == entryType::MEDIA_CLIP) {
         $shouldCopyDataForNonClip = false;
     }
     if ($entry->getType() == entryType::PLAYLIST) {
         $shouldCopyDataForNonClip = false;
     }
     $shouldCopyDataForClip = false;
     // only images get their data copied
     if ($entry->getType() == entryType::MEDIA_CLIP) {
         if ($entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_VIDEO && $entry->getMediaType() != entry::ENTRY_MEDIA_TYPE_AUDIO) {
             $shouldCopyDataForClip = true;
         }
     }
     //if entry is a static playlist, link between it and its new child entries
     if ($entry->getType() == entryType::PLAYLIST) {
         switch ($entry->getMediaType()) {
             case entry::ENTRY_MEDIA_TYPE_TEXT:
                 $from = $entry->getDataContent();
                 KalturaLog::debug("Entries to copy from source static playlist: [{$from}]");
                 $fromEntryIds = explode(",", $from);
                 $toEntryIds = array();
                 foreach ($fromEntryIds as $fromEntryId) {
                     $toEntryIds[] = kObjectCopyHandler::getMappedId(entryPeer::OM_CLASS, $fromEntryId);
                 }
                 $newEntry->setDataContent(implode(",", $toEntryIds));
                 break;
             case entry::ENTRY_MEDIA_TYPE_XML:
                 list($totalResults, $fromFiltersList) = myPlaylistUtils::getPlaylistFilterListStruct($entry->getDataContent());
                 $toPlaylistXml = new SimpleXMLElement("<playlist/>");
                 $toPlaylistXml->addChild("total_results", $totalResults);
                 $toFiltersXml = $toPlaylistXml->addChild("filters");
                 foreach ($fromFiltersList as $filterXML) {
                     $entryFilter = new entryFilter();
                     $entryFilter->fillObjectFromXml($filterXML, "_");
                     if (isset($entryFilter->fields["_matchand_categories_ids"])) {
                         $categoriesIds = explode(",", $entryFilter->fields["_matchand_categories_ids"]);
                         $newCategoriesIds = array();
                         foreach ($categoriesIds as $categoryId) {
                             $newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
                         }
                         $entryFilter->fields["_matchand_categories_ids"] = implode(",", $newCategoriesIds);
                     }
                     if (isset($entryFilter->fields["_matchor_categories_ids"])) {
                         $categoriesIds = explode(",", $entryFilter->fields["_matchor_categories_ids"]);
                         $newCategoriesIds = array();
                         foreach ($categoriesIds as $categoryId) {
                             $newCategoriesIds[] = kObjectCopyHandler::getMappedId(categoryPeer::OM_CLASS, $categoryId);
                         }
//.........这里部分代码省略.........
开发者ID:kubrickfr,项目名称:server,代码行数:101,代码来源:myEntryUtils.class.php

示例7: postUpdate

 public function postUpdate(PropelPDO $con = null)
 {
     parent::postUpdate($con);
     categoryPeer::setUseCriteriaFilter(false);
     $category = categoryPeer::retrieveByPK($this->getCategoryId());
     categoryPeer::setUseCriteriaFilter(true);
     if (!$category) {
         throw new kCoreException('category id [' . $this->getCategoryId() . 'was not found', kCoreException::ID_NOT_FOUND);
     }
     $entry = entryPeer::retrieveByPK($this->getEntryId());
     if (!$entry && $this->getStatus() != CategoryEntryStatus::DELETED) {
         throw new kCoreException('entry id [' . $this->getEntryId() . 'was not found', kCoreException::ID_NOT_FOUND);
     }
     if ($entry && $this->getStatus() == CategoryEntryStatus::ACTIVE && $this->getColumnsOldValue(categoryEntryPeer::STATUS) == CategoryEntryStatus::PENDING) {
         $entry = $this->setEntryOnCategory($category, $entry);
     }
     if ($this->getStatus() == CategoryEntryStatus::REJECTED && $this->getColumnsOldValue(categoryEntryPeer::STATUS) == CategoryEntryStatus::PENDING) {
         $category->decrementPendingEntriesCount();
     }
     if ($this->getStatus() == CategoryEntryStatus::DELETED) {
         if ($this->getColumnsOldValue(categoryEntryPeer::STATUS) == CategoryEntryStatus::ACTIVE) {
             if (is_null($this->entryCategoriesRemovedIds)) {
                 $categoriesEntries = categoryEntryPeer::retrieveActiveByEntryId($this->getEntryId());
                 $categoriesIds = array();
                 foreach ($categoriesEntries as $categroyEntry) {
                     //cannot get directly the full ids - since it might not be updated.
                     if ($categroyEntry->getCategoryId() != $this->getCategoryId()) {
                         $categoriesIds[] = $categroyEntry->getCategoryId();
                     }
                 }
                 $categoriesRemoved = categoryPeer::retrieveByPKs($categoriesIds);
                 $entryCategoriesRemovedIds = array();
                 foreach ($categoriesRemoved as $categoryRemoved) {
                     $fullIds = explode(categoryPeer::CATEGORY_SEPARATOR, $categoryRemoved->getFullIds());
                     $entryCategoriesRemovedIds = array_merge($entryCategoriesRemovedIds, $fullIds);
                 }
                 $this->entryCategoriesRemovedIds = $entryCategoriesRemovedIds;
             }
             $category->decrementEntriesCount(1, $this->entryCategoriesRemovedIds);
             $category->decrementDirectEntriesCount();
             if ($entry && !categoryEntryPeer::getSkipSave()) {
                 $fullName = $category->getFullName();
                 $entryCategories = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getCategories());
                 $newCategories = array();
                 foreach ($entryCategories as $entryCategory) {
                     if (!preg_match("/^" . $fullName . "/", $entryCategory)) {
                         $newCategories[] = $entryCategory;
                     }
                 }
                 $categoryId = $category->getId();
                 $entryCategoriesIds = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getCategoriesIds());
                 $newCategoriesIds = array();
                 foreach ($entryCategoriesIds as $entryCategoryIds) {
                     if (!preg_match("/^" . $categoryId . "/", $entryCategoryIds)) {
                         $newCategoriesIds[] = $entryCategoryIds;
                     }
                 }
                 $entry->parentSetCategories(implode(entry::ENTRY_CATEGORY_SEPARATOR, $newCategories));
                 $entry->parentSetCategoriesIds(implode(entry::ENTRY_CATEGORY_SEPARATOR, $newCategoriesIds));
                 $entry->save();
             }
         }
         if ($this->getColumnsOldValue(categoryEntryPeer::STATUS) == CategoryEntryStatus::PENDING) {
             $category->decrementPendingEntriesCount();
         }
     }
     $category->save();
     if ($entry && !categoryEntryPeer::getSkipSave()) {
         $entry->indexToSearchIndex();
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:71,代码来源:categoryEntry.php

示例8: reload

 /**
  * Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
  *
  * This will only work if the object has been saved and has a valid primary key set.
  *
  * @param      boolean $deep (optional) Whether to also de-associated any related objects.
  * @param      PropelPDO $con (optional) The PropelPDO connection to use.
  * @return     void
  * @throws     PropelException - if this object is deleted, unsaved or doesn't have pk match in db
  */
 public function reload($deep = false, PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("Cannot reload a deleted object.");
     }
     if ($this->isNew()) {
         throw new PropelException("Cannot reload an unsaved object.");
     }
     if ($con === null) {
         $con = Propel::getConnection(categoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     // We don't need to alter the object instance pool; we're just modifying this instance
     // already in the pool.
     categoryPeer::setUseCriteriaFilter(false);
     $stmt = categoryPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
     categoryPeer::setUseCriteriaFilter(true);
     $row = $stmt->fetch(PDO::FETCH_NUM);
     $stmt->closeCursor();
     if (!$row) {
         throw new PropelException('Cannot find matching row in the database to reload object values.');
     }
     $this->hydrate($row, 0, true);
     // rehydrate
     if ($deep) {
         // also de-associate any related objects?
         $this->collcategoryKusers = null;
         $this->lastcategoryKuserCriteria = null;
     }
     // if (deep)
 }
开发者ID:DBezemer,项目名称:server,代码行数:40,代码来源:Basecategory.php

示例9: validateTemplatePartner

 /**
  * Validate the amount of core and plugin objects found on the template partner.
  * @param Partner $templatePartner
  */
 private function validateTemplatePartner(Partner $templatePartner)
 {
     //access control profiles
     $c = new Criteria();
     $c->add(accessControlPeer::PARTNER_ID, $templatePartner->getId());
     $count = accessControlPeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_ac_profiles')) {
         throw new kCoreException("Template partner's number of [accessControlProfiles] objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     //categories
     categoryPeer::setUseCriteriaFilter(false);
     $c = new Criteria();
     $c->addAnd(categoryPeer::PARTNER_ID, $templatePartner->getId());
     $c->addAnd(categoryPeer::STATUS, CategoryStatus::ACTIVE);
     $count = categoryPeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_categories')) {
         throw new kCoreException("Template partner's number of [category] objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     categoryPeer::setUseCriteriaFilter(true);
     //conversion profiles
     $c = new Criteria();
     $c->add(conversionProfile2Peer::PARTNER_ID, $templatePartner->getId());
     $count = conversionProfile2Peer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_conversion_profiles')) {
         throw new kCoreException("Template partner's number of [conversionProfile] objects exceeds allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     //entries
     entryPeer::setUseCriteriaFilter(false);
     $c = new Criteria();
     $c->addAnd(entryPeer::PARTNER_ID, $templatePartner->getId());
     $c->addAnd(entryPeer::TYPE, entryType::MEDIA_CLIP);
     $c->addAnd(entryPeer::STATUS, entryStatus::READY);
     $count = entryPeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_entries')) {
         throw new kCoreException("Template partner's number of MEDIA_CLIP objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     entryPeer::setUseCriteriaFilter(true);
     //playlists
     entryPeer::setUseCriteriaFilter(false);
     $c = new Criteria();
     $c->addAnd(entryPeer::PARTNER_ID, $templatePartner->getId());
     $c->addAnd(entryPeer::TYPE, entryType::PLAYLIST);
     $c->addAnd(entryPeer::STATUS, entryStatus::READY);
     $count = entryPeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_playlists')) {
         throw new kCoreException("Template partner's number of PLAYLIST objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     entryPeer::setUseCriteriaFilter(true);
     //flavor params
     $c = new Criteria();
     $c->add(assetParamsPeer::PARTNER_ID, $templatePartner->getId());
     $count = assetParamsPeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_flavor_params')) {
         throw new kCoreException("Template partner's number of [flavorParams] objects exceeds allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     //uiconfs
     uiConfPeer::setUseCriteriaFilter(false);
     $c = new Criteria();
     $c->addAnd(uiConfPeer::PARTNER_ID, $templatePartner->getId());
     $c->addAnd(uiConfPeer::OBJ_TYPE, array(uiConf::UI_CONF_TYPE_KDP3, uiConf::UI_CONF_TYPE_WIDGET), Criteria::IN);
     $c->addAnd(uiConfPeer::STATUS, uiConf::UI_CONF_STATUS_READY);
     $count = uiConfPeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_ui_confs')) {
         throw new kCoreException("Template partner's number of [uiconf] objects exceeds allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     uiConfPeer::setUseCriteriaFilter(true);
     //user roles
     UserRolePeer::setUseCriteriaFilter(false);
     $c = new Criteria();
     $c->addAnd(UserRolePeer::PARTNER_ID, $templatePartner->getId(), Criteria::EQUAL);
     $c->addAnd(UserRolePeer::STATUS, UserRoleStatus::ACTIVE, Criteria::EQUAL);
     $count = UserRolePeer::doCount($c);
     if ($count > kConf::get('copy_partner_limit_user_roles')) {
         throw new kCoreException("Template partner's number of [userRole] objects exceed allowed limit", kCoreException::TEMPLATE_PARTNER_COPY_LIMIT_EXCEEDED);
     }
     UserRolePeer::setUseCriteriaFilter(true);
     $validatorPlugins = KalturaPluginManager::getPluginInstances('IKalturaObjectValidator');
     foreach ($validatorPlugins as $validatorPlugins) {
         $validatorPlugins->validateObject($templatePartner, IKalturaObjectValidator::OPERATION_COPY);
     }
 }
开发者ID:AdiTal,项目名称:server,代码行数:85,代码来源:myPartnerRegistration.class.php

示例10: chdir

<?php

chdir(dirname(__FILE__));
require_once __DIR__ . '/../../bootstrap.php';
$c = new Criteria();
if ($argc > 1 && is_numeric($argv[1])) {
    $c->add(categoryPeer::UPDATED_AT, $argv[1], Criteria::GREATER_EQUAL);
}
if ($argc > 2 && is_numeric($argv[2])) {
    $c->add(categoryPeer::PARTNER_ID, $argv[2], Criteria::EQUAL);
}
if ($argc > 3 && is_numeric($argv[3])) {
    $c->add(categoryPeer::ID, $argv[3], Criteria::GREATER_EQUAL);
}
if ($argc > 4) {
    categoryPeer::setUseCriteriaFilter((bool) $argv[4]);
}
$c->addAscendingOrderByColumn(categoryPeer::UPDATED_AT);
$c->addAscendingOrderByColumn(categoryPeer::ID);
$c->setLimit(10000);
$con = myDbHelper::getConnection(myDbHelper::DB_HELPER_CONN_PROPEL2);
//$sphinxCon = DbManager::getSphinxConnection();
$categories = categoryPeer::doSelect($c, $con);
$sphinx = new kSphinxSearchManager();
while (count($categories)) {
    foreach ($categories as $category) {
        /* @var $category Category */
        KalturaLog::log('category id ' . $category->getId() . ' int id[' . $category->getIntId() . '] crc id[' . $sphinx->getSphinxId($category) . '] last updated at [' . $category->getUpdatedAt(null) . ']');
        try {
            $ret = $sphinx->saveToSphinx($category, true);
        } catch (Exception $e) {
开发者ID:DBezemer,项目名称:server,代码行数:31,代码来源:populateSphinxCategories.php

示例11: retrieveEntitledAndNonIndexedByKuser

 /**
  * Return all categories kuser is entitled to view the content.
  * (User may call category->get to view a category - but not to view its content)
  * 
  * @param int $kuserId
  * @param int $limit
  * @return array<categories>
  */
 public static function retrieveEntitledAndNonIndexedByKuser($kuserId, $limit)
 {
     $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
     $partner = PartnerPeer::retrieveByPK($partnerId);
     $categoryGroupSize = category::MAX_NUMBER_OF_MEMBERS_TO_BE_INDEXED_ON_ENTRY;
     if ($partner && $partner->getCategoryGroupSize()) {
         $categoryGroupSize = $partner->getCategoryGroupSize();
     }
     $c = KalturaCriteria::create(categoryPeer::OM_CLASS);
     $filteredCategoriesIds = entryPeer::getFilterdCategoriesIds();
     if (count($filteredCategoriesIds)) {
         $c->addAnd(categoryPeer::ID, $filteredCategoriesIds, Criteria::IN);
     }
     $membersCountCrit = $c->getNewCriterion(categoryPeer::MEMBERS_COUNT, $categoryGroupSize, Criteria::GREATER_THAN);
     $membersCountCrit->addOr($c->getNewCriterion(categoryPeer::ENTRIES_COUNT, entry::CATEGORY_ENTRIES_COUNT_LIMIT_TO_BE_INDEXED, Criteria::GREATER_THAN));
     $c->addAnd($membersCountCrit);
     $c->setLimit($limit);
     $c->addDescendingOrderByColumn(categoryPeer::UPDATED_AT);
     //all fields needed from default criteria
     //here we cannot use the default criteria, as we need to get all categories user is entitled to view the content.
     //not deleted or purged
     $c->add(self::STATUS, array(CategoryStatus::DELETED, CategoryStatus::PURGED), Criteria::NOT_IN);
     $c->add(self::PARTNER_ID, $partnerId, Criteria::EQUAL);
     //add privacy context
     $privacyContextCrit = $c->getNewCriterion(self::PRIVACY_CONTEXTS, kEntitlementUtils::getKsPrivacyContext(), KalturaCriteria::IN_LIKE);
     $privacyContextCrit->addTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
     $c->addAnd($privacyContextCrit);
     //set privacy by ks and type
     $crit = $c->getNewCriterion(self::PRIVACY, kEntitlementUtils::getPrivacyForKs(), Criteria::IN);
     $crit->addTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
     //user is entitled to view all cantent that belong to categoires he is a membr of
     $kuser = null;
     $ksString = kCurrentContext::$ks ? kCurrentContext::$ks : '';
     if ($ksString != '') {
         $partnerId = kCurrentContext::$partner_id ? kCurrentContext::$partner_id : kCurrentContext::$ks_partner_id;
         $kuser = kuserPeer::getActiveKuserByPartnerAndUid($partnerId, kCurrentContext::$ks_uid);
     }
     if ($kuser) {
         $membersCrit = $c->getNewCriterion(self::MEMBERS, $kuser->getId(), Criteria::LIKE);
         $membersCrit->addTag(KalturaCriterion::TAG_ENTITLEMENT_CATEGORY);
         $crit->addOr($membersCrit);
     }
     $c->addAnd($crit);
     categoryPeer::setUseCriteriaFilter(false);
     $categories = self::doSelect($c);
     categoryPeer::setUseCriteriaFilter(true);
     return $categories;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:56,代码来源:categoryPeer.php

示例12: postInsert

 /**
  * Code to be run after inserting to database
  * @param PropelPDO $con 
  */
 public function postInsert(PropelPDO $con = null)
 {
     categoryPeer::setUseCriteriaFilter(false);
     $this->reload();
     categoryPeer::setUseCriteriaFilter(true);
     kEventsManager::raiseEvent(new kObjectCreatedEvent($this));
     if ($this->copiedFrom) {
         kEventsManager::raiseEvent(new kObjectCopiedEvent($this->copiedFrom, $this));
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:14,代码来源:Basecategory.php


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