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


PHP ResultSet::initialize方法代码示例

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


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

示例1: indexAction

 public function indexAction()
 {
     $session = new Container('admin');
     if ($session->offsetExists('email')) {
         //Prepare statistique information pour la vue Index ->des statistiques
         $adapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
         $sql1 = "select * from pro_product_bdma";
         $statement1 = $adapter->query($sql1);
         $results1 = $statement1->execute();
         $row1 = $results1->current();
         //tester si les variables rouX ont bien remplis
         if (!$row1) {
             //redirection vers l'index avec un message GET var
             $this->redirect()->toRoute('product', array('action' => 'index'), array('query' => array('status' => 'erreur_fetching_view_data')));
         } else {
             // 2 preparation des donnees  result sett , retourne un mass d'information
             if ($results1 instanceof ResultInterface && $results1->isQueryResult()) {
                 //instanciation  de la class result set pour l'enregistrement des information fournis par la BD
                 $resultSet = new ResultSet();
                 $resultSet->initialize($results1);
                 //  redirection vers la vue index avec les information des statistiques
                 return new ViewModel(array('data' => $resultSet));
             }
         }
     } else {
         $this->redirect()->toRoute('admin', array('action' => 'login'), array('query' => array('status' => 'u_login')));
     }
 }
开发者ID:SoufianeAr,项目名称:bdma-backend,代码行数:28,代码来源:ProductController.php

示例2: indexAction

 public function indexAction()
 {
     // instansiation d'une session d'admin (duré = 30 Jrs)
     $session = new Container('useradmin');
     // tester si une session 'email existe '
     if ($session->offsetExists('uid') && $session->offsetExists('ucomp') && $session->offsetGet('user') == 'user') {
         //Prepare statistique information pour la vue Index ->des statistiques
         $adapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
         $cmpny = $session->offsetGet('ucomp');
         $sql1 = "select  `id`, `gender`,`company`, `name`, `firstname`, `email`, `lang`, `phone`, `gsm` from pro_user where company='" . $cmpny . "' and active=1";
         $statement1 = $adapter->query($sql1);
         $results1 = $statement1->execute();
         $row1 = $results1->current();
         //tester si les variables rouX ont bien remplis
         if (!$row1) {
             //redirection vers l'index avec un message GET var
             $this->redirect()->toRoute('useradmin', array('action' => 'index'), array('query' => array('status' => 'erreur_fetching_view_data')));
         } else {
             // 2 preparation des donnees  result sett , retourne un mass d'information
             if ($results1 instanceof ResultInterface && $results1->isQueryResult()) {
                 //instanciation  de la class result set pour l'enregistrement des information fournis par la BD
                 $resultSet = new ResultSet();
                 $resultSet->initialize($results1);
                 //  redirection vers la vue index avec les information des statistiques
                 return new ViewModel(array('data' => $resultSet));
             }
         }
     } else {
         //si la session n'existe pas ,, donc la redirection vers login page pour l'authentification avec un petit message
         $this->redirect()->toRoute('useradmin', array('action' => 'loginuser'), array('query' => array('status' => 'u_login')));
     }
 }
开发者ID:SoufianeAr,项目名称:bdma-backend,代码行数:32,代码来源:UseradminController.php

示例3: usersAction

 public function usersAction()
 {
     $session = new Container('admin');
     if (!$session->offsetExists('email') || !isset($_GET['idcmp'])) {
         $this->redirect()->toRoute('admin', array('action' => 'login'), array('query' => array('status' => 'u_login')));
     }
     $idcmp = $_GET['idcmp'];
     if (!$idcmp) {
         return $this->redirect()->toRoute('company');
     }
     $adapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
     $sql1 = "select * from pro_user where company=" . $_GET['idcmp'];
     $statement1 = $adapter->query($sql1);
     $results1 = $statement1->execute();
     //tester si les variables rouX ont bien remplis
     if ($results1->count() <= 0) {
         //redirection vers l'index avec un message GET var
         $this->redirect()->toRoute('company', array('action' => 'index'), array('query' => array('status' => 'nouser')));
     } else {
         // 2 preparation des donnees  result sett , retourne un mass d'information
         if ($results1 instanceof ResultInterface && $results1->isQueryResult()) {
             //instanciation  de la class result set pour l'enregistrement des information fournis par la BD
             $resultSet = new ResultSet();
             $resultSet->initialize($results1);
             //  redirection vers la vue index avec les information des statistiques
             return new ViewModel(array('data' => $resultSet));
         }
     }
 }
开发者ID:SoufianeAr,项目名称:bdma-backend,代码行数:29,代码来源:CompanyController.php

示例4: getMenu

 /**
  * Get menu
  *
  * @return array
  */
 public function getMenu()
 {
     // generate cache name
     $cacheName = CacheUtility::getCacheName(self::CACHE_ADMIN_MENU);
     // check data in cache
     if (null === ($menu = $this->staticCacheInstance->getItem($cacheName))) {
         $select = $this->select();
         $select->from(['a' => 'application_admin_menu'])->columns(['name', 'controller', 'action'])->join(['b' => 'application_admin_menu_category'], 'a.category = b.id', ['category' => 'name', 'category_icon' => 'icon'])->join(['c' => 'application_admin_menu_part'], 'a.part = c.id', ['part' => 'name', 'part_icon' => 'icon'])->join(['d' => 'application_module'], new Expression('c.module = d.id and d.status = ?', [self::MODULE_STATUS_ACTIVE]), ['part_module' => 'name'])->join(['i' => 'application_module'], new Expression('b.module = i.id and i.status = ?', [self::MODULE_STATUS_ACTIVE]), ['category_module' => 'name'])->order('order');
         $statement = $this->prepareStatementForSqlObject($select);
         $resultSet = new ResultSet();
         $resultSet->initialize($statement->execute());
         // process admin menu
         foreach ($resultSet as $menuItem) {
             if (!isset($menu[$menuItem['part']])) {
                 $menu[$menuItem['part']] = ['part' => $menuItem['part'], 'icon' => $menuItem['part_icon'], 'module' => $menuItem['part_module'], 'items' => [0 => ['name' => $menuItem['name'], 'controller' => $menuItem['controller'], 'action' => $menuItem['action'], 'category' => $menuItem['category'], 'category_icon' => $menuItem['category_icon'], 'category_module' => $menuItem['category_module']]]];
             } else {
                 $menu[$menuItem['part']]['items'][] = ['name' => $menuItem['name'], 'controller' => $menuItem['controller'], 'action' => $menuItem['action'], 'category' => $menuItem['category'], 'category_icon' => $menuItem['category_icon'], 'category_module' => $menuItem['category_module']];
             }
         }
         // save data in cache
         $this->staticCacheInstance->setItem($cacheName, $menu);
         $this->staticCacheInstance->setTags($cacheName, [self::CACHE_ADMIN_MENU_DATA_TAG]);
     }
     return $menu;
 }
开发者ID:spooner77,项目名称:dream-cms,代码行数:30,代码来源:ApplicationAdminMenu.php

示例5: setUp

 protected function setUp()
 {
     $bootstrap = \Zend\Mvc\Application::init(include 'config/application.config.php');
     $categoryData = array('id_category' => 1, 'name' => 'Project Manager');
     $category = new Category();
     $category->exchangeArray($categoryData);
     $resultSetCategory = new ResultSet();
     $resultSetCategory->setArrayObjectPrototype(new Category());
     $resultSetCategory->initialize(array($category));
     $mockCategoryTableGateway = $this->getMock('Zend\\Db\\TableGateway\\TableGateway', array('select'), array(), '', false);
     $mockCategoryTableGateway->expects($this->any())->method('select')->with()->will($this->returnValue($resultSetCategory));
     $categoryTable = new CategoryTable($mockCategoryTableGateway);
     $jobData = array('id_job' => 1, 'id_category' => 1, 'type' => 'typeTest', 'company' => 'companyTest', 'logo' => 'logoTest', 'url' => 'urlTest', 'position' => 'positionTest', 'location' => 'locaitonTest', 'description' => 'descriptionTest', 'how_to_play' => 'hotToPlayTest', 'is_public' => 1, 'is_activated' => 1, 'email' => 'emailTest', 'created_at' => '2012-01-01 00:00:00', 'updated_at' => '2012-01-01 00:00:00');
     $job = new Job();
     $job->exchangeArray($jobData);
     $resultSetJob = new ResultSet();
     $resultSetJob->setArrayObjectPrototype(new Job());
     $resultSetJob->initialize(array($job));
     $mockJobTableGateway = $this->getMock('Zend\\Db\\TableGateway\\TableGateway', array('select'), array(), '', false);
     $mockJobTableGateway->expects($this->any())->method('select')->with(array('id_category' => 1))->will($this->returnValue($resultSetJob));
     $jobTable = new JobTable($mockJobTableGateway);
     $this->controller = new IndexController($categoryTable, $jobTable);
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->event = $bootstrap->getMvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setEventManager($bootstrap->getEventManager());
     $this->controller->setServiceLocator($bootstrap->getServiceManager());
 }
开发者ID:Lebe1ge,项目名称:JobeetForZF2,代码行数:30,代码来源:IndexControllerTest.php

示例6: getTimeZones

 /**
  * Get time zones
  *
  * @return array
  */
 public function getTimeZones()
 {
     // check data in a memory
     if (null !== self::$timeZones) {
         return self::$timeZones;
     }
     // generate a cache name
     $cacheName = CacheUtility::getCacheName(self::CACHE_TIME_ZONES);
     // check data in cache
     if (null === ($timeZones = $this->staticCacheInstance->getItem($cacheName))) {
         $select = $this->select();
         $select->from('application_time_zone')->columns(['id', 'name'])->order('name');
         $statement = $this->prepareStatementForSqlObject($select);
         $resultSet = new ResultSet();
         $resultSet->initialize($statement->execute());
         foreach ($resultSet as $timeZone) {
             $timeZones[$timeZone->id] = $timeZone->name;
         }
         // save data in cache
         $this->staticCacheInstance->setItem($cacheName, $timeZones);
         $this->staticCacheInstance->setTags($cacheName, [self::CACHE_TIME_ZONES_DATA_TAG]);
     }
     self::$timeZones = $timeZones;
     return $timeZones;
 }
开发者ID:spooner77,项目名称:dream-cms,代码行数:30,代码来源:ApplicationTimeZone.php

示例7: testCallingBufferAfterIterationThrowsException

 public function testCallingBufferAfterIterationThrowsException()
 {
     $this->resultSet->initialize($this->getMock('Zend\\Db\\Adapter\\Driver\\ResultInterface'));
     $this->resultSet->current();
     $this->setExpectedException('Zend\\Db\\ResultSet\\Exception\\RuntimeException', 'Buffering must be enabled before iteration is started');
     $this->resultSet->buffer();
 }
开发者ID:razvansividra,项目名称:pnlzf2-1,代码行数:7,代码来源:ResultSetIntegrationTest.php

示例8: fetchAll

 public function fetchAll()
 {
     # use a closure to manipulate the Select object
     /*
        $active = 1;
        $resultSet = $this->tableGateway->select(
     	function (Select $select) use ($active) {
             //$select->columns(array('id', 'name', 'type')); 
             $select->order('id DESC'); 
             //$select->where(array('active'=> $active));
         });
     */
     // return $resultSet;
     $adapter = $this->tableGateway->getAdapter();
     $sql = new Sql($adapter);
     $select = $sql->select();
     $select->from('pages');
     $select->order('id DESC');
     //$select->join('advertisement_type', 'advertisement.advertisement_type_id = advertisement_type.id ' , array('adType'=> 'name'),$type = self::JOIN_LEFT);
     $statement = $sql->prepareStatementForSqlObject($select);
     $rowset = $statement->execute();
     $resultSet = new ResultSet();
     $resultSet->initialize($rowset);
     return $resultSet;
 }
开发者ID:bladehr8,项目名称:bowhunter2015,代码行数:25,代码来源:PagesTable.php

示例9: testToArrayCreatesArrayOfArraysRepresentingRows

 public function testToArrayCreatesArrayOfArraysRepresentingRows()
 {
     $count = rand(3, 75);
     $dataSource = $this->getArrayDataSource($count);
     $this->resultSet->initialize($dataSource);
     $test = $this->resultSet->toArray();
     $this->assertEquals($dataSource->getArrayCopy(), $test, var_export($test, 1));
 }
开发者ID:navassouza,项目名称:zf2,代码行数:8,代码来源:ResultSetTest.php

示例10: getMockAdapterWithResult

 public function getMockAdapterWithResult($returnValue)
 {
     $resultSet = new ResultSet();
     $resultSet->initialize($returnValue);
     $mockAdapter = $this->getMockAdapter();
     $mockAdapter->expects($this->once())->method('query')->will($this->returnValue($resultSet));
     return $mockAdapter;
 }
开发者ID:Zundrium,项目名称:queuevideo,代码行数:8,代码来源:MySQLDataMapperTest.php

示例11: indexAction

 public function indexAction()
 {
     // instansiation d'une session d'admin (duré = 30 Jrs)
     $session = new Container('admin');
     // tester si une session 'email existe '
     if ($session->offsetExists('email') && $session->offsetGet('user') == 'admin') {
         //Prepare statistique information pour la vue Index ->des statistiques
         $adapter = $this->getServiceLocator()->get('Zend\\Db\\Adapter\\Adapter');
         $sql1 = "select COUNT(pro_user.id) AS 'a' FROM pro_user";
         $sql2 = "select COUNT(pro_company.id) AS 'b' FROM pro_company";
         $sql3 = "select COUNT(pro_invoice.id) AS 'c' FROM pro_invoice";
         $sql4 = "select COUNT(pro_paid.id)    AS 'd' FROM pro_paid";
         $sql5 = "select COUNT(pro_product.id) AS 'e' FROM pro_product";
         $sql6 = "select COUNT(pro_product_bdma.id_product_bdma) AS 'f' FROM pro_product_bdma";
         $sql7 = "select * FROM product_bdma_price_history";
         $statement1 = $adapter->query($sql1);
         $statement2 = $adapter->query($sql2);
         $statement3 = $adapter->query($sql3);
         $statement4 = $adapter->query($sql4);
         $statement5 = $adapter->query($sql5);
         $statement6 = $adapter->query($sql6);
         $statement7 = $adapter->query($sql7);
         $results1 = $statement1->execute();
         $results2 = $statement2->execute();
         $results3 = $statement3->execute();
         $results4 = $statement4->execute();
         $results5 = $statement5->execute();
         $results6 = $statement6->execute();
         $results7 = $statement7->execute();
         $row1 = $results1->current();
         $row2 = $results2->current();
         $row3 = $results3->current();
         $row4 = $results4->current();
         $row5 = $results5->current();
         $row6 = $results6->current();
         // resultset7 vas être déclaré ci dessous pour plus de manipulation
         //tester si les variables rouX ont bien remplis
         if (!$row1 || !$row2 || !$row3 || !$row4 || !$row5 || !$row6) {
             //redirection vers l'index avec un message GET var
             $this->redirect()->toRoute('admin', array('action' => 'index'), array('query' => array('status' => 'erreur_fetching_statis_data')));
         } else {
             // 1 preparation des données array list
             $statisticData = array('user' => $row1['a'], 'company' => $row2['b'], 'invoice' => $row3['c'], 'paid' => $row4['d'], 'product' => $row5['e'], 'productav' => $row6['f']);
             // 2 preparation des donnees  result sett , retourne un mass d'information
             if ($results7 instanceof ResultInterface && $results7->isQueryResult()) {
                 //instanciation  de la class result set pour l'enregistrement des information fournis par la BD
                 $resultSet = new ResultSet();
                 $resultSet->initialize($results7);
                 //  redirection vers la vue index avec les information des statistiques
                 return new ViewModel(array('statistic' => $statisticData, 'history' => $resultSet));
             }
         }
     } else {
         //si la session n'existe pas ,, donc la redirection vers login page pour l'authentification avec un petit message
         $this->redirect()->toRoute('admin', array('action' => 'login'), array('query' => array('status' => 'u_login')));
     }
 }
开发者ID:SoufianeAr,项目名称:bdma-backend,代码行数:57,代码来源:AdminController.php

示例12: checkActivationCode

 /**
  * Check activation code
  *
  * @param integer $userId
  * @param string $activationCode
  * @return boolean
  */
 public function checkActivationCode($userId, $activationCode)
 {
     $select = $this->select();
     $select->from('user_list')->columns(['user_id'])->where(['user_id' => $userId, 'activation_code' => $activationCode]);
     $statement = $this->prepareStatementForSqlObject($select);
     $resultSet = new ResultSet();
     $resultSet->initialize($statement->execute());
     return $resultSet->current() ? true : false;
 }
开发者ID:spooner77,项目名称:dream-cms,代码行数:16,代码来源:UserWidget.php

示例13: getActivatedActions

 /**
  * Get activated actions
  *
  * @return \Zend\Db\ResultSet\ResultSet
  */
 public function getActivatedActions()
 {
     $select = $this->select();
     $select->from(['a' => 'action_tracker_connection'])->columns(['action_id'])->join(['b' => 'application_event'], 'a.action_id = b.id', ['name'])->join(['c' => 'application_module'], new Expression('b.module = c.id and c.status = ?', [self::MODULE_STATUS_ACTIVE]), []);
     $statement = $this->prepareStatementForSqlObject($select);
     $resultSet = new ResultSet();
     $resultSet->initialize($statement->execute());
     return $resultSet;
 }
开发者ID:esase,项目名称:dream-cms-action-tracker-module,代码行数:14,代码来源:ActionTrackerBase.php

示例14: getImages

 /**
  * Get images
  *
  * @param integer $category
  * @return \Zend\Db\ResultSet\ResultSet
  */
 public function getImages($category)
 {
     $select = $this->select();
     $select->from('slideshow_image')->columns(['id', 'description', 'image', 'url'])->where(['category_id' => $category])->order('order');
     $statement = $this->prepareStatementForSqlObject($select);
     $resultSet = new ResultSet();
     $resultSet->initialize($statement->execute());
     return $resultSet;
 }
开发者ID:esase,项目名称:dream-cms-slideshow-module,代码行数:15,代码来源:SlideshowWidget.php

示例15: getMessages

 /**
  * Get messages
  *
  * @param integer $limit
  * @return \Zend\Db\ResultSet\ResultSet
  */
 public function getMessages($limit)
 {
     $select = $this->select();
     $select->from('application_email_queue')->columns(['id', 'email', 'title', 'message'])->limit($limit)->order('id');
     $statement = $this->prepareStatementForSqlObject($select);
     $resultSet = new ResultSet();
     $resultSet->initialize($statement->execute());
     return $resultSet;
 }
开发者ID:esase,项目名称:dream-cms,代码行数:15,代码来源:ApplicationEmailQueue.php


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