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


PHP HydratingResultSet::current方法代码示例

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


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

示例1: 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

示例2: testCurrent

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

示例3: 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

示例4: getBlvdWithSocialUsername

 public function getBlvdWithSocialUsername($select)
 {
     $statement = $this->sql->prepareStatementForSqlObject($select);
     //echo "<br><br>".$select->getSqlString($this->dbAdapter->getPlatform());
     $results = $statement->execute();
     if ($results->count() == 0) {
         return false;
     }
     //return $this->arrayResult($select);
     //echo "<br><br>".$select->getSqlString($this->dbAdapter->getPlatform());
     $entityPrototype = new BlvdEntity();
     $hydrator = new ClassMethods();
     $resultset = new HydratingResultSet($hydrator, $entityPrototype);
     $resultset->initialize($results);
     $resultset->buffer();
     $resultset->current();
     return $resultset;
 }
开发者ID:nowarena,项目名称:zf2NowArena,代码行数:18,代码来源:BlvdMapper.php


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