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


PHP Doctrine_Query::fetchArray方法代码示例

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


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

示例1: testTicket

 public function testTicket()
 {
     $q = new Doctrine_Query();
     // simple query with deep relations
     $q->addSelect('Resume.id, Level.id, Level.label')->from('ticket384_Resume Resume')->leftJoin('Resume.KnownLanguages KnownLanguages')->leftJoin('KnownLanguages.Level Level')->leftJoin('KnownLanguages.Language Language');
     try {
         // get the wrong resultset
         $aResult = $q->fetchArray();
         $this->fail();
     } catch (Doctrine_Query_Exception $e) {
         $this->pass();
     }
     $q->free();
     // now correct
     // we have to select at least KnownLanguages.id in order to get the Levels,
     // which are only reachable through the KnownLanguages, hydrated properly.
     $q = new Doctrine_Query();
     $q->addSelect('Resume.id, Level.id, Level.label, KnownLanguages.id')->from('ticket384_Resume Resume')->leftJoin('Resume.KnownLanguages KnownLanguages')->leftJoin('KnownLanguages.Level Level')->leftJoin('KnownLanguages.Language Language');
     $aResult = $q->fetchArray();
     // should be setted
     $bSuccess = isset($aResult[0]['KnownLanguages'][0]['Level']);
     $this->assertTrue($bSuccess);
     if (!$bSuccess) {
         $this->fail('fetchArray doesnt hydrate nested child relations, if parent doesnt have a column selected');
     }
 }
开发者ID:dennybrandes,项目名称:doctrine1,代码行数:26,代码来源:384TestCase.php

示例2: fetchArray

 public function fetchArray($params = array())
 {
     $breadcrumb = $this->getBreadcrumb();
     $result = parent::fetchArray($params);
     $this->restoreBreadcrumb($breadcrumb);
     return $result;
 }
开发者ID:JoshuaEstes,项目名称:sfDoctrineExtraPlugin,代码行数:7,代码来源:Query.php

示例3: testTicket

 /**
  * Test the existence expected indexes
  */
 public function testTicket()
 {
     $q = new Doctrine_Query();
     // simple query with deep relations
     $q->addSelect('Resume.id, Person.id, Person.name, KnownLanguages.id, Level.label, Language.label')->from('ticket912_Resume Resume')->leftJoin('Resume.Person Person')->leftJoin('Resume.KnownLanguages KnownLanguages')->leftJoin('KnownLanguages.Level Level')->leftJoin('KnownLanguages.Language Language');
     $aResult = $q->fetchArray();
     // should be setted..
     $issetLevel = isset($aResult[0]['KnownLanguages'][0]['Level']);
     $issetLanguage = isset($aResult[0]['KnownLanguages'][0]['Language']);
     $this->assertTrue($issetLevel);
     $this->assertTrue($issetLanguage);
 }
开发者ID:swk,项目名称:bluebox,代码行数:15,代码来源:912TestCase.php

示例4: _authenticateQuerySelect

 /**
  * _authenticateQuerySelect() - This method accepts a Doctrine_Query object and
  * performs a query against the database with that object.
  *
  * @param Doctrine_Query $dbSelect
  * @throws Zend_Auth_Adapter_Exception - when a invalid select object is encoutered
  * @return array
  */
 protected function _authenticateQuerySelect(Doctrine_Query $dbSelect)
 {
     try {
         $resultIdentities = $dbSelect->fetchArray();
     } catch (Exception $e) {
         /**
          * @see Zend_Auth_Adapter_Exception
          */
         require_once 'Zend/Auth/Adapter/Exception.php';
         throw new Zend_Auth_Adapter_Exception('The supplied parameters to Zend_Auth_Adapter_Doctrine_Record failed to ' . 'produce a valid sql statement, please check table and column names ' . 'for validity.');
     }
     return $resultIdentities;
 }
开发者ID:vbryan,项目名称:Zend,代码行数:21,代码来源:DoctrineAuthAdapter.php

示例5: _authenticateQuerySelect

	/**
	 * _authenticateQuerySelect() - This method accepts a Zend_Db_Select object and
	 * performs a query against the database with that object.
	 *
	 * @param Doctrine_Query $query
	 * @throws Zend_Auth_Adapter_Exception - when an invalid select
	 *                                       object is encountered
	 * @return array
	 */
	protected function _authenticateQuerySelect(Doctrine_Query $query) {
		// Run optional treatment before passing in credential to the query
		$credential = $this->getTreatedCredential();
		try {
			$resultIdentities = $query->fetchArray(array(':credential' => $credential));
		} catch (Exception $e) {
			/**
			 * @see Zend_Auth_Adapter_Exception
			 */
			require_once 'Zend/Auth/Adapter/Exception.php';
			throw new Zend_Auth_Adapter_Exception('The supplied parameters to Void_Auth_Adapter_Doctrine failed to '
			. 'produce a valid SQL statement, please check table and column names '
			. 'for validity.', 0, $e);
		}

		return $resultIdentities;
	}
开发者ID:niieani,项目名称:nandu,代码行数:26,代码来源:Doctrine.php


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