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


PHP ResultSet::initialize方法代码示例

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


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

示例1: getuserRankByExp

 public function getuserRankByExp($xp_point)
 {
     $dbAdapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
     $sql = new Sql($dbAdapter);
     $select = $sql->select('player_rank_system');
     $select->where->lessThan('min_exp', $xp_point);
     $select->where->greaterThan('max_exp', $xp_point);
     $statement = $sql->prepareStatementForSqlObject($select);
     $rowset = $statement->execute();
     $resultSet = new ResultSet();
     $resultSet->initialize($rowset);
     return $resultSet;
 }
开发者ID:bladehr8,项目名称:bowhunter2015,代码行数:13,代码来源:PageController.php

示例2: testExceptionIsThrownWhenGettingNonexistentAlbum

 public function testExceptionIsThrownWhenGettingNonexistentAlbum()
 {
     $resultSet = new ResultSet();
     $resultSet->setArrayObjectPrototype(new Album());
     $resultSet->initialize(array());
     $mockTableGateway = $this->getMock('Zend\\Db\\TableGateway\\TableGateway', array('select'), array(), '', false);
     $mockTableGateway->expects($this->once())->method('select')->with(array('id' => 123))->will($this->returnValue($resultSet));
     $albumTable = new AlbumTable($mockTableGateway);
     try {
         $albumTable->getAlbum(123);
     } catch (\Exception $e) {
         $this->assertSame('Could not find row 123', $e->getMessage());
         return;
     }
     $this->fail('Expected exception was not thrown');
 }
开发者ID:rwellens,项目名称:zf2_quickstart,代码行数:16,代码来源:AlbumTableTest.php

示例3: 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();
 }
开发者ID:kairios,项目名称:sigma,代码行数:19,代码来源:Segment.php

示例4: fetchAllPaginated

 public function fetchAllPaginated($itemCountPerPage, $dateYM = false)
 {
     // create a new Select object for the table album
     $select = new Select($this->table);
     $select->where(array("unpublish=0"));
     //$select->join("blvd", "blvd.id = gallery.blvd_id", SELECT::SQL_STAR, SELECT::JOIN_INNER);
     $select->order('date_inserted DESC');
     //echo $select->getSqlString($this->dbAdapter->getPlatform());
     $resultSetPrototype = new ResultSet();
     $resultSetPrototype->setArrayObjectPrototype(new GalleryModel());
     // create a new pagination adapter object
     $paginatorAdapter = new DbSelect($select, $this->dbAdapter, $resultSetPrototype);
     $paginator = new Paginator($paginatorAdapter);
     if ($dateYM) {
         $select = $this->sql->select();
         $select->columns(array('num' => new \Zend\Db\Sql\Expression('COUNT(*)')));
         $select->where(array("unpublish=0"));
         $dateUt = mktime(0, 0, 0, date("m", strtotime($dateYM)) + 1, 1, date("Y", strtotime($dateYM)));
         $select->where(array("date_inserted <= '" . date("Y-m-d 00:00:00", $dateUt) . "'"));
         //echo "<br><br>".$select->getSqlString($this->dbAdapter->getPlatform());exit;
         $statement = $this->sql->prepareStatementForSqlObject($select);
         $result = $statement->execute();
         $rows = new ResultSet();
         $arr = $rows->initialize($result)->toArray();
         $num = $arr[0]['num'];
         $totalItemCount = $paginator->getTotalItemCount();
         $page = ceil(($totalItemCount - $num) / 36);
         $paginator->setCurrentPageNumber($page);
     }
     $paginator->setItemCountPerPage($itemCountPerPage);
     return $paginator;
 }
开发者ID:nowarena,项目名称:zf2NowArena,代码行数:32,代码来源:GalleryMapper.php


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