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


PHP category::getId方法代码示例

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


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

示例1: save

 /**
  * Saves an category into the database.
  *
  * @param \GamyGoody\Domain\category $category The category to save
  */
 public function save(category $category)
 {
     $categoryData = array('cat_title' => $category->getTitle());
     if ($category->getId()) {
         // The category has already been saved : update it
         $this->getDb()->update('category', $categoryData, array('cat_id' => $category->getId()));
     } else {
         // The category has never been saved : insert it
         $this->getDb()->insert('category', $categoryData);
         // Get the id of the newly created category and set it on the entity.
         $id = $this->getDb()->lastInsertId();
         $category->setId($id);
     }
 }
开发者ID:polytechlyon-isi2,项目名称:GamyGoody,代码行数:19,代码来源:CategoryDAO.php

示例2: getCategoriesByGroup

 /**
  * Liefert ein array aller Kategorien, auf welche die angegebene Gruppe zugreifen darf
  * @param int $groupId
  * @return array
  */
 public function getCategoriesByGroup($groupId)
 {
     $where = "groups = ? OR groups " . $this->dbcon->dbLike() . " ? OR groups " . $this->dbcon->dbLike() . " ? OR groups " . $this->dbcon->dbLike() . " ?";
     $valueParams = array();
     $valueParams[] = "{$groupId}";
     $valueParams[] = "%;{$groupId};%";
     $valueParams[] = "{$groupId};%";
     $valueParams[] = "%;{$groupId}";
     $list = $this->dbcon->fetch($this->dbcon->select($this->table, '*', $where, $valueParams), true);
     $res = array();
     foreach ($list as $listItem) {
         $object = new category();
         if ($object->createFromDbObject($listItem)) {
             $res[$object->getId()] = $object;
         }
     }
     return $res;
 }
开发者ID:sea75300,项目名称:fanpresscm3,代码行数:23,代码来源:categoryList.php

示例3: addInstanceToPool

 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      category $value A category object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(category $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:22,代码来源:BasecategoryPeer.php

示例4: addInstanceToPool

 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      category $value A category object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(category $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) {
             self::$instances[$key] = $obj;
             kMemoryManager::registerPeer('categoryPeer');
         }
     }
 }
开发者ID:DBezemer,项目名称:server,代码行数:24,代码来源:BasecategoryPeer.php

示例5: findSubcategories

 /**
  * Find subcategories
  * @param category
  * @return array
  */
 public function findSubcategories(category $category)
 {
     $ret = $this->poolResults(dibi::query('
         SELECT
             [categories].[id] AS [id],
             [pages].[name] AS [name],
             [pages].[nice_name] AS [nice_name],
             [pages].[content] AS [description],
             [pages].[meta_keywords] AS [meta_keywords],
             [pages].[meta_description] AS [meta_description],
             [pictures].[id] AS [picture_id],
             [pictures].[file] AS [picture_file],
             [pictures].[description] AS [picture_description],
             [pictures].[thumbnail_id] AS [thumbnail_id],
             [thumbnails].[file] AS [thumbnail_file],
             [thumbnails].[description] AS [thumbnail_description]
         FROM (SELECT
                 [node].[id] AS [id],
                 (COUNT([parent].[id]) - ([sub_tree].[depth] + 1)) AS [depth]
             FROM [:prefix:categories] AS [node], [:prefix:categories] AS [parent],
                 [:prefix:categories] AS [sub_parent], (
                     SELECT [node].[id], (COUNT([parent].[id]) - 1) AS [depth]
                     FROM [:prefix:categories] AS [node], [:prefix:categories] AS [parent]
                     WHERE ([node].[lft] BETWEEN [parent].[lft] AND [parent].[rgt]) AND
                         [node].[id] = %i', $category->getId(), '
                     GROUP BY [node].[id]
                 ) AS [sub_tree]
             WHERE ([node].[lft] BETWEEN [parent].[lft] AND [parent].[rgt]) AND
                 ([node].[lft] BETWEEN [sub_parent].[lft] AND [sub_parent].[rgt]) AND
                 [sub_parent].[id] = [sub_tree].[id]
             GROUP BY [node].[id]
             HAVING [depth] = 1) AS [categories]
         LEFT JOIN [:prefix:pages] AS [pages]
             ON [pages].[ref_id] = [categories].[id] AND
                [pages].[ref_type] = %s', pages::CATEGORY, '
         LEFT JOIN [:prefix:pictures] AS [pictures]
             ON [pages].[picture_id] = [pictures].[id]
         LEFT JOIN [:prefix:pictures] AS [thumbnails]
             ON [pictures].[thumbnail_id] = [thumbnails].[id]
         ORDER BY [name]'));
     return $ret;
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:47,代码来源:categories.php

示例6: setEntryOnCategory

 private function setEntryOnCategory(category $category, $entry = null)
 {
     $category->incrementEntriesCount($this->getEntryId());
     $category->incrementDirectEntriesCount($this->getEntryId());
     //if was pending - decrease pending entries count!
     if ($this->getColumnsOldValue(categoryEntryPeer::STATUS) == CategoryEntryStatus::PENDING) {
         $category->decrementPendingEntriesCount();
     }
     $category->save();
     //only categories with no context are saved on entry - this is only for Backward compatible
     if ($entry && !categoryEntryPeer::getSkipSave() && (trim($category->getPrivacyContexts()) == '' || $category->getPrivacyContexts() == null)) {
         $categories = array();
         if (trim($entry->getCategories()) != '') {
             $categories = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getCategories());
         }
         $categories[] = $category->getFullName();
         $categoriesIds = array();
         if (trim($entry->getCategoriesIds()) != '') {
             $categoriesIds = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getCategoriesIds());
         }
         $categoriesIds[] = $category->getId();
         $entry->parentSetCategories(implode(entry::ENTRY_CATEGORY_SEPARATOR, $categories));
         $entry->parentSetCategoriesIds(implode(entry::ENTRY_CATEGORY_SEPARATOR, $categoriesIds));
         $entry->justSave();
     }
     return $entry;
 }
开发者ID:panigh,项目名称:server,代码行数:27,代码来源:categoryEntry.php

示例7: createByPartnerAndFullName

 /**
  * Initialize new category using patnerId and fullName, this will also create the needed categories for the fullName
  *
  * @param $partnerId
  * @param $fullName
  * @return category
  */
 public static function createByPartnerAndFullName($partnerId, $fullName)
 {
     $fullNameArray = explode(categoryPeer::CATEGORY_SEPARATOR, $fullName);
     $fullNameTemp = "";
     $parentId = 0;
     foreach ($fullNameArray as $name) {
         if ($fullNameTemp === "") {
             $fullNameTemp .= $name;
         } else {
             $fullNameTemp .= categoryPeer::CATEGORY_SEPARATOR . $name;
         }
         $category = categoryPeer::getByFullNameExactMatch($fullNameTemp);
         if (!$category) {
             $category = new category();
             $category->setPartnerId($partnerId);
             $category->setParentId($parentId);
             $category->setName($name);
             $category->save();
         }
         $parentId = $category->getId();
     }
     return $category;
 }
开发者ID:dozernz,项目名称:server,代码行数:30,代码来源:category.php

示例8: setcategory

 /**
  * Declares an association between this object and a category object.
  *
  * @param      category $v
  * @return     categoryKuser The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setcategory(category $v = null)
 {
     if ($v === null) {
         $this->setCategoryId(NULL);
     } else {
         $this->setCategoryId($v->getId());
     }
     $this->acategory = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the category object, it will not be re-added.
     if ($v !== null) {
         $v->addcategoryKuser($this);
     }
     return $this;
 }
开发者ID:DBezemer,项目名称:server,代码行数:22,代码来源:BasecategoryKuser.php

示例9: handleCoreException

 private function handleCoreException(kCoreException $ex, category $categoryDb, KalturaCategory $category)
 {
     switch ($ex->getCode()) {
         case kCoreException::DUPLICATE_CATEGORY:
             throw new KalturaAPIException(KalturaErrors::DUPLICATE_CATEGORY, $categoryDb->getFullName());
         case kCoreException::PARENT_ID_IS_CHILD:
             throw new KalturaAPIException(KalturaErrors::PARENT_CATEGORY_IS_CHILD, $category->parentId, $categoryDb->getId());
         default:
             throw $ex;
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:11,代码来源:CategoryService.php

示例10: setEntryOnCategory

 private function setEntryOnCategory(category $category, $entry = null)
 {
     if (is_null($this->entryCategoriesAddedIds)) {
         $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();
             }
         }
         $categoriesAdded = categoryPeer::retrieveByPKs($categoriesIds);
         $entryCategoriesAddedIds = array();
         foreach ($categoriesAdded as $categoryAdded) {
             $fullIds = explode(categoryPeer::CATEGORY_SEPARATOR, $categoryAdded->getFullIds());
             $entryCategoriesAddedIds = array_merge($entryCategoriesAddedIds, $fullIds);
         }
         $this->entryCategoriesAddedIds = $entryCategoriesAddedIds;
     }
     $category->incrementEntriesCount(1, $this->entryCategoriesAddedIds);
     $category->incrementDirectEntriesCount();
     //if was pending - decrease pending entries count!
     if ($this->getColumnsOldValue(categoryEntryPeer::STATUS) == CategoryEntryStatus::PENDING) {
         $category->decrementPendingEntriesCount();
     }
     $category->save();
     //only categories with no context are saved on entry - this is only for Backward compatible
     if ($entry && !categoryEntryPeer::getSkipSave() && (trim($category->getPrivacyContexts()) == '' || $category->getPrivacyContexts() == null)) {
         $categories = array();
         if (trim($entry->getCategories()) != '') {
             $categories = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getCategories());
         }
         $categories[] = $category->getFullName();
         $categoriesIds = array();
         if (trim($entry->getCategoriesIds()) != '') {
             $categoriesIds = explode(entry::ENTRY_CATEGORY_SEPARATOR, $entry->getCategoriesIds());
         }
         $categoriesIds[] = $category->getId();
         $entry->parentSetCategories(implode(entry::ENTRY_CATEGORY_SEPARATOR, $categories));
         $entry->parentSetCategoriesIds(implode(entry::ENTRY_CATEGORY_SEPARATOR, $categoriesIds));
         $entry->justSave();
     }
     return $entry;
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:44,代码来源:categoryEntry.php

示例11: getCategoryMrssXml

 /**
  * Function calculates and returns the MRSS XML of a category
  * @param category $category
  * @param SimpleXMLElement $mrss
  * @param kMrssParameters $mrssParams
  * @param string $features
  * @return SimpleXMLElement
  */
 public static function getCategoryMrssXml(category $category, SimpleXMLElement $mrss = null, kMrssParameters $mrssParams = null, $features = null)
 {
     $instanceKey = self::generateInstanceKey($category->getId(), $mrssParams, $features);
     if (is_null($mrss)) {
         $mrss = self::getInstanceFromPool($instanceKey);
         if ($mrss) {
             return $mrss;
         }
         $mrss = new SimpleXMLElement('<item/>');
     }
     if (!$features || in_array(ObjectFeatureType::METADATA, $features)) {
         $mrss->addChild("id", $category->getId());
         $mrss->addChild("name", $category->getName());
         $mrss->addChild("referenceId", $category->getReferenceId());
         $mrss->addChild("fullName", $category->getFullName());
     }
     $mrssContributors = self::getMrssContributors();
     if (count($mrssContributors)) {
         foreach ($mrssContributors as $mrssContributor) {
             /* @var $mrssContributor IKalturaMrssContributor */
             try {
                 if (!$features || in_array($mrssContributor->getObjectFeatureType(), $features)) {
                     $mrssContributor->contribute($category, $mrss, $mrssParams);
                 }
             } catch (kCoreException $ex) {
                 KalturaLog::err("Unable to add MRSS element for contributor [" . get_class($mrssContributor) . "] message [" . $ex->getMessage() . "]");
             }
         }
     }
     if ($features && in_array(ObjectFeatureType::ANCESTOR_RECURSIVE, $features)) {
         $ancestorIds = explode(">", $category->getFullIds());
         $ancestorCategories = categoryPeer::retrieveByPKs($ancestorIds);
         array_pop($ancestorCategories);
         //find and delete the ANCESTOR_RECURSIVE from the features array
         for ($i = 0; $i < count($features); $i++) {
             if ($features[$i] == ObjectFeatureType::ANCESTOR_RECURSIVE) {
                 unset($features[$i]);
             }
         }
         //retrieve mrss for each ancestor category
         $parentCategories = $mrss->addChild('parent_categories');
         foreach ($ancestorCategories as $ancestorCategory) {
             $ancestorMrss = $parentCategories->addChild('category_item');
             $ancestorMrss = self::getCategoryMrssXml($ancestorCategory, $ancestorMrss, $mrssParams, $features);
         }
     }
     if ($mrssParams && $mrssParams->getItemXpathsToExtend()) {
         self::addExtendingItemsToMrss($mrss, $mrssParams);
     }
     self::addInstanceToPool($instanceKey, $mrss);
     return $mrss;
 }
开发者ID:DBezemer,项目名称:server,代码行数:60,代码来源:kMrssManager.php

示例12: handleCoreException

 private function handleCoreException(kCoreException $ex, category $categoryDb, KalturaCategory $category)
 {
     switch ($ex->getCode()) {
         case kCoreException::DUPLICATE_CATEGORY:
             throw new KalturaAPIException(KalturaErrors::DUPLICATE_CATEGORY, $categoryDb->getFullName());
         case kCoreException::PARENT_ID_IS_CHILD:
             throw new KalturaAPIException(KalturaErrors::PARENT_CATEGORY_IS_CHILD, $category->parentId, $categoryDb->getId());
         case kCoreException::DISABLE_CATEGORY_LIMIT_MULTI_PRIVACY_CONTEXT_FORBIDDEN:
             throw new KalturaAPIException(KalturaErrors::CANNOT_SET_MULTI_PRIVACY_CONTEXT);
         default:
             throw $ex;
     }
 }
开发者ID:dozernz,项目名称:server,代码行数:13,代码来源:CategoryService.php

示例13: countByCategory

 /**
  * Count by category
  * @return int
  */
 public function countByCategory(category $category, $letter = NULL)
 {
     try {
         $query = array('SELECT COUNT(*) FROM [:prefix:products] AS [products]');
         if ($letter !== NULL) {
             $query[] = 'LEFT JOIN [:prefix:pages] AS [pages] ON [pages].[ref_id] = [products].[id] AND [pages].[ref_type] = %s';
             $query[] = pages::PRODUCT;
         }
         $query[] = 'LEFT JOIN [:prefix:categories] AS [categories] ON [products].[category_id] = [categories].[id]';
         $query[] = 'WHERE [categories].[id] = %i';
         $query[] = $category->getId();
         if ($letter !== NULL) {
             $query = array_merge($query, (array) 'AND', $this->whereLetter($letter));
         }
         return dibi::query($query)->fetchSingle();
     } catch (Exception $e) {
         return NULL;
     }
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:23,代码来源:products.php


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