當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ResultSet::setArrayObjectPrototype方法代碼示例

本文整理匯總了PHP中ResultSet::setArrayObjectPrototype方法的典型用法代碼示例。如果您正苦於以下問題:PHP ResultSet::setArrayObjectPrototype方法的具體用法?PHP ResultSet::setArrayObjectPrototype怎麽用?PHP ResultSet::setArrayObjectPrototype使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ResultSet的用法示例。


在下文中一共展示了ResultSet::setArrayObjectPrototype方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getServiceConfig

 public function getServiceConfig()
 {
     return array('factories' => array('Senjata\\Model\\SenjataTable' => function ($sm) {
         $tableGateway = $sm->get('PrajuritTableGateway');
         $table = new SenjataTable($tableGateway);
         return $table;
     }, 'SenjataTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Prajurit());
         return new TableGateway('senjata', $dbAdapter, null, $resultSetPrototype);
     }));
 }
開發者ID:ibnuda,項目名稱:SayaSakit,代碼行數:13,代碼來源:Module.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: getServiceConfig

 public function getServiceConfig()
 {
     return array('factories' => array('NotificationTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new User());
         return new TableGateway('notification', $dbAdapter, array(new Feature\MasterSlaveFeature($sm->get('SlaveAdapter')), new Feature\MasterSlaveFeature($sm->get('SlaveAdapter2')), new Feature\MasterSlaveFeature($sm->get('SlaveAdapter3'))), $resultSetPrototype);
     }, 'NotificationTable' => function ($sm) {
         $tableGateway = $sm->get('QuestionTableGateway');
         $table = new QuestionTable($tableGateway);
         return $table;
     }, 'Application\\V1\\Rest\\Notification\\NotificationMapper' => function ($sm) {
         $adapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new \Application\V1\Rest\Notification\NotificationMapper($adapter);
     }, 'Application\\V1\\Rest\\User\\UserMapper' => function ($sm) {
         $adapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new \Application\V1\Rest\User\UserMapper($adapter);
     }, 'Application\\V1\\Rest\\Address\\AddressMapper' => function ($sm) {
         $adapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new \Application\V1\Rest\Address\AddressMapper($adapter);
     }, 'Application\\V1\\Rest\\Order\\OrderMapper' => function ($sm) {
         $adapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new \Application\V1\Rest\Order\OrderMapper($adapter);
     }, 'Application\\V1\\Rest\\Rate\\RateMapper' => function ($sm) {
         $adapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new \Application\V1\Rest\Rate\RateMapper($adapter);
     }, 'Application\\V1\\Rest\\Offer\\OfferMapper' => function ($sm) {
         $adapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new \Application\V1\Rest\Offer\OfferMapper($adapter);
     }, 'Application\\V1\\Rest\\Package\\PackageMapper' => function ($sm) {
         $adapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new \Application\V1\Rest\Package\PackageMapper($adapter);
     }, 'Application\\V1\\Rest\\Page\\PageMapper' => function ($sm) {
         $adapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new \Application\V1\Rest\Page\PageMapper($adapter);
     }, 'Application\\V1\\Rest\\Service\\ServiceMapper' => function ($sm) {
         $adapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new \Application\V1\Rest\Service\ServiceMapper($adapter);
     }, 'Application\\V1\\Rest\\Category\\CategoryMapper' => function ($sm) {
         $adapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new \Application\V1\Rest\Category\CategoryMapper($adapter);
     }, 'Application\\V1\\Rest\\Location\\LocationMapper' => function ($sm) {
         $adapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new \Application\V1\Rest\Location\LocationMapper($adapter);
     }));
 }
開發者ID:ankuradhey,項目名稱:laundry,代碼行數:46,代碼來源:Module.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::setArrayObjectPrototype方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。