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


PHP QueryBuilder::andWhere方法代码示例

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


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

示例1: finalizeQuery

 public function finalizeQuery(\Doctrine\DBAL\Query\QueryBuilder $query)
 {
     $paramcount = 0;
     if (isset($this->gID) && $this->gID > 0) {
         $query->where('gID = ?')->setParameter($paramcount++, $this->gID);
     }
     switch ($this->sortBy) {
         case "alpha":
             $query->orderBy('pName', 'ASC');
             break;
         case "date":
             $query->orderBy('pDateAdded', 'DESC');
             break;
     }
     switch ($this->featured) {
         case "featured":
             $query->andWhere("pFeatured = 1");
             break;
         case "nonfeatured":
             $query->andWhere("pFeatured = 0");
             break;
     }
     if ($this->activeOnly) {
         $query->andWhere("pActive = 1");
     }
     if ($this->search) {
         $query->andWhere('pName like ?')->setParameter($paramcount++, '%' . $this->search . '%');
     }
     return $query;
 }
开发者ID:Rgeelen,项目名称:vivid_store,代码行数:30,代码来源:ProductList.php

示例2: apply

 /**
  * {@inheritdoc}
  */
 public function apply($fromAlias, $fromIdentifier, $resourcePrefix, array $requesterIdentifiers, $mask, array $orX = [])
 {
     $this->queryBuilder->leftJoin($fromAlias, $this->getAclSchema()->getPermissionsTableName(), 'acl_p', 'acl_p.resource = ' . $this->connection->getDatabasePlatform()->getConcatExpression(':acl_prefix', $fromAlias . '.' . $fromIdentifier));
     $orX[] = 'acl_p.requester IN (:acl_identifiers) AND :acl_mask = (acl_p.mask & :acl_mask)';
     $this->queryBuilder->andWhere(implode(' OR ', $orX));
     $this->queryBuilder->setParameter('acl_prefix', $resourcePrefix, \PDO::PARAM_STR)->setParameter('acl_identifiers', $requesterIdentifiers, Connection::PARAM_STR_ARRAY)->setParameter('acl_mask', $mask, \PDO::PARAM_INT);
     return $this->queryBuilder;
 }
开发者ID:alexdpy,项目名称:acl,代码行数:11,代码来源:DoctrineDbalAclFilter.php

示例3: filter

 /**
  * @deprecated
  */
 public function filter($field, $value, $comparison = '=')
 {
     if ($field == false) {
         $this->query->andWhere($value);
         // ugh
     } else {
         $this->query->andWhere(implode(' ', array($field, $comparison, $this->query->createNamedParameter($value))));
     }
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:12,代码来源:ItemList.php

示例4: finalizeQuery

 public function finalizeQuery(\Doctrine\DBAL\Query\QueryBuilder $query)
 {
     if (!$this->includeInactiveUsers) {
         $query->andWhere('u.uIsActive = :uIsActive');
         $query->setParameter('uIsActive', true);
     }
     if (!$this->includeUnvalidatedUsers) {
         $query->andWhere('u.uIsValidated != 0');
     }
     return $query;
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:11,代码来源:UserList.php

示例5: restrict

 /**
  * {@inheritdoc}
  */
 public function restrict($expression, $condition = DataSourceInterface::CONDITION_AND)
 {
     switch ($condition) {
         case DataSourceInterface::CONDITION_AND:
             $this->queryBuilder->andWhere($expression);
             break;
         case DataSourceInterface::CONDITION_OR:
             $this->queryBuilder->orWhere($expression);
             break;
     }
 }
开发者ID:sylius,项目名称:sylius,代码行数:14,代码来源:DataSource.php

示例6: buildQuery

 /**
  * {@inheritdoc}
  */
 public function buildQuery(QueryBuilder $queryBuilder, array $values = array())
 {
     if (!array_key_exists('salary', $values)) {
         return;
     }
     //Switch min and max salary if user has inverted the fields
     if (isset($values['salary']['min']) && isset($values['salary']['max']) && $values['salary']['max'] < $values['salary']['min']) {
         list($values['salary']['min'], $values['salary']['max']) = [$values['salary']['max'], $values['salary']['min']];
     }
     if (isset($values['salary']['min'])) {
         $queryBuilder->andWhere('response.grossAnnualSalary >= :minSalary')->setParameter('minSalary', $values['salary']['min']);
     }
     if (isset($values['salary']['max'])) {
         $queryBuilder->andWhere('response.grossAnnualSalary <= :maxSalary')->setParameter('maxSalary', $values['salary']['max']);
     }
 }
开发者ID:Volyz,项目名称:barometre,代码行数:19,代码来源:SalaryFilter.php

示例7: incorporateDbalQueryBuilder

 /**
  * @internal
  */
 private function incorporateDbalQueryBuilder(QueryBuilder $qb, FilterInterface $filter)
 {
     $criteria = $this->getFilteringCriteria($filter);
     // extraindo os rootAliases, pois o DBAL\QueryBuilder não tem
     $fromPart = $qb->getQueryPart('from');
     $rootAliases = array();
     foreach ($fromPart as $part) {
         $rootAliases[] = $part['alias'];
     }
     $visitor = new DbalQueryExpressionVisitor($qb->getConnection(), $rootAliases, $this->fieldMap);
     if ($whereExpression = $criteria->getWhereExpression()) {
         $qb->andWhere($visitor->dispatch($whereExpression));
         $qb->setParameters($visitor->getParameters());
     }
     if ($criteria->getOrderings()) {
         foreach ($criteria->getOrderings() as $sort => $order) {
             $qb->addOrderBy($visitor->getFieldName($sort), $order);
         }
     }
     if (($firstResult = $criteria->getFirstResult()) !== null) {
         $qb->setFirstResult($firstResult);
     }
     if (($maxResults = $criteria->getMaxResults()) !== null) {
         $qb->setMaxResults($maxResults);
     }
 }
开发者ID:brodaproject,项目名称:broda,代码行数:29,代码来源:DbalQueryBuilderIncorporator.php

示例8: match

 public function match(QueryBuilder $qb)
 {
     if ($this->has('username')) {
         $qb->andWhere('u.username = :username');
         $qb->setParameter('username', $this->get('username'));
     }
 }
开发者ID:comphppuebla,项目名称:restful-extensions,代码行数:7,代码来源:FilterByUsernameSpecification.php

示例9: where

 public function where($column, $operator = null, $value = null, $boolean = 'and')
 {
     $args = func_get_args();
     if (count($args) == 1) {
         parent::where($args[0]);
         return $this;
     }
     $column = $args[0];
     $boolean = 'and';
     $operator = '=';
     if (count($args) == 2) {
         $value = $args[1];
     }
     if (count($args) == 3) {
         $operator = $args[1];
         $value = $args[2];
     }
     if (count($args) == 4) {
         $operator = $args[1];
         $value = $args[2];
         $boolean = $args[3];
     }
     if (is_array($value)) {
         $operator = $operator == '=' ? 'in' : 'notIn';
         $where_clause = $this->expr()->{$operator}($column, parent::createNamedParameter($value, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY));
     } else {
         $where_clause = $column . $operator . parent::createNamedParameter($value);
     }
     if ($boolean == 'and') {
         parent::andWhere($where_clause);
     } elseif ($boolean == 'or') {
         parent::orWhere($where_clause);
     }
     return $this;
 }
开发者ID:arduanov,项目名称:pimple-active-record,代码行数:35,代码来源:QueryBuilder.php

示例10: filters

 /**
  * @param $tableName
  * @param $conditions
  *
  * @return array
  *
  * @throws LookupError
  *
  * @since 1.1.0
  *
  * @author Eddilbert Macharia (http://eddmash.com) <edd.cowan@gmail.com>
  */
 public static function filters(QueryBuilder $queryBuilder, $conditions)
 {
     // default lookup is equal
     $lookup = 'eq';
     // we add the or conditions afterwards to avoid them being mistaken for "and" conditions when they come first
     $or_combine = [];
     $and_combine = [];
     // create where clause from the conditions given
     foreach ($conditions as $condition) {
         foreach ($condition as $key => $value) {
             $column = self::getLookupColumn($key);
             $lookup = self::getLookUP($key);
             $value = self::prepareValue($value, $lookup);
             echo self::$lookuOptions[$lookup] . '<br>';
             echo $queryBuilder->createNamedParameter($value) . '<br>';
             echo $value . '<br>';
             $lookupCondition = sprintf(self::$lookuOptions[$lookup], $queryBuilder->createNamedParameter($value));
             $queryString = sprintf('%s %s', $column, $lookupCondition);
             if (self::combine($key) === self::$or) {
                 $queryBuilder->orWhere($queryString);
             } else {
                 $queryBuilder->andWhere($queryString);
             }
         }
     }
 }
开发者ID:eddmash,项目名称:powerorm,代码行数:38,代码来源:Lookup.php

示例11: buildQuery

 /**
  * {@inheritdoc}
  */
 public function buildQuery(QueryBuilder $queryBuilder, array $values = array())
 {
     if (!array_key_exists($this->getName(), $values) || 0 === count($values[$this->getName()])) {
         return;
     }
     $queryBuilder->andWhere($queryBuilder->expr()->in('response.companyType', $values[$this->getName()]));
 }
开发者ID:Volyz,项目名称:barometre,代码行数:10,代码来源:CompanyTypeFilter.php

示例12: buildQuery

 /**
  * Builds the raw query
  *
  * @return void
  */
 protected function buildQuery()
 {
     $this->queryBuilder = $this->connection->createQueryBuilder();
     $this->queryBuilder->select((array) $this->conf->select);
     /*
      * Main table
      */
     $this->queryBuilder->from($this->conf->from->name, $this->conf->from->alias);
     /*
      * Inner join, right join, left join
      */
     $joinTypes = ['innerJoin', 'leftJoin', 'rightJoin'];
     foreach ($joinTypes as $joinType) {
         if (isset($this->conf->{$joinType})) {
             $joins = $this->conf->{$joinType};
             $this->buildJoins($joinType, $joins);
         }
     }
     /*
      * Condition
      */
     if (isset($this->conf->where)) {
         foreach ($this->conf->where as $where) {
             $this->queryBuilder->andWhere($where);
         }
     }
 }
开发者ID:solire,项目名称:trieur,代码行数:32,代码来源:Doctrine.php

示例13: finalizeQuery

 public function finalizeQuery(\Doctrine\DBAL\Query\QueryBuilder $query)
 {
     $paramcount = 0;
     if (isset($this->gID) && $this->gID > 0) {
         $query->where('gID = ?')->setParameter($paramcount++, $this->gID);
     }
     switch ($this->sortBy) {
         case "alpha":
             $query->orderBy('drName', 'ASC');
             break;
     }
     if ($this->search) {
         $query->andWhere('drName like ?')->setParameter($paramcount++, '%' . $this->search . '%');
     }
     $query->andWhere('drDeleted is NULL');
     return $query;
 }
开发者ID:Janoinen,项目名称:vivid_store,代码行数:17,代码来源:DiscountRuleList.php

示例14: finalizeQuery

 public function finalizeQuery(\Doctrine\DBAL\Query\QueryBuilder $query)
 {
     if (!$this->includeAllGroups) {
         $query->andWhere('g.gID > :minGroupID');
         $query->setParameter('minGroupID', REGISTERED_GROUP_ID);
     }
     return $query;
 }
开发者ID:ppiedaderawnet,项目名称:concrete5,代码行数:8,代码来源:GroupList.php

示例15: parse

 /**
  * Parses the `CriteriaExpression` and appropriately configures the passed query builder.
  *
  * @param QueryBuilder            $queryBuilder Query builder to be configured.
  * @param CriteriaExpression|null $criteria     Criteria to be parsed.
  *
  * @return QueryBuilder
  */
 public function parse(QueryBuilder $queryBuilder, CriteriaExpression $criteria = null)
 {
     if (!$criteria || count($criteria->getCriteria()) === 0) {
         return $queryBuilder;
     }
     $queryBuilder->andWhere($this->parseCriteria($queryBuilder, $criteria));
     return $queryBuilder;
 }
开发者ID:michaldudek,项目名称:knit,代码行数:16,代码来源:CriteriaParser.php


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