當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Query::getHints方法代碼示例

本文整理匯總了PHP中Doctrine\ORM\Query::getHints方法的典型用法代碼示例。如果您正苦於以下問題:PHP Query::getHints方法的具體用法?PHP Query::getHints怎麽用?PHP Query::getHints使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Doctrine\ORM\Query的用法示例。


在下文中一共展示了Query::getHints方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: take

 /**
  * @param int $offset
  * @return \Porpaginas\Page
  */
 public function take($offset, $limit)
 {
     if ($this->result !== null) {
         return new ArrayPage(array_slice($this->result, $offset, $limit), $offset, $limit, count($this->result));
     }
     $query = clone $this->query;
     $query->setParameters($this->query->getParameters());
     foreach ($this->query->getHints() as $name => $value) {
         $query->setHint($name, $value);
     }
     $query->setFirstResult($offset)->setMaxResults($limit);
     return new ORMQueryPage(new Paginator($query, $this->fetchCollection));
 }
開發者ID:stof,項目名稱:porpaginas,代碼行數:17,代碼來源:ORMQueryResult.php

示例2: cloneQuery

 /**
  * Clones the given $query and copies all used
  * parameters and hints
  *
  * @param Query $query
  * @return Query
  */
 public static function cloneQuery(Query $query)
 {
     $clonedQuery = clone $query;
     $clonedQuery->setParameters($query->getParameters());
     // attach hints
     foreach ($query->getHints() as $name => $hint) {
         $clonedQuery->setHint($name, $hint);
     }
     return $clonedQuery;
 }
開發者ID:Dren-x,項目名稱:mobit,代碼行數:17,代碼來源:Helper.php

示例3: cloneQuery

 /**
  * Clones a query.
  *
  * @param Query $query The query.
  *
  * @return Query The cloned query.
  */
 private function cloneQuery(Query $query)
 {
     /* @var $cloneQuery Query */
     $cloneQuery = clone $query;
     $cloneQuery->setParameters(clone $query->getParameters());
     foreach ($query->getHints() as $name => $value) {
         $cloneQuery->setHint($name, $value);
     }
     return $cloneQuery;
 }
開發者ID:jirinapravnik,項目名稱:common,代碼行數:17,代碼來源:PaginatorWithoutDistinct.php

示例4: __construct

 /**
  * @param \Doctrine\ORM\Query $query          The Doctrine Query
  * @param array               $fields         Fields to export
  * @param string              $dateTimeFormat
  */
 public function __construct(Query $query, array $fields, $dateTimeFormat = 'r')
 {
     $this->query = clone $query;
     $this->query->setParameters($query->getParameters());
     foreach ($query->getHints() as $name => $value) {
         $this->query->setHint($name, $value);
     }
     $this->propertyAccessor = PropertyAccess::createPropertyAccessor();
     $this->propertyPaths = array();
     foreach ($fields as $name => $field) {
         if (is_string($name) && is_string($field)) {
             $this->propertyPaths[$name] = new PropertyPath($field);
         } else {
             $this->propertyPaths[$field] = new PropertyPath($field);
         }
     }
     $this->dateTimeFormat = $dateTimeFormat;
 }
開發者ID:LamaDelRay,項目名稱:test_symf,代碼行數:23,代碼來源:DoctrineORMQuerySourceIterator.php

示例5: __construct

 /**
  * @param \Doctrine\ORM\Query $query          The Doctrine Query
  * @param array               $fields         Fields to export
  * @param string              $dateTimeFormat
  */
 public function __construct(Query $query, array $fields, $dateTimeFormat = 'r')
 {
     $this->query = clone $query;
     $this->query->setParameters($query->getParameters());
     foreach ($query->getHints() as $name => $value) {
         $this->query->setHint($name, $value);
     }
     // Note : will be deprecated in Symfony 3.0, conserved for 2.2 compatibility
     // Use createPropertyAccessor() for 3.0
     // @see Symfony\Component\PropertyAccess\PropertyAccess
     $this->propertyAccessor = PropertyAccess::getPropertyAccessor();
     $this->propertyPaths = array();
     foreach ($fields as $name => $field) {
         if (is_string($name) && is_string($field)) {
             $this->propertyPaths[$name] = new PropertyPath($field);
         } else {
             $this->propertyPaths[$field] = new PropertyPath($field);
         }
     }
     $this->dateTimeFormat = $dateTimeFormat;
 }
開發者ID:serialken,項目名稱:BugTracker,代碼行數:26,代碼來源:DoctrineORMQuerySourceIterator.php

示例6: cloneQuery

 /**
  * Makes full clone of the given query, including its parameters and hints
  *
  * @param Query $query
  * @return Query
  */
 protected function cloneQuery(Query $query)
 {
     $result = clone $query;
     // clone parameters
     $result->setParameters(clone $query->getParameters());
     // clone hints
     foreach ($query->getHints() as $name => $value) {
         $result->setHint($name, $value);
     }
     return $result;
 }
開發者ID:snorchel,項目名稱:platform,代碼行數:17,代碼來源:BufferedQueryResultIterator.php

示例7: cloneQuery

 /**
  * Clones a Query object.
  *
  * @param \Doctrine\ORM\Query $query The query to clone.
  *
  * @return \Doctrine\ORM\Query The cloned query.
  */
 private function cloneQuery(Query $query)
 {
     $queryClone = clone $query;
     $queryClone->setParameters($query->getParameters());
     foreach ($query->getHints() as $key => $value) {
         $queryClone->setHint($key, $value);
     }
     return $queryClone;
 }
開發者ID:e-ruiz,項目名稱:brick,代碼行數:16,代碼來源:QueryCollection.php

示例8: getQueryCacheKey

 /**
  * @param Query $query
  *
  * @return string
  */
 public function getQueryCacheKey(Query $query)
 {
     $hints = $query->getHints();
     ksort($hints);
     return md5($query->getDql() . var_export($query->getParameters(), true) . var_export($hints, true) . '&firstResult=' . $query->getFirstResult() . '&maxResult=' . $query->getMaxResults() . '&hydrationMode=' . $query->getHydrationMode());
 }
開發者ID:treehouselabs,項目名稱:cache-bundle,代碼行數:11,代碼來源:CachedEntityManager.php

示例9: addShareConditionToQuery

 /**
  * Add to query share condition
  *
  * @param Query     $query
  * @param Node|null $shareCondition
  */
 protected function addShareConditionToQuery(Query $query, $shareCondition)
 {
     if ($shareCondition) {
         $hints = $query->getHints();
         if (!empty($hints[Query::HINT_CUSTOM_TREE_WALKERS])) {
             $customHints = !in_array(self::ORO_ACL_WALKER, $hints[Query::HINT_CUSTOM_TREE_WALKERS]) ? array_merge($hints[Query::HINT_CUSTOM_TREE_WALKERS], [self::ORO_ACL_WALKER]) : $hints[Query::HINT_CUSTOM_TREE_WALKERS];
         } else {
             $customHints = [self::ORO_ACL_WALKER];
         }
         $query->setHint(Query::HINT_CUSTOM_TREE_WALKERS, $customHints);
         $query->setHint(AclWalker::ORO_ACL_SHARE_CONDITION, $shareCondition);
     }
 }
開發者ID:kstupak,項目名稱:platform,代碼行數:19,代碼來源:AclHelper.php


注:本文中的Doctrine\ORM\Query::getHints方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。