本文整理汇总了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');
}
}
示例2: fetchArray
public function fetchArray($params = array())
{
$breadcrumb = $this->getBreadcrumb();
$result = parent::fetchArray($params);
$this->restoreBreadcrumb($breadcrumb);
return $result;
}
示例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);
}
示例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;
}
示例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;
}