symfony抛出错误1064您的sql语法有错误

ni65a41a  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(302)

我有一个名为evaluation\u symptom的模块,我正在尝试创建新的症状,但当我单击new(evaluation\u symptom/new)时,它会抛出以下错误:
500 |内部服务器错误| proplexception[wrapped:sqlstate[42000]:语法错误或访问冲突:1064您的sql语法有错误;检查与您的mysql服务器版本对应的手册,以获得正确的语法,以便在第1行中使用“=evaluation\u symptom.id order by evaluation\u symptom.ord asc,evaluation\u cause.ord”]
我研究了代码,注意到所有的问题都存在于名为getubferredremediesbysymptomid的evaluationsympleAdminPeer函数中,特别是这行$criteria->addjoin(self::id,$id);

public static function getInferredRemediesBySymptomId($id)
  {
    $criteria = new Criteria();
    $criteria->addSelectColumn("evaluation_remedy.ID");
    $criteria->addSelectColumn("evaluation_remedy.TITLE");

    $criteria->addJoin(self::ID, EvaluationSymptomCausePeer::EVALUATION_SYMPTOM_ID, Criteria::LEFT_JOIN);
    $criteria->addJoin(EvaluationSymptomCausePeer::EVALUATION_CAUSE_ID, EvaluationCausePeer::ID, Criteria::LEFT_JOIN);
    $criteria->addJoin(EvaluationCausePeer::ID, EvaluationCauseRemedyPeer::EVALUATION_CAUSE_ID, Criteria::LEFT_JOIN);
    $criteria->addJoin(EvaluationCauseRemedyPeer::EVALUATION_REMEDY_ID, EvaluationRemedyPeer::ID, Criteria::LEFT_JOIN);
    $criteria->addJoin(self::ID, $id);

    $exCriteria = $criteria->getNewCriterion(self::IS_ACTIVE, 1);
    $exCriteria->addOr($criteria->getNewCriterion(EvaluationCausePeer::IS_ACTIVE, 1));
    $criteria->add($exCriteria);
    //$criteria->addAscendingOrderByColumn(self::ORD);
    //$criteria->addAscendingOrderByColumn(EvaluationCausePeer::ORD);
    $criteria->addAscendingOrderByColumn(self::ORD)->addAscendingOrderByColumn(EvaluationCausePeer::ORD);
    $records = self::doSelectStmt($criteria)->fetchAll(PDO::FETCH_ASSOC);
    $data = array();
    foreach ($records as $key => $record) {
      $data[$record['ID']] = $record['TITLE'];
    }
    return $data;
  }

从evaluationsymptomadminform传递给上述函数的id为:

$inferredRemedies = EvaluationSymptomAdminPeer::getInferredRemediesBySymptomId($this->object->getPrimaryKey());

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题