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


PHP QueryBuilder::linkLeft方法代码示例

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


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

示例1: prepareCndInventoryIn

 /**
  * Add inventory condition to search in-stock products
  *
  * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare
  *
  * @return void
  */
 protected function prepareCndInventoryIn(\Doctrine\ORM\QueryBuilder $queryBuilder)
 {
     $queryBuilder->linkLeft('p.variants', 'pv');
     $orCnd = new \Doctrine\ORM\Query\Expr\Orx();
     $orCnd->add('i.enabled = :disabled');
     $orCnd->add('i.amount > :zero');
     $orCnd->add('pv.amount > :zero');
     $queryBuilder->andWhere($orCnd)->setParameter('disabled', false)->setParameter('zero', 0);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:16,代码来源:Product.php

示例2: prepareCndOrderBy

 /**
  * Prepare certain search condition
  *
  * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare
  * @param array                      $value        Condition data
  * @param boolean                    $countOnly    "Count only" flag. Do not need to add "order by" clauses if only count is needed.
  *
  * @return void
  */
 protected function prepareCndOrderBy(\Doctrine\ORM\QueryBuilder $queryBuilder, array $value, $countOnly)
 {
     list($sort, $order) = $this->getSortOrderValue($value);
     if ('r.bought' == $sort) {
         if (!$countOnly) {
             $queryBuilder->linkLeft('p.order_items')->linkLeft('order_items.order')->linkLeft('order.paymentStatus')->andWhere('(paymentStatus.id IS NULL OR ' . $queryBuilder->expr()->in('paymentStatus.code', \XLite\Model\Order\Status\Payment::getPaidStatuses()) . ')')->addSelect('sum(order_items.amount) as product_amount')->addOrderBy('product_amount', $order);
         }
         $value = array('translations.name', $order);
     }
     parent::prepareCndOrderBy($queryBuilder, $value, $countOnly);
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:20,代码来源:Product.php

示例3: prepareCndOrderBy

 /**
  * Prepare certain search condition
  *
  * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare
  * @param array                      $value        Condition data
  * @param boolean                    $countOnly    "Count only" flag. Do not need to add "order by" clauses if only count is needed.
  *
  * @return void
  */
 protected function prepareCndOrderBy(\Doctrine\ORM\QueryBuilder $queryBuilder, array $value, $countOnly)
 {
     if (!$countOnly) {
         list($sort, $order) = $this->getSortOrderValue($value);
         if ('r.rating' == $sort) {
             $queryBuilder->linkLeft('p.reviews', 'r');
             $queryBuilder->addSelect('SUM(r.rating) as rsm');
             $sort = 'rsm';
             $queryBuilder->addOrderBy($sort, $order);
         } else {
             parent::prepareCndOrderBy($queryBuilder, $value, $countOnly);
         }
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:23,代码来源:Product.php

示例4: prepareOrderByAddressField

 /**
  * Prepare fields for fullname value (for 'order by')
  *
  * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder object
  * @param string                     $fieldName    Field name
  *
  * @return void
  */
 protected function prepareOrderByAddressField(\Doctrine\ORM\QueryBuilder $queryBuilder, $fieldName)
 {
     $addressFieldName = 'address_field_value_' . $fieldName;
     $addressField = \XLite\Core\Database::getRepo('XLite\\Model\\AddressField')->findOneBy(array('serviceName' => $fieldName));
     $queryBuilder->linkLeft('addresses.addressFields', $addressFieldName, \Doctrine\ORM\Query\Expr\Join::WITH, $addressFieldName . '.addressField = :' . $fieldName)->setParameter($fieldName, $addressField);
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:14,代码来源:OrderAbstract.php

示例5: addMembershipCondition

 /**
  * Adds additional condition to the query for checking if product has available membership
  *
  * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder object
  * @param string                     $alias        Entity alias OPTIONAL
  *
  * @return void
  */
 protected function addMembershipCondition(\Doctrine\ORM\QueryBuilder $queryBuilder, $alias = null)
 {
     if (!\XLite::isAdminZone()) {
         $alias = $alias ?: $queryBuilder->getRootAlias();
         $membership = \XLite\Core\Auth::getInstance()->getMembershipId();
         $queryBuilder->linkLeft($alias . '.memberships', 'membership');
         if ($membership) {
             $queryBuilder->andWhere('membership.membership_id = :membershipId OR membership.membership_id IS NULL')->setParameter('membershipId', \XLite\Core\Auth::getInstance()->getMembershipId());
         } else {
             $queryBuilder->andWhere('membership.membership_id IS NULL');
         }
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:21,代码来源:Product.php

示例6: prepareCndZone

 /**
  * Prepare certain search condition
  *
  * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare
  * @param array|string               $value        Condition data
  * @param boolean                    $countOnly    "Count only" flag. Do not need to add "order by" clauses
  *                                                 if only count is needed.
  *
  * @return void
  */
 protected function prepareCndZone(\Doctrine\ORM\QueryBuilder $queryBuilder, $value, $countOnly)
 {
     $values = array_values($value);
     if (isset($values[0]) && $values[0] == self::SEARCH_ZONE_CUSTOMER && \XLite\Core\Config::getInstance()->XC->Reviews->disablePendingReviews == true) {
         $statusCondition = 'r.status = ' . \XLite\Module\XC\Reviews\Model\Review::STATUS_APPROVED;
         if ($values[1] instanceof \XLite\Model\Profile) {
             $queryBuilder->linkLeft('r.profile', 'u');
             $queryBuilder->andWhere($statusCondition . ' OR u.profile_id = :profileId')->setParameter('profileId', $values[1]->getProfileId());
         } else {
             $reviewIds = \XLite\Core\Session::getInstance()->reviewIds;
             if (is_array($reviewIds) && !empty($reviewIds)) {
                 $queryBuilder->andWhere($statusCondition . ' OR r.id IN (' . implode(', ', $reviewIds) . ')');
             } else {
                 $queryBuilder->andWhere($statusCondition);
             }
         }
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:28,代码来源:Review.php

示例7: prepareCndUserType

 /**
  * prepareCndUserType
  *
  * @param \Doctrine\ORM\QueryBuilder $queryBuilder QueryBuilder instance
  * @param mixed                      $value        Searchable value
  *
  * @return void
  */
 protected function prepareCndUserType(\Doctrine\ORM\QueryBuilder $queryBuilder, $value)
 {
     $roles = array();
     if (!is_array($value)) {
         $value = array($value);
     }
     $condition = $queryBuilder->expr()->orX();
     foreach ($value as $selectedType) {
         if (is_numeric($selectedType)) {
             $roles[] = $selectedType;
         } elseif ('C' == $selectedType) {
             $condition->add($queryBuilder->expr()->andX($queryBuilder->getRegisteredCondition(), $queryBuilder->getCustomerCondition()));
             $queryBuilder->setParameter('anonymous', true)->setParameter('adminAccessLevel', \XLite\Core\Auth::getInstance()->getAdminAccessLevel());
         } elseif ('N' == $selectedType) {
             $condition->add($queryBuilder->expr()->andX($queryBuilder->getAnonymousCondition(), $queryBuilder->getCustomerCondition()));
             $queryBuilder->setParameter('anonymous', true)->setParameter('adminAccessLevel', \XLite\Core\Auth::getInstance()->getAdminAccessLevel());
         }
     }
     if ($roles) {
         $condition->add($queryBuilder->expr()->andX($queryBuilder->getRegisteredCondition(), $queryBuilder->getAdminCondition(), $queryBuilder->getRolesCondition($roles)));
         $queryBuilder->linkLeft('p.roles')->setParameter('anonymous', true)->setParameter('adminAccessLevel', \XLite\Core\Auth::getInstance()->getAdminAccessLevel());
     }
     if ($condition->count()) {
         $queryBuilder->andWhere($condition);
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:34,代码来源:ProfileAbstract.php


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