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


PHP ResultSet::toArray方法代碼示例

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


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

示例1: 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:razvansividra,項目名稱:pnlzf2-1,代碼行數:8,代碼來源:ResultSetIntegrationTest.php

示例2: getUnusedCategories

 /**
  * Get unused categories
  *
  * @param integer $limit
  * @return array
  */
 public function getUnusedCategories($limit)
 {
     $select = $this->select();
     $select->from('slideshow_category')->columns(['id', 'name'])->limit($limit)->where->and->isNull('language');
     $statement = $this->prepareStatementForSqlObject($select);
     $resultSet = new ResultSet();
     $resultSet->initialize($statement->execute());
     return $resultSet->toArray();
 }
開發者ID:esase,項目名稱:dream-cms-slideshow-module,代碼行數:15,代碼來源:SlideshowBase.php

示例3: getEmptyTransactions

 /**
  * Get all empty transactions
  *
  * @param integer $limit
  * @return array
  */
 public function getEmptyTransactions($limit)
 {
     $predicate = new Predicate();
     $select = $this->select();
     $select->from(['a' => 'payment_transaction_list'])->columns(['id', 'slug'])->join(['b' => 'payment_transaction_item'], 'a.id = b.transaction_id', [], 'left')->where([$predicate->isNull('b.transaction_id')])->group('a.id')->limit($limit);
     $statement = $this->prepareStatementForSqlObject($select);
     $resultSet = new ResultSet();
     $resultSet->initialize($statement->execute());
     return $resultSet->toArray();
 }
開發者ID:esase,項目名稱:dream-cms-payment-module,代碼行數:16,代碼來源:PaymentConsole.php

示例4: getExpiredMembershipsConnections

 /**
  * Get all expired memberships connections
  *
  * @param integer $limit
  * @return array
  */
 public function getExpiredMembershipsConnections($limit)
 {
     $predicate = new Predicate();
     $select = $this->select();
     $select->from(['a' => 'membership_level_connection'])->columns(['id', 'user_id'])->join(['b' => 'membership_level'], 'a.membership_id = b.id', ['role_id'], 'left')->join(['c' => 'user_list'], 'a.user_id = c.user_id', ['nick_name', 'email', 'language'])->join(['d' => 'acl_role'], 'd.id = b.role_id', ['role_name' => 'name'], 'left')->limit($limit)->where(['a.active' => self::MEMBERSHIP_LEVEL_CONNECTION_ACTIVE, $predicate->lessThanOrEqualTo('a.expire_date', time())])->where->or->equalTo('a.active', self::MEMBERSHIP_LEVEL_CONNECTION_ACTIVE)->and->isNull('a.membership_id');
     $statement = $this->prepareStatementForSqlObject($select);
     $resultSet = new ResultSet();
     $resultSet->initialize($statement->execute());
     return $resultSet->toArray();
 }
開發者ID:esase,項目名稱:dream-cms-membership-module,代碼行數:16,代碼來源:MembershipConsole.php

示例5: sequence

 protected function sequence($sequence)
 {
     return $this->generateCode(function () use($sequence) {
         $query = $this->getTableGateway()->adapter->getDriver()->createStatement("SELECT currval('{$sequence}') AS retorno")->execute();
         $resultSet = new ResultSet();
         $resultSet->initialize($query);
         $retorno = $resultSet->toArray();
         return $retorno[0]['retorno'];
     });
 }
開發者ID:bhcosta90,項目名稱:zend,代碼行數:10,代碼來源:Table.php

示例6: toArray

 public function toArray()
 {
     if ($this->dataSource instanceof Result) {
         return $this->dataSource->getResource()->fetchAll(\PDO::FETCH_ASSOC);
     }
     // todo: реализовать подгрузку mysqli значений
     //		if ($this->dataSource instanceof \Zend\Db\Adapter\Driver\Mysqli\Result) {
     //			$this->dataSource->getResource()
     //		}
     return parent::toArray();
 }
開發者ID:Maxlander,項目名稱:shixi,代碼行數:11,代碼來源:ResultSet.php

示例7: select

 public function select($where)
 {
     $sql = $this->tableGateway->getSql();
     $select = $this->tableGateway->getSql()->select();
     $select->where($where);
     $statement = $sql->prepareStatementForSqlObject($select);
     $results = $statement->execute();
     $resultSet = new ResultSet();
     $resultSet->initialize($results);
     return $resultSet->toArray();
 }
開發者ID:shadihrr,項目名稱:daraii,代碼行數:11,代碼來源:TransactionTable.php

示例8: getIntitulesConditionReglement

 public function getIntitulesConditionReglement($sm)
 {
     $query = "SELECT intitule_condition_reglement\n             FROM condition_reglement";
     $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,代碼行數:12,代碼來源:ConditionReglement.php

示例9: getEligibleDispoRecipient

 public function getEligibleDispoRecipient()
 {
     $sql = $this->getObjDbSql();
     $select = $sql->select();
     $select->columns(array('u_kode', 'u_nama', 'u_kode_fungsional', 'u_gelar_diplomatik', 'u_urutan'));
     $select->from($this->table);
     $select->where(array('u_status=1', 'u_urutan > 0'));
     $select->order('u_urutan ASC');
     $statement = $sql->prepareStatementForSqlObject($select);
     $result = $statement->execute();
     $resultSet = new ResultSet();
     $resultSet->initialize($result);
     return $resultSet->toArray();
 }
開發者ID:vatoer,項目名稱:EOfficeZf2,代碼行數:14,代碼來源:UserDbTable.php

示例10: getTotal

 /**
  * Определить число записей.
  * @param $adapter (адаптер к базе или таблица)
  * @param string $sql (если адаптер, то текст запроса, иначе не использовать)
  * @return integer
  */
 private function getTotal($adapter, $sql = null)
 {
     if ($adapter instanceof TableGateway) {
         $table = $adapter;
         $select = $table->getSql()->select()->columns(array("count" => new Expression("count(*)")));
         $totalSet = $table->selectWith($select);
     } else {
         $statement = $adapter->createStatement($sql);
         $totalSet = new ResultSet();
         $totalSet->initialize($statement->execute());
     }
     $total = $totalSet->toArray();
     $total = $total[0]["count"];
     return (int) $total;
 }
開發者ID:khusamov-dump,項目名稱:dump,代碼行數:21,代碼來源:ContractorsController.php

示例11: getAll

 /**
  * Get all countries.
  * 
  * @param string|null $continentCode The continent code
  * @return array
  */
 public function getAll($continentCode = null)
 {
     $sql = new Sql($this->adapter);
     $select = $sql->select('iso_3166_1');
     if (null !== $continentCode) {
         $select->where(array('continent_alpha_2' => $continentCode));
     }
     $statement = $sql->prepareStatementForSqlObject($select);
     $result = $statement->execute();
     if ($result instanceof ResultInterface && $result->isQueryResult()) {
         $resultSet = new ResultSet();
         $resultSet->initialize($result);
         return $resultSet->toArray();
     }
     return array();
 }
開發者ID:zend-modules,項目名稱:isocodes-country,代碼行數:22,代碼來源:ZendDB.php

示例12: getClasses

 /**
  * Get all classes
  *
  * @return array
  */
 public function getClasses()
 {
     // generate cache name
     $cacheName = CacheUtility::getCacheName(self::CACHE_XMLRPC_CLASSES);
     // check data in cache
     if (null === ($classes = $this->staticCacheInstance->getItem($cacheName))) {
         $select = $this->select();
         $select->from(['a' => 'xmlrpc_class'])->columns(['namespace', 'path', 'module'])->join(['b' => 'application_module'], new Expression('a.module = b.id and b.status = ?', [self::MODULE_STATUS_ACTIVE]), []);
         $statement = $this->prepareStatementForSqlObject($select);
         $resultSet = new ResultSet();
         $resultSet->initialize($statement->execute());
         $classes = $resultSet->toArray();
         // save data in cache
         $this->staticCacheInstance->setItem($cacheName, $classes);
         $this->staticCacheInstance->setTags($cacheName, [self::CACHE_XMLRPC_DATA_TAG]);
     }
     return $classes;
 }
開發者ID:spooner77,項目名稱:dream-cms,代碼行數:23,代碼來源:XmlRpc.php

示例13: getDefaultActiveLayouts

 /**
  * Get default active layouts
  *
  * @return array
  */
 public function getDefaultActiveLayouts()
 {
     // generate cache name
     $cacheName = CacheUtility::getCacheName(self::CACHE_LAYOUTS_ACTIVE);
     // check data in cache
     if (null === ($layouts = $this->staticCacheInstance->getItem($cacheName))) {
         $defaultActiveCustomLayout = (int) SettingService::getSetting('layout_active');
         $select = $this->select();
         $select->from('layout_list')->columns(['name'])->order('type')->where(['type' => self::LAYOUT_TYPE_SYSTEM]);
         if ($defaultActiveCustomLayout) {
             $select->where->or->equalTo('id', $defaultActiveCustomLayout)->and->equalTo('type', self::LAYOUT_TYPE_CUSTOM);
         }
         $statement = $this->prepareStatementForSqlObject($select);
         $resultSet = new ResultSet();
         $resultSet->initialize($statement->execute());
         $layouts = $resultSet->toArray();
         // save data in cache
         $this->staticCacheInstance->setItem($cacheName, $layouts);
         $this->staticCacheInstance->setTags($cacheName, [self::CACHE_LAYOUTS_DATA_TAG]);
     }
     return $layouts;
 }
開發者ID:esase,項目名稱:dream-cms,代碼行數:27,代碼來源:LayoutBase.php

示例14: getFooterMenu

 /**
  * Get footer menu
  * 
  * @param string $language
  * @return array
  */
 public function getFooterMenu($language)
 {
     $cacheName = CacheUtility::getCacheName(self::CACHE_FOOTER_MENU . $language);
     // check data in a cache
     if (null === ($footerMenu = $this->staticCacheInstance->getItem($cacheName))) {
         // get the footer menu
         $select = $this->select();
         $select->from(['a' => 'page_structure'])->columns(['slug', 'title', 'type'])->join(['b' => 'page_system'], 'b.id = a.system_page', ['system_title' => 'title'], 'left')->where(['a.footer_menu' => PageNestedSet::PAGE_IN_FOOTER_MENU, 'a.language' => $language])->order('a.footer_menu_order');
         $statement = $this->prepareStatementForSqlObject($select);
         $resultSet = new ResultSet();
         $resultSet->initialize($statement->execute());
         $footerMenu = $resultSet->toArray();
         // save data in cache
         $this->staticCacheInstance->setItem($cacheName, $footerMenu);
         $this->staticCacheInstance->setTags($cacheName, [self::CACHE_PAGES_DATA_TAG]);
     }
     return $footerMenu;
 }
開發者ID:spooner77,項目名稱:dream-cms,代碼行數:24,代碼來源:PageBase.php

示例15: getProduitsFinisId

 public function getProduitsFinisId($sm)
 {
     $id = $this->getId();
     if ($id) {
         $query = "SELECT ref_produit_fini\n                 FROM client_a_produit_fini\n                 WHERE ref_client = {$id}";
         $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,代碼行數:15,代碼來源:Client.php


注:本文中的Zend\Db\ResultSet\ResultSet::toArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。