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


PHP Doctrine_Query::addWhere方法代码示例

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


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

示例1: addIsPublishedColumnQuery

 protected function addIsPublishedColumnQuery(Doctrine_Query $query, $field, $values)
 {
     if ($values) {
         $query->addWhere('r.date_published < NOW()');
     } else {
         $query->addWhere('r.date_published >= NOW() OR r.date_published IS NULL');
     }
 }
开发者ID:sympal,项目名称:sympal,代码行数:8,代码来源:sfSympalAdminGenContentSearchForm.class.php

示例2: buildQuery

 function buildQuery(Doctrine_Query $query)
 {
     $query->leftJoin('swBlogPost.Translation');
     $query->leftJoin('swBlogPost.swBlogPostTags t');
     $query->leftJoin('t.Translation tt');
     if (strlen($this->getValue('tag')) > 0) {
         $query->addWhere('tt.name = ? and tt.lang = ?', array($this->getValue('tag'), sfContext::getInstance()->getUser()->getCulture()));
     }
     if (!is_null($this->getValue('published'))) {
         $query->addWhere('swBlogPost.published = ?', $this->getValue('published'));
     }
     $query->orderBy('created_at DESC');
     return $query;
 }
开发者ID:rande,项目名称:swBlogPlugin,代码行数:14,代码来源:baseSwBlogPostsDatagrid.class.php

示例3: addNameColumnQuery

 protected function addNameColumnQuery(Doctrine_Query $query, $value)
 {
     if (!empty($value)) {
         if (is_array($value)) {
             foreach ($value as $v) {
                 $query->addWhere('name LIKE ?', '%' . $v . '%');
             }
         } else {
             if (!empty($value)) {
                 $query->addWhere('name LIKE ?', '%' . $values . '%');
             }
         }
     }
 }
开发者ID:phenom,项目名称:OpenPNE3,代码行数:14,代码来源:opMemberProfileSearchForm.class.php

示例4: getSetting

 /**
  * getSetting
  * pulls the sfSetting object for a given setting
  * 
  * @param string $setting 
  * @static
  * @access public
  * @return object sfSetting
  */
 static function getSetting($setting)
 {
     if (!is_string($setting) || empty($setting)) {
         return 0;
     }
     // If all the settings have been requested, there's no need to check for
     // individuals. This avoids additional queries later on.
     if (sfContext::getInstance()->getRequest()->hasAttribute('AllsfSettings')) {
         $settings = sfContext::getInstance()->getRequest()->getAttribute('AllsfSettings');
     } else {
         $settings = sfContext::getInstance()->getRequest()->getAttribute('sfSettings');
     }
     if (isset($settings[$setting])) {
         $obj = $settings[$setting];
         return $obj;
     } else {
         // Setting was not pre-loaded via ->load() but we'll be nice and retrieve
         // the setting anyhow:
         $query = new Doctrine_Query();
         $query->addSelect("s.*");
         $query->addFrom("sfSetting s");
         $query->addWhere("s.name = :name", array(":name" => $setting));
         if ($obj = $query->limit(1)->execute()->getFirst()) {
             // Store this setting in memory for later retrieval to avoid a second
             // query for the same setting:
             $settings[$obj->getName()] = $obj;
             sfContext::getInstance()->getRequest()->setAttribute('sfSettings', $settings);
             // return it:
             return $obj;
         } else {
             return 0;
         }
     }
 }
开发者ID:bshaffer,项目名称:Symplist,代码行数:43,代码来源:BasesfSettings.class.php

示例5: hookWhere

 /**
  * hookWhere
  * builds DQL query where part from given parameter array
  *
  * @param array $params         an associative array containing field
  *                              names and their values
  * @return boolean              whether or not the hooking was
  */
 public function hookWhere($params)
 {
     if (!is_array($params)) {
         return false;
     }
     foreach ($params as $name => $value) {
         if ($value === '' || $value === '-') {
             continue;
         }
         $e = explode('.', $name);
         if (count($e) == 2) {
             list($alias, $column) = $e;
             $map = $this->query->getAliasDeclaration($alias);
             $table = $map['table'];
             if (!$table) {
                 throw new Doctrine_Exception('Unknown alias ' . $alias);
             }
             if ($def = $table->getDefinitionOf($column)) {
                 $def[0] = gettype($value);
                 if (isset($this->typeParsers[$def[0]])) {
                     $name = $this->typeParsers[$def[0]];
                     $parser = new $name();
                 }
                 $parser->parse($alias, $column, $value);
                 $this->query->addWhere($parser->getCondition(), $parser->getParams());
             }
         }
     }
     return true;
 }
开发者ID:darkcolonist,项目名称:kohana234-doctrine115,代码行数:38,代码来源:Hook.php

示例6: addUpcoming

 public function addUpcoming(Doctrine_Query $q, $limit = null)
 {
     $q->orderBy('start_date');
     $q->addWhere('DATE(start_date) >= DATE(NOW())');
     if (!is_null($limit)) {
         $q->limit($limit);
     }
 }
开发者ID:quafzi,项目名称:timpany-prototype,代码行数:8,代码来源:PluginaEventTable.class.php

示例7: addNameColumnQuery

 protected function addNameColumnQuery(Doctrine_Query $query, $field, $values)
 {
     $fieldName = $this->getFieldName($field);
     if (is_array($values)) {
         foreach ($values as $value) {
             $query->addWhere('r.' . $fieldName . ' LIKE ?', '%' . $value . '%');
         }
     }
 }
开发者ID:niryuu,项目名称:OpenPNE3,代码行数:9,代码来源:CommunityFormFilter.class.php

示例8: filterScope

 /**
  *
  * @param Doctrine_Query $query
  * @param sfUser $user
  * @param type $alias
  * @return Doctrine_Query
  */
 public function filterScope(Doctrine_Query $query, sfUser $user, $alias = 'l')
 {
     $where = "{$alias}.location_scope_id = 5";
     if (!$user->isAnonymous()) {
         $uniq = self::$uniq++;
         $where .= "\r\n                    or {$alias}.location_scope_id = 1\r\n                    or {$alias}.location_scope_id = 3\r\n                    or {$alias}.created_by = " . $user->getProfile()->id . "\r\n                    or {$alias}.created_by in (SELECT fa{$uniq}.accepter_id FROM friend fa{$uniq} WHERE fa{$uniq}.accepted = 1 and fa{$uniq}.requester_id = " . $user->getProfile()->id . ")\r\n                    or {$alias}.created_by in (SELECT fr{$uniq}.requester_id FROM friend fr{$uniq} WHERE fr{$uniq}.accepted = 1 and fr{$uniq}.accepter_id = " . $user->getProfile()->id . ")";
     }
     $query->addWhere($where);
     return $query;
 }
开发者ID:limitium,项目名称:uberlov,代码行数:17,代码来源:LocationTable.class.php

示例9: addUsernameColumnQuery

 /**
  * DOCUMENT ME
  * @param Doctrine_Query $query
  * @param mixed $field
  * @param mixed $value
  * @return mixed
  */
 public function addUsernameColumnQuery(Doctrine_Query $query, $field, $value)
 {
     // You get an associative array with an sfWidgetFormFilterInput
     if (!isset($value['text']) || !strlen($value['text'])) {
         return;
     }
     $like = '%' . $value['text'] . '%';
     $r = $query->getRootAlias();
     $query->addWhere("({$r}.username LIKE ?) OR concat({$r}.first_name, {$r}.last_name) LIKE ?", array($like, $like));
 }
开发者ID:hashir,项目名称:UoA,代码行数:17,代码来源:BaseaUserAdminFilter.class.php

示例10: withOwnerCheck

 /**
  * Проверить, что выборка принадлежит текущему авторизованному пользователю
  *
  * @param  Doctrine_Query $q
  * @param  string         $ownerColumn
  * @return Doctrine_Query
  */
 public function withOwnerCheck(Doctrine_Query $q, $ownerColumn = 'user_id')
 {
     $user = sfContext::getInstance()->getUser();
     if ($user->isAuthenticated()) {
         $userId = $user->getGuardUser()->getId();
     } else {
         $userId = 0;
     }
     $rootAlias = $q->getRootAlias();
     $q->addWhere("{$rootAlias}.{$ownerColumn} = ?", $userId);
     return $q;
 }
开发者ID:pycmam,项目名称:neskuchaik.ru,代码行数:19,代码来源:myBaseTable.php

示例11: fetchDetail

 /**
  * Get a record detail based the current query
  *
  * <code>
  * $where = array(
  *     array('columnName' => 'searchValue')
  * )
  * </code>
  *
  * @param array $where
  * @return array
  */
 public function fetchDetail(array $where)
 {
     /**
      * Remove these since we are trying to retrieve
      * a specific row
      */
     $this->_query->removeDqlQueryPart('limit')->removeDqlQueryPart('offset');
     foreach ($where as $column => $value) {
         $this->_query->addWhere($column . ' = ?', $value);
     }
     return $this->execute();
 }
开发者ID:robjacoby,项目名称:xlr8u,代码行数:24,代码来源:Doctrine.php

示例12: buildQuery

 function buildQuery(Doctrine_Query $query)
 {
     $query->orderBy('swBlogComment.created_at ASC');
     $query->leftJoin('swBlogComment.swBlogPost');
     if ($this->getValue('moderated') == -2) {
         $query->whereIn('swBlogComment.moderated', array(swBlogComment::MODERATED_NONE, swBlogComment::MODERATED_OK));
     }
     if ($this->getValue('moderated') == -1) {
         $query->whereIn('swBlogComment.moderated', array(swBlogComment::MODERATED_NONE));
     }
     if ($this->getValue('moderated') == -3) {
         $query->whereIn('swBlogComment.moderated', array(swBlogComment::MODERATED_KO, swBlogComment::MODERATED_OK));
     }
     if ($this->getValue('moderated') == 1) {
         $query->whereIn('swBlogComment.moderated', array(swBlogComment::MODERATED_OK));
     }
     if ($this->getValue('moderated') === 0) {
         $query->whereIn('swBlogComment.moderated', array(swBlogComment::MODERATED_KO));
     }
     if (is_numeric($this->getValue('post_id'))) {
         $query->addWhere('swBlogComment.post_id = ?', $this->getValue('post_id'));
     }
     return $query;
 }
开发者ID:rande,项目名称:swBlogPlugin,代码行数:24,代码来源:baseSwBlogCommentsDatagrid.class.php

示例13: query_may_write

 /**
  * Write - owner
  *
  * @param Doctrine_Query $q
  * @param User $u
  * @param string $alias (optional)
  */
 public static function query_may_write($q, $u, $alias = null)
 {
     if ($u->is_system()) {
         return;
     }
     $a = $alias ? "{$alias}." : "";
     $q->addWhere("{$a}bin_user_id = ?", $u->user_id);
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:15,代码来源:Bin.php

示例14: addBooleanQuery

 protected function addBooleanQuery(Doctrine_Query $query, $field, $value)
 {
     $fieldName = $this->getFieldName($field);
     $query->addWhere(sprintf('%s.%s = ?', $this->getRootAlias($query, $fieldName), $fieldName), $value);
 }
开发者ID:rafaelgou,项目名称:diem,代码行数:5,代码来源:dmFormFilterDoctrine.php

示例15: modifyImpl

 /**
  * @access private
  *
  * @author Jannis Moßhammer <jannis.mosshammer@netways.de>
  **/
 protected function modifyImpl(Doctrine_Query &$o)
 {
     $o->setAliasDefs($this->mainAlias, $this->aliasDefs);
     $o->setDefaultJoinType($this->defaultJoinType);
     foreach ($this->fields as $field) {
         $o->addSelect($field);
     }
     $o->distinct($this->isDistinct());
     $o->from($this->target . " " . $this->mainAlias);
     foreach ($this->staticWhereConditions as $cond) {
         if (isset($cond[1]) && $cond[1] != null) {
             $o->addWhere($cond[0], $cond[1]);
         } else {
             $o->addWhere($cond[0]);
         }
     }
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:22,代码来源:IcingaStoreTargetModifierModel.class.php


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