symfony 框架报错Unknown relation aliass

就是这句代码报的错:

$q = Doctrine_Query::create->fromFzAnswerquestionResult r->leftJoinr.FzUsers u ON r.fb_id = u.user_id ->groupByr.fb_id->wherer.is_delete = 0 and u.province = ".$province." and r.end_time >= .$starttime. and r.end_time <= .$endtime;
500 | Internal Server Error | Doctrine_Table_Exception
Unknown relation alias FzUsers
stack trace at in SF_ROOT_DIRlibsymfonylibpluginssfDoctrinePluginlibvendordoctrineDoctrineRelationParser.php line 237 ... return $this->getRelation$alias, false; } else { throw new Doctrine_Table_ExceptionUnknown relation alias . $alias; } } at Doctrine_Relation_Parser->getRelationFzUsers, in SF_ROOT_DIRlibsymfonylibpluginssfDoctrinePluginlibvendordoctrineDoctrineRelationParser.php line 235 ... at Doctrine_Relation_Parser->getRelationFzUsers, 1 in SF_ROOT_DIRlibsymfonylibpluginssfDoctrinePluginlibvendordoctrineDoctrineTable.php line 1001 ... at Doctrine_Table->getRelationFzUsers in SF_ROOT_DIRlibsymfonylibpluginssfDoctrinePluginlibvendordoctrineDoctrineQuery.php line 1762 ... at Doctrine_Query->loadr.FzUsers u ON r.fb_id = u.user_id in SF_ROOT_DIRlibsymfonylibpluginssfDoctrinePluginlibvendordoctrineDoctrineQueryFrom.php line 88 ... at Doctrine_Query_From->parseLEFT JOIN r.FzUsers u ON r.fb_id = u.user_id in SF_ROOT_DIRlibsymfonylibpluginssfDoctrinePluginlibvendordoctrineDoctrineQueryAbstract.php line 2084 ... at Doctrine_Query_Abstract->_processDqlQueryPartfrom, arrayFzAnswerquestionResult r, LEFT JOIN r.FzUsers u ON r.fb_id = u.user_id in SF_ROOT_DIRlibsymfonylibpluginssfDoctrinePluginlibvendordoctrineDoctrineQuery.php line 1183 ... at Doctrine_Query->buildSqlQuery in SF_ROOT_DIRlibsymfonylibpluginssfDoctrinePluginlibvendordoctrineDoctrineQuery.php line 1149 ... at Doctrine_Query->getSqlQueryarray, in SF_ROOT_DIRlibsymfonylibpluginssfDoctrinePluginlibvendordoctrineDoctrineQuery.php line 2042 ... at Doctrine_Query->getCountSqlQuery in SF_ROOT_DIRlibsymfonylibpluginssfDoctrinePluginlibvendordoctrineDoctrineQuery.php line 2132 ... at Doctrine_Query->count in SF_ROOT_DIRlibmodeldoctrineFzAnswerquestionResult.class.php line 400 ... at FzAnswerquestionResult->getFbThisIssueUserNumByProvince北京, 1388332800, 1397475117 in SF_ROOT_DIRappsfrontendmodulesexamactionsactions.class.php line 1313 ... at examActions->executeFbExamProvinceRankobjectsfWebRequest in SF_ROOT_DIRlibsymfonylibactionsfActions.class.php line 60 ... } // run action return $this->$actionToRun$request; } } at sfActions->executeobjectsfWebRequest in SF_ROOT_DIRlibsymfonylibfiltersfExecutionFilter.class.php line 92 ... at sfExecutionFilter->executeActionobjectexamActions in SF_ROOT_DIRlibsymfonylibfiltersfExecutionFilter.class.php line 78 ... at sfExecutionFilter->handleActionobjectsfFilterChain, objectexamActions in SF_ROOT_DIRlibsymfonylibfiltersfExecutionFilter.class.php line 53 ... at sfExecutionFilter->executeobjectsfFilterChain in SF_ROOT_DIRlibsymfonylibfiltersfFilterChain.class.php line 53 ... at sfFilterChain->execute in SF_ROOT_DIRlibsymfonylibfiltersfRenderingFilter.class.php line 33 ... at sfRenderingFilter->executeobjectsfFilterChain in SF_ROOT_DIRlibsymfonylibfiltersfFilterChain.class.php line 53 ... at sfFilterChain->execute in SF_ROOT_DIRlibsymfonylibcontrollersfController.class.php line 238 ... at sfController->forwardexam, FbExamProvinceRank in SF_ROOT_DIRlibsymfonylibcontrollersfFrontWebController.class.php line 48 ... at sfFrontWebController->dispatch in SF_ROOT_DIRlibsymfonylibutilsfContext.class.php line 170 ... at sfContext->dispatch in SF_ROOT_DIRwebindex.php line 7 ... symfony settings ...
request ...
response ...
user ...
global vars ... symfony v.1.4.17 - php 5.2.6
for help resolving this issue, please visit http://www.symfony-project.org/. 

http://docs.doctrine-project.org/en/2.0.x/reference/query-builder.html

应该是这样的吧:

Doctrine_Query::create
->fromFzAnswerquestionResult r
->leftJoinr.FzUsers, u

发表评论

电子邮件地址不会被公开。 必填项已用*标注