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


PHP PersistentCollection::hydrateAdd方法代码示例

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


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

示例1: loadOneToManyCollection

 /**
  * Loads a collection of entities in a one-to-many association.
  *
  * @param OneToManyMapping $assoc
  * @param array $criteria The criteria by which to select the entities.
  * @param PersistentCollection The collection to load/fill.
  */
 public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentCollection $coll)
 {
     $criteria = array();
     $owningAssoc = $this->_class->associationMappings[$assoc['mappedBy']];
     $sourceClass = $this->_em->getClassMetadata($assoc['sourceEntity']);
     foreach ($owningAssoc['targetToSourceKeyColumns'] as $sourceKeyColumn => $targetKeyColumn) {
         $criteria[$targetKeyColumn] = $sourceClass->reflFields[$sourceClass->fieldNames[$sourceKeyColumn]]->getValue($sourceEntity);
     }
     $sql = $this->_getSelectEntitiesSQL($criteria, $assoc);
     $params = array_values($criteria);
     $stmt = $this->_conn->executeQuery($sql, $params);
     while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $coll->hydrateAdd($this->_createEntity($result));
     }
     $stmt->closeCursor();
 }
开发者ID:jeffreiffers,项目名称:doctrine2,代码行数:23,代码来源:BasicEntityPersister.php

示例2: loadOneToManyCollection

    /**
     * Loads a collection of entities in a one-to-many association.
     *
     * @param array $assoc
     * @param object $sourceEntity
     * @param PersistentCollection $coll The collection to load/fill.
     * @param int|null $offset
     * @param int|null $limit
     */
    public function loadOneToManyCollection(array $assoc, $sourceEntity, PersistentCollection $coll)
    {
        $stmt = $this->getOneToManyStatement($assoc, $sourceEntity);

        while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
            $coll->hydrateAdd($this->_createEntity($result));
        }
        $stmt->closeCursor();
    }
开发者ID:nresni,项目名称:AriadneSandbox,代码行数:18,代码来源:BasicEntityPersister.php

示例3: loadCollectionFromStatement

 /**
  * Hydrate a collection from a given dbal statement.
  * 
  * @param array $assoc
  * @param Doctrine\DBAL\Statement $stmt
  * @param PersistentCollection $coll
  */
 private function loadCollectionFromStatement($assoc, $stmt, $coll)
 {
     if (isset($assoc['indexBy'])) {
         while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
             $entity = $this->_createEntity($result);
             $coll->hydrateSet($this->_class->reflFields[$assoc['indexBy']]->getValue($entity), $entity);
         }
     } else {
         while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
             $coll->hydrateAdd($this->_createEntity($result));
         }
     }
     $stmt->closeCursor();
 }
开发者ID:viniciusferreira,项目名称:doctrine2,代码行数:21,代码来源:BasicEntityPersister.php

示例4: loadManyToManyCollection

 /**
  * Loads a collection of entities of a many-to-many association.
  *
  * @param ManyToManyMapping $assoc
  * @param array $criteria
  * @param PersistentCollection $coll The collection to fill.
  */
 public function loadManyToManyCollection($assoc, array $criteria, PersistentCollection $coll)
 {
     $sql = $this->_getSelectManyToManyEntityCollectionSQL($assoc, $criteria);
     $params = array_values($criteria);
     $stmt = $this->_conn->executeQuery($sql, $params);
     while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $coll->hydrateAdd($this->_createEntity($result));
     }
     $stmt->closeCursor();
 }
开发者ID:poulikov,项目名称:readlater,代码行数:17,代码来源:StandardEntityPersister.php

示例5: loadManyToManyCollection

 /**
  * Loads a collection of entities of a many-to-many association.
  *
  * @param array $criteria
  * @param PersistentCollection $coll The collection to fill.
  */
 public function loadManyToManyCollection($assoc, array $criteria, PersistentCollection $coll)
 {
     $sql = $this->_getSelectManyToManyEntityCollectionSql($assoc, $criteria);
     $params = array_values($criteria);
     if ($this->_sqlLogger !== null) {
         $this->_sqlLogger->logSql($sql, $params);
     }
     $stmt = $this->_conn->prepare($sql);
     $stmt->execute($params);
     while ($result = $stmt->fetch(Connection::FETCH_ASSOC)) {
         $coll->hydrateAdd($this->_createEntity($result));
     }
     $stmt->closeCursor();
 }
开发者ID:nvdnkpr,项目名称:symfony-demo,代码行数:20,代码来源:StandardEntityPersister.php


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