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


PHP EntityManagerInterface::newHydrator方法代碼示例

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


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

示例1: iterate

 /**
  * Executes the query and returns an IterableResult that can be used to incrementally
  * iterate over the result.
  *
  * @param ArrayCollection|array|null $parameters    The query parameters.
  * @param integer|null               $hydrationMode The hydration mode to use.
  *
  * @return \Doctrine\ORM\Internal\Hydration\IterableResult
  */
 public function iterate($parameters = null, $hydrationMode = null)
 {
     if ($hydrationMode !== null) {
         $this->setHydrationMode($hydrationMode);
     }
     if (!empty($parameters)) {
         $this->setParameters($parameters);
     }
     $rsm = $this->getResultSetMapping();
     $stmt = $this->_doExecute();
     return $this->_em->newHydrator($this->_hydrationMode)->iterate($stmt, $rsm, $this->_hints);
 }
開發者ID:BozzaCoon,項目名稱:SPHERE-Framework,代碼行數:21,代碼來源:AbstractQuery.php

示例2: executeIgnoreQueryCache

 /**
  * Execute query ignoring second level cache.
  *
  * @param ArrayCollection|array|null $parameters
  * @param integer|null               $hydrationMode
  *
  * @return mixed
  */
 private function executeIgnoreQueryCache($parameters = null, $hydrationMode = null)
 {
     if ($hydrationMode !== null) {
         $this->setHydrationMode($hydrationMode);
     }
     if (!empty($parameters)) {
         $this->setParameters($parameters);
     }
     $setCacheEntry = function () {
     };
     if ($this->_hydrationCacheProfile !== null) {
         list($cacheKey, $realCacheKey) = $this->getHydrationCacheId();
         $queryCacheProfile = $this->getHydrationCacheProfile();
         $cache = $queryCacheProfile->getResultCacheDriver();
         $result = $cache->fetch($cacheKey);
         if (isset($result[$realCacheKey])) {
             return $result[$realCacheKey];
         }
         if (!$result) {
             $result = array();
         }
         $setCacheEntry = function ($data) use($cache, $result, $cacheKey, $realCacheKey, $queryCacheProfile) {
             $result[$realCacheKey] = $data;
             $cache->save($cacheKey, $result, $queryCacheProfile->getLifetime());
         };
     }
     $stmt = $this->_doExecute();
     if (is_numeric($stmt)) {
         $setCacheEntry($stmt);
         return $stmt;
     }
     $rsm = $this->getResultSetMapping();
     $data = $this->_em->newHydrator($this->_hydrationMode)->hydrateAll($stmt, $rsm, $this->_hints);
     $setCacheEntry($data);
     return $data;
 }
開發者ID:AlexanderForks,項目名稱:doctrine2,代碼行數:44,代碼來源:AbstractQuery.php

示例3: loadCollectionFromStatement

 /**
  * Hydrates a collection from a given DBAL statement.
  *
  * @param array                    $assoc
  * @param \Doctrine\DBAL\Statement $stmt
  * @param PersistentCollection     $coll
  *
  * @return array
  */
 private function loadCollectionFromStatement($assoc, $stmt, $coll)
 {
     $rsm = $this->currentPersisterContext->rsm;
     $hints = array(UnitOfWork::HINT_DEFEREAGERLOAD => true, 'collection' => $coll);
     if (isset($assoc['indexBy'])) {
         $rsm = clone $this->currentPersisterContext->rsm;
         // this is necessary because the "default rsm" should be changed.
         $rsm->addIndexBy('r', $assoc['indexBy']);
     }
     return $this->em->newHydrator(Query::HYDRATE_OBJECT)->hydrateAll($stmt, $rsm, $hints);
 }
開發者ID:BusinessCookies,項目名稱:CoffeeMachineProject,代碼行數:20,代碼來源:BasicEntityPersister.php

示例4: newHydrator

 /**
  * {@inheritdoc}
  */
 public function newHydrator($hydrationMode)
 {
     return $this->wrapped->newHydrator($hydrationMode);
 }
開發者ID:Dren-x,項目名稱:mobitnew,代碼行數:7,代碼來源:EntityManagerDecorator.php

示例5: __construct

 /**
  * Initializes a new instance of a class derived from <tt>AbstractHydrator</tt>.
  *
  * @param EntityManagerInterface $em The EntityManager to use.
  */
 public function __construct(EntityManagerInterface $em)
 {
     $this->em = $em;
     $this->wrapped = $em->newHydrator($this->type);
 }
開發者ID:carnage,項目名稱:watson,代碼行數:10,代碼來源:BaseHydrator.php


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