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


PHP HydratingResultSet::initialize方法代码示例

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


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

示例1: testToArray

 /**
  * @covers Zend\Db\ResultSet\HydratingResultSet::toArray
  * @todo   Implement testToArray().
  */
 public function testToArray()
 {
     $hydratingRs = new HydratingResultSet();
     $hydratingRs->initialize(array(array('id' => 1, 'name' => 'one')));
     $obj = $hydratingRs->toArray();
     $this->assertInternalType('array', $obj);
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:11,代码来源:HydratingResultSetTest.php

示例2: getPagesList

 public function getPagesList()
 {
     $stmt = $this->_dbAdapter->createStatement();
     $stmt->prepare('CALL `pages/get_slist`()');
     $result = $stmt->execute();
     $resultSet = new HydratingResultSet(new Reflection(), new Page());
     $resultSet->initialize($result);
     return $resultSet;
 }
开发者ID:KukaBazuka,项目名称:zendy,代码行数:9,代码来源:PageTable.php

示例3: testCurrentWillReturnBufferedRow

 /**
  * @covers Zend\Db\ResultSet\HydratingResultSet::current
  */
 public function testCurrentWillReturnBufferedRow()
 {
     $hydratingRs = new HydratingResultSet();
     $hydratingRs->initialize(new \ArrayIterator(array(array('id' => 1, 'name' => 'one'), array('id' => 2, 'name' => 'two'))));
     $hydratingRs->buffer();
     $obj1 = $hydratingRs->current();
     $hydratingRs->rewind();
     $obj2 = $hydratingRs->current();
     $this->assertSame($obj1, $obj2);
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:13,代码来源:HydratingResultSetIntegrationTest.php

示例4: fetchAll

 public function fetchAll()
 {
     $select = $this->sql->select();
     $stmt = $this->sql->prepareStatementForSqlObject($select);
     $results = $stmt->execute();
     $entity = new ImpostoEntity();
     $classMethods = new ClassMethods();
     $resultset = new HydratingResultSet($classMethods, $entity);
     $resultset->initialize($results);
     return $resultset;
 }
开发者ID:LucasBurg,项目名称:glass,代码行数:11,代码来源:ImpostoMapper.php

示例5: contohGetList

 /**
  * @return JsonModel
  */
 public function contohGetList()
 {
     $sm = $this->getServiceLocator();
     $table = $sm->get('Organisasi\\DbTable\\StrukturOrganisasi');
     // defined in module.php
     $result = $table->select()->toArray();
     $resultSet = new HydratingResultSet(new ReflectionHydrator(), new StrukturOrganisasi());
     $resultSet->initialize($result);
     $a = array('data' => $result);
     return new JsonModel($a);
 }
开发者ID:vatoer,项目名称:EOfficeZf2,代码行数:14,代码来源:ApiController.php

示例6: findActive

 /**
  * @return Route[]
  */
 public function findActive()
 {
     $sql = new Sql($this->dbAdapter);
     $select = $sql->select($this->table)->where('active = 1');
     $result = $sql->prepareStatementForSqlObject($select)->execute();
     if ($result->isQueryResult() && $result->getAffectedRows()) {
         $resultSet = new HydratingResultSet($this->hydrator, $this->model);
         return $resultSet->initialize($result);
     }
     return [];
 }
开发者ID:greedybytes,项目名称:routing,代码行数:14,代码来源:RouteService.php

示例7: findAll

 /**
  * {@inheritdoc}
  */
 public function findAll()
 {
     $sql = new Sql($this->dbAdapter);
     $select = $sql->select('posts');
     $stmt = $sql->prepareStatementForSqlObject($select);
     $result = $stmt->execute();
     if ($result instanceof ResultInterface && $result->isQueryResult()) {
         $resultSet = new HydratingResultSet(new ClassMethods(), new Post());
         return $resultSet->initialize($result);
     }
     return [];
 }
开发者ID:evanb2,项目名称:zend-tutorial,代码行数:15,代码来源:ZendDbSqlMapper.php

示例8: findAll

 /**
  * {@inheritDoc}
  */
 public function findAll()
 {
     $sql = new Sql($this->dbAdapter);
     $select = $sql->select('posts');
     $stmt = $sql->prepareStatementForSqlObject($select);
     $result = $stmt->execute();
     if ($result instanceof ResultInterface && $result->isQueryResult()) {
         $resultSet = new HydratingResultSet($this->hydrator, $this->postPrototype);
         return $resultSet->initialize($result);
     }
     return array();
 }
开发者ID:khanhdeux,项目名称:zend,代码行数:15,代码来源:ZendDbSqlMapper.php

示例9: getUsersList

 public function getUsersList()
 {
     $sql = new Sql($this->getAdaptor());
     $select = $sql->select('user');
     $statement = $sql->prepareStatementForSqlObject($select);
     $result = $statement->execute();
     if ($result instanceof ResultInterface && $result->isQueryResult()) {
         $resultSet = new HydratingResultSet($this->getHydrator(), $this->getProtoType());
         return $resultSet->initialize($result);
     }
     return array();
 }
开发者ID:projectsmahendra,项目名称:blogger,代码行数:12,代码来源:UserService.php

示例10: fetchAll

 public function fetchAll()
 {
     $select = $this->sql->select();
     $select->order(array('user ASC', 'name ASC'));
     $statement = $this->sql->prepareStatementForSqlObject($select);
     $results = $statement->execute();
     $entityPrototype = new BuildingEntity();
     $hydrator = new ClassMethods();
     $resultset = new HydratingResultSet($hydrator, $entityPrototype);
     $resultset->initialize($results);
     return $resultset;
 }
开发者ID:timepuls,项目名称:myhomecockpit,代码行数:12,代码来源:BuildingMapper.php

示例11: fetchAll

 public function fetchAll($limit = 3)
 {
     $select = $this->sql->select();
     $select->order("date DESC");
     $select->limit($limit);
     $statement = $this->sql->prepareStatementForSqlObject($select);
     $results = $statement->execute();
     $entityPrototype = new TumblrEntity();
     $hydrator = new ClassMethods();
     $resultset = new HydratingResultSet($hydrator, $entityPrototype);
     $resultset->initialize($results);
     return $resultset;
 }
开发者ID:nowarena,项目名称:zf2NowArena,代码行数:13,代码来源:TumblrMapper.php

示例12: fetch

 /**
  * Fetches rooms.
  * @return Zend\Db\ResultSet\HydratingResultSet collection of Room obj's
  */
 public function fetch()
 {
     $adapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
     $sql = new Sql($adapter);
     $select = $sql->select('room')->offset($this->offset)->limit($this->limit);
     $statement = $sql->prepareStatementForSqlObject($select);
     $res = $statement->execute();
     $resultSet = new HydratingResultSet(new hydrator(), new Room());
     if ($res instanceof ResultInterface && $res->isQueryResult()) {
         $resultSet->initialize($res);
     }
     return $resultSet;
 }
开发者ID:rav990,项目名称:AplikacjaRestPhp,代码行数:17,代码来源:Rooms.php

示例13: fetchAll

 public function fetchAll($blvdId)
 {
     $select = $this->sql->select();
     $select->where(array("blvd_id" => $blvdId));
     $statement = $this->sql->prepareStatementForSqlObject($select);
     $results = $statement->execute();
     $entityPrototype = new BlvdCategoryEntity();
     $hydrator = new ClassMethods();
     $resultset = new HydratingResultSet($hydrator, $entityPrototype);
     $resultset->initialize($results);
     $resultset->buffer();
     return $resultset;
 }
开发者ID:nowarena,项目名称:zf2NowArena,代码行数:13,代码来源:BlvdJoinCategoryMapper.php

示例14: getAttributes

 public function getAttributes($id)
 {
     $select = $this->sql->select();
     $select->join('lead_attributes', 'lead_attribute_values.attribute_id = lead_attributes.id', array('attribute_name'));
     $select->where(array('entity_id' => $id));
     $select->order(array("id ASC"));
     $entityPrototype = new AttributeEntity();
     $hydrator = new ClassMethods();
     $resultset = new HydratingResultSet($hydrator, $entityPrototype);
     $statement = $this->sql->prepareStatementForSqlObject($select);
     $results = $statement->execute();
     $resultset->initialize($results);
     return $resultset;
 }
开发者ID:arstropica,项目名称:zf-tenstreet,代码行数:14,代码来源:AttributeMapper.php

示例15: findById

 /**
  * @param $postId int
  *
  * @return Post|null
  */
 public function findById($postId)
 {
     $sql = new \Zend\Db\Sql\Sql($this->adapter);
     $select = $sql->select();
     $select->columns(array('id', 'title', 'slug', 'content', 'created'))->from(array('p' => 'news'))->join(array('c' => 'category'), 'c.id = p.category_id', array('category_id' => 'id', 'name', 'category_slug' => 'slug'), $select::JOIN_INNER)->where(array('p.id' => $postId));
     $statement = $sql->prepareStatementForSqlObject($select);
     $results = $statement->execute();
     $hydrator = new AggregateHydrator();
     $hydrator->add(new PostHydrator());
     $hydrator->add(new CategoryHydrator());
     $resultSet = new HydratingResultSet($hydrator, new Post());
     $resultSet->initialize($results);
     return $resultSet->count() > 0 ? $resultSet->current() : null;
 }
开发者ID:samija,项目名称:Deeplifec4tk,代码行数:19,代码来源:PostRepositoryImpl.php


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