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


PHP EntityRepository::createObjectFromValues方法代码示例

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


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

示例1: load

 /**
  * Load all items defined by fluent.
  *
  * 
  * @return DbRecordCollection
  */
 public function load()
 {
     if ($this->isLoaded()) {
         return $this;
     }
     if (!$this->isLoadable()) {
         throw new Exception('This collection is not loadable! Maybe items were set manualy before load!');
     }
     if (!$this->query) {
         // pokud neni fluent set, nastav defaultni
         $this->query();
         #throw new Exception('Fluent is not set');
     }
     foreach ($this->query->toArray() as $values) {
         $this->repository->createObjectFromValues($values);
         // map by IdentityMap
         if ($this->options['mapped']) {
             $item = $class::identity()->map($item);
         }
         $this->append($item);
     }
     $this->setLoaded(true);
     return $this;
 }
开发者ID:matak,项目名称:dbrecord,代码行数:30,代码来源:EntityCollection.php

示例2: findBy

 /**
  * Fetch single row from database based on defined fluent and obligatory conditions defined in array.
  *
  * @param mixed $primary
  * @return DbRecord
  */
 public function findBy(array $conditions)
 {
     $metadata = $this->repository->getMetadata();
     foreach ($conditions as $key => $value) {
         $this->where('#.' . $key . ' = %' . $metadata->getType($key), $value);
     }
     $values = $this->limit(1)->toArray();
     /* 		
     //no more exceptions on not founded item in dtb
     if ( !$values ) {
     	throw new NotFoundException("Item was not found!");
     } 
     */
     if ($values) {
         return $this->repository->createObjectFromValues($values[0]);
     }
     return NULL;
 }
开发者ID:matak,项目名称:dbrecord,代码行数:24,代码来源:Query.php


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