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


PHP TagPeer::doSelectStmt方法代码示例

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


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

示例1: 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(TagPeer::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.
     $stmt = TagPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
     $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->collTaggings = null;
         $this->lastTaggingCriteria = null;
     }
     // if (deep)
 }
开发者ID:adatta02,项目名称:comp190-code,代码行数:38,代码来源:BaseTag.php

示例2: postSave

 /**
  * Tags saving logic, runned after the object himself has been saved
  *
  * @param      BaseObject  $object
  */
 public function postSave(BaseObject $object)
 {
     $tags = self::get_tags($object);
     $removed_tags = self::get_removed_tags($object);
     // read some config parameters and defaults
     $anonymous_tagging = sfConfig::get(sprintf('propel_behavior_deppPropelActAsTaggableBehavior_%s_anonymous_tagging', get_class($object)), sfConfig::get('app_deppPropelActAsTaggableBehaviorPlugin_anonymous_tagging', true));
     $allows_tagging_removal = sfConfig::get(sprintf('propel_behavior_deppPropelActAsTaggableBehavior_%s_allows_tagging_removal', get_class($object)), sfConfig::get('app_deppPropelActAsTaggableBehaviorPlugin_allows_tagging_removal', 'all'));
     $tagging_removal_credentials = sfConfig::get(sprintf('propel_behavior_deppPropelActAsTaggableBehavior_%s_tagging_removal_credentials', get_class($object)), sfConfig::get('app_deppPropelActAsTaggableBehaviorPlugin_tagging_removal_credentials', array()));
     $use_unique_triple_values = sfConfig::get(sprintf('propel_behavior_deppPropelActAsTaggableBehavior_%s_use_unique_triple_values', get_class($object)), sfConfig::get('app_deppPropelActAsTaggableBehaviorPlugin_use_unique_triple_values', false));
     $user = @sfContext::getInstance()->getUser();
     // save new tags
     foreach ($tags as $tagname) {
         if ($use_unique_triple_values) {
             $tag = TagPeer::retrieveOrCreateByTripleValue($tagname);
         } else {
             $tag = TagPeer::retrieveOrCreateByTagName($tagname);
         }
         $tag->save();
         $tagging = TaggingPeer::retrieveOrCreateByTagAndTaggable($tag->getId(), $object->getPrimaryKey(), get_class($object));
         $user_id = deppPropelActAsTaggableToolkit::getUserId();
         if (!$anonymous_tagging && $user->isAuthenticated() && !is_null($user_id) && $user_id != '') {
             if ($tagging->isNew()) {
                 $tagging->setUserId($user_id);
             }
         }
         $tagging->save();
     }
     // remove removed tags
     $removed_tag_ids = array();
     $c = new Criteria();
     $c->add(TagPeer::NAME, $removed_tags, Criteria::IN);
     if (Propel::VERSION >= '1.3') {
         $rs = TagPeer::doSelectStmt($c);
         while ($row = $rs->fetch(PDO::FETCH_ASSOC)) {
             $removed_tag_ids[] = intval($row['ID']);
         }
     } else {
         $rs = TagPeer::doSelectRS($c);
         while ($rs->next()) {
             $removed_tag_ids[] = $rs->getInt(1);
         }
     }
     $c = new Criteria();
     $c->add(TaggingPeer::TAG_ID, $removed_tag_ids, Criteria::IN);
     $c->add(TaggingPeer::TAGGABLE_ID, $object->getPrimaryKey());
     $c->add(TaggingPeer::TAGGABLE_MODEL, get_class($object));
     $user_id = deppPropelActAsTaggableToolkit::getUserId();
     // for authenticated users that do not have tagging_removal_credentials
     // if the only tags they're allowed to remove are their own
     // then, remove only those tags
     // this only works, if anonymnous_tagging is set to false
     if (!$anonymous_tagging && $user->isAuthenticated() && !is_null($user_id) && $user_id != '' && $allows_tagging_removal == 'self' && !$user->hasCredential($tagging_removal_credentials, false)) {
         $c->add(TaggingPeer::USER_ID, $user_id);
     }
     // delete e non doDelete, in modo che anche sul tagging si possano attivare i behavior (per le news)
     // TaggingPeer::doDelete($c);
     $tags_to_delete = TaggingPeer::doSelect($c);
     foreach ($tags_to_delete as $tag_to_delete) {
         $tag_to_delete->delete();
     }
     $tags = array_merge(self::get_tags($object), $this->getSavedTags($object));
     self::set_saved_tags($object, $tags);
     self::clear_tags($object);
     self::clear_removed_tags($object);
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:70,代码来源:deppPropelActAsTaggableBehavior.class.php

示例3: getAllWithCount

 /**
  * Returns all tags, sorted by name, with their number of occurencies.
  * The first optionnal parameter permits to add some restrictions on the
  * objects the selected tags are related to.
  * The second optionnal parameter permits to restrict the tag selection with
  * different criterias
  *
  * @param      Criteria    $c
  * @param      array       $options
  * @return     array
  */
 public static function getAllWithCount(Criteria $c = null, $options = array())
 {
     $tags = array();
     if (null === $c) {
         $c = new Criteria();
     }
     if (isset($options['limit'])) {
         $c->setLimit($options['limit']);
     }
     if (isset($options['model'])) {
         $c->add(TaggingPeer::TAGGABLE_MODEL, $options['model']);
     }
     if (isset($options['like'])) {
         $c->add(TagPeer::NAME, $options['like'], Criteria::LIKE);
     }
     if (isset($options['triple'])) {
         $c->add(TagPeer::IS_TRIPLE, $options['triple']);
     }
     if (isset($options['namespace'])) {
         $c->add(TagPeer::TRIPLE_NAMESPACE, $options['namespace']);
     }
     if (isset($options['key'])) {
         $c->add(TagPeer::TRIPLE_KEY, $options['key']);
     }
     if (isset($options['value'])) {
         $c->add(TagPeer::TRIPLE_VALUE, $options['value']);
     }
     $c->addSelectColumn(TagPeer::NAME);
     $c->addSelectColumn('COUNT(' . TagPeer::NAME . ') as counter');
     $c->addJoin(TagPeer::ID, TaggingPeer::TAG_ID);
     $c->addGroupByColumn(TaggingPeer::TAG_ID);
     $c->addDescendingOrderByColumn('counter');
     $c->addAscendingOrderByColumn(TagPeer::NAME);
     if (Propel::VERSION >= '1.3') {
         $rs = TagPeer::doSelectStmt($c);
         while ($row = $rs->fetch(PDO::FETCH_NUM)) {
             $tags[$row[0]] = $row[1];
         }
     } else {
         $rs = TagPeer::doSelectRS($c);
         while ($rs->next()) {
             $tags[$rs->getString(1)] = $rs->getInt(2);
         }
     }
     if (!isset($options['sort_by_popularity']) || true !== $options['sort_by_popularity']) {
         ksort($tags);
     }
     return $tags;
 }
开发者ID:adatta02,项目名称:comp190-code,代码行数:60,代码来源:TagPeer.php

示例4: postSave

 /**
  * Tags saving logic, runned after the object himself has been saved
  *
  * @param      BaseObject  $object
  */
 public function postSave(BaseObject $object)
 {
     $tags = self::get_tags($object);
     $removed_tags = self::get_removed_tags($object);
     // save new tags
     foreach ($tags as $tagname) {
         $tag = TagPeer::retrieveOrCreateByTagName($tagname);
         $tag->save();
         $tagging = new Tagging();
         $tagging->setTagId($tag->getId());
         $tagging->setTaggableId($object->getPrimaryKey());
         $tagging->setTaggableModel(get_class($object));
         $tagging->save();
     }
     // remove removed tags
     $removed_tag_ids = array();
     $c = new Criteria();
     $c->add(TagPeer::NAME, $removed_tags, Criteria::IN);
     if (Propel::VERSION >= '1.3') {
         $rs = TagPeer::doSelectStmt($c);
         while ($row = $rs->fetch(PDO::FETCH_ASSOC)) {
             $removed_tag_ids[] = intval($row['ID']);
         }
     } else {
         $rs = TagPeer::doSelectRS($c);
         while ($rs->next()) {
             $removed_tag_ids[] = $rs->getInt(1);
         }
     }
     $c = new Criteria();
     $c->add(TaggingPeer::TAG_ID, $removed_tag_ids, Criteria::IN);
     $c->add(TaggingPeer::TAGGABLE_ID, $object->getPrimaryKey());
     $c->add(TaggingPeer::TAGGABLE_MODEL, get_class($object));
     TaggingPeer::doDelete($c);
     $tags = array_merge(self::get_tags($object), $this->getSavedTags($object));
     self::set_saved_tags($object, $tags);
     self::clear_tags($object);
     self::clear_removed_tags($object);
 }
开发者ID:adatta02,项目名称:comp190-code,代码行数:44,代码来源:sfPropelActAsTaggableBehavior.class.php

示例5: doSelect

 /**
  * Selects several row from the DB.
  *
  * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
  * @param      PropelPDO $con
  * @return array           Array of selected Objects
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelect(Criteria $criteria, PropelPDO $con = null)
 {
     return TagPeer::populateObjects(TagPeer::doSelectStmt($criteria, $con));
 }
开发者ID:rapila,项目名称:cms-base,代码行数:13,代码来源:BaseTagPeer.php

示例6: getAllWithCount

 /**
  * Returns all tags, sorted by name, with their number of occurencies.
  * The first optionnal parameter permits to add some restrictions on the
  * objects the selected tags are related to.
  * The second optionnal parameter permits to restrict the tag selection with
  * different criterias
  *
  * @param      Criteria    $c
  * @param      array       $options
  * @return     array
  */
 public static function getAllWithCount(Criteria $c = null, $options = array())
 {
     $tags = array();
     if (null === $c) {
         $c = new Criteria();
     }
     if (isset($options['limit'])) {
         $c->setLimit($options['limit']);
     }
     if (isset($options['model'])) {
         $c->add(TaggingPeer::TAGGABLE_MODEL, $options['model']);
     }
     if (isset($options['like'])) {
         $c->add(TagPeer::NAME, $options['like'], Criteria::LIKE);
     }
     if (isset($options['triple'])) {
         $c->add(TagPeer::IS_TRIPLE, $options['triple']);
     }
     if (isset($options['namespace'])) {
         $c->add(TagPeer::TRIPLE_NAMESPACE, $options['namespace']);
     }
     if (isset($options['key'])) {
         $c->add(TagPeer::TRIPLE_KEY, $options['key']);
     }
     if (isset($options['value'])) {
         $c->add(TagPeer::TRIPLE_VALUE, $options['value']);
     }
     $c->addSelectColumn(TagPeer::NAME);
     $c->addSelectColumn('COUNT(' . TagPeer::NAME . ') as counter');
     $c->addJoin(TagPeer::ID, TaggingPeer::TAG_ID, Criteria::RIGHT_JOIN);
     $c->addGroupByColumn(TaggingPeer::TAG_ID);
     if (isset($options['sort_by_popularity'])) {
         $c->addDescendingOrderByColumn('counter');
     } else {
         $c->addAscendingOrderByColumn(TagPeer::TRIPLE_VALUE);
     }
     if (Propel::VERSION >= '1.3') {
         $rs = TagPeer::doSelectStmt($c);
         while ($row = $rs->fetch(PDO::FETCH_NUM)) {
             $tags[$row[0]] = $row[1];
         }
     } else {
         $rs = TagPeer::doSelectRS($c);
         while ($rs->next()) {
             $tags[$rs->getString(1)] = $rs->getInt(2);
         }
     }
     /* 
      * questo ordinava per la chiave (NAME) e quindi in modo errato
      * ora il comportamento di default è di ordinare per NAME
      * mentre se si vuole l'ordinamento per popolarità va specificato nelle options
      * come prima
     if (!isset($options['sort_by_popularity']) || (true !== $options['sort_by_popularity']))
     {
       ksort($tags);
     }
     */
     return $tags;
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:70,代码来源:TagPeer.php


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