本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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;
}