本文整理汇总了PHP中ResultSet::toArray方法的典型用法代码示例。如果您正苦于以下问题:PHP ResultSet::toArray方法的具体用法?PHP ResultSet::toArray怎么用?PHP ResultSet::toArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ResultSet
的用法示例。
在下文中一共展示了ResultSet::toArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findSegmentByTypeSegment
/**
* [findSegmentByTypeSegment description]
* @param ServiceLocator $sm
* @param int $typeSegment (ID du type de segment)
* @return array (Array de Segment)
*/
public function findSegmentByTypeSegment($sm, $typeSegment)
{
$idType = (int) $typeSegment;
$query = "SELECT id, intitule_segment \n FROM segment\n WHERE ref_type_segment = {$idType}";
$statement = $sm->get('Zend\\Db\\Adapter\\Adapter')->query($query);
$results = $statement->execute();
if ($results->isQueryResult()) {
$resultSet = new ResultSet();
$resultSet->initialize($results);
return $resultSet->toArray();
}
return array();
}
示例2: testOffsetSet
public function testOffsetSet()
{
$resultSet = new ResultSet(array('a' => array('_id' => 'a', 'field' => 'value1'), 'b' => array('_id' => 'b', 'field' => 'value2'), 'c' => array('_id' => 'c', 'field' => 'value3')));
$resultSet['d'] = array('_id' => 'd', 'field' => 'value4');
$this->assertEquals(array('a' => array('_id' => 'a', 'field' => 'value1'), 'b' => array('_id' => 'b', 'field' => 'value2'), 'c' => array('_id' => 'c', 'field' => 'value3'), 'd' => array('_id' => 'd', 'field' => 'value4')), $resultSet->toArray());
}