PHP / Symfony 问题 "Unknown record property"

PHP / Symfony issue "Unknown record property"

下面PHP执行代码抛出错误

$q = Doctrine::getTable('FormSurvey')->querySurveyByFormRequest($form_request);
$this->results = $q->execute();

public function querySurveyByFormRequest($form_request) {
      $q = Doctrine_Query::create();
      $q->from('FormSurvey FS');
      $q->leftJoin('FS.FormQuestion FQ');
      $q->leftJoin('FQ.Question Q');
      $q->leftJoin('Q.QuestionText QT');
      $q->leftJoin('Q.QuestionSingle QS');
      $q->leftJoin('Q.QuestionMultiple QM');
      $q->leftJoin('QT.Answers AT with AT.form_request_id = ?', $form_request->getId());
      $q->leftJoin('QS.AnswerSingle AS with AS.form_request_id = ?', $form_request->getId());
      $q->leftJoin('QM.AnswerMultiple AM with AM.form_request_id = ?', $form_request->getId());
      $q->where('FS.id = ?', $form_request->getFormSurveyId());
      $q->orderBy('FQ.displayOrder');
      return $q;
    }

$q->getSqlQuery() 查询字符串在 SQLYog 中工作正常,但当我们使用 PHP execute()

时,它抛出以下未知记录 属性 错误

错误信息

Unknown record property / related component "<pre>\nalias : FormSurvey\nforeign : id\nlocal : form_survey_id\nclass : FormSurvey\ntype : 0\ntable : Object(FormSurveyTable)\nlocalTable : Object(FormQuestionTable)\nname : \nrefTable : \nonDelete : \nonUpdate : \ndeferred : \ndeferrable : \nconstraint : \nequal : \ncascade : Array\nowningSide : \nrefClassRelationAlias : \nforeignKeyName : \norderBy : \n</pre>" on "FormQuestion", referer: system/applications/referenceforms.html

通过添加 $q->select('FS.*') 解决了上述问题;在查询之前,所以新查询是

      $q = Doctrine_Query::create();
      $q->select('FS.*');
      $q->from('FormSurvey FS');
      $q->leftJoin('FS.FormQuestion FQ');
      $q->leftJoin('FQ.Question Q');
      $q->leftJoin('Q.QuestionText QT');
      $q->leftJoin('Q.QuestionSingle QS');
      $q->leftJoin('Q.QuestionMultiple QM');
      $q->leftJoin('QT.Answers AT with AT.form_request_id = ?', $form_request->getId());
      $q->leftJoin('QS.AnswerSingle AS with AS.form_request_id = ?', $form_request->getId());
      $q->leftJoin('QM.AnswerMultiple AM with AM.form_request_id = ?', $form_request->getId());
      $q->where('FS.id = ?', $form_request->getFormSurveyId());
      $q->orderBy('FQ.displayOrder');
      return $q;