我有一个名为evaulation_symptom的模块,我正在尝试创建新症状,但是当我单击 new( evaluation_symptom/new ) 时,它会引发以下错误:
500 | 内部服务器错误 | PropelException [wrapped: SQLSTATE[42000]: 语法错误或访问冲突:1064 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 1 行的“=evaluation_symptom.ID ORDER BY evaluation_symptom.ORD ASC,evaluation_cause.ORD”附近使用正确的语法]
我研究了代码,我注意到所有问题都在于名为getUbferredRemediesBySymptomId的EvaluationSymptomAdminPeer函数,特别是这一行$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;
}
上述函数的 ID 从EvaluationSymptomAdminForm传递为:
$inferredRemedies = EvaluationSymptomAdminPeer::getInferredRemediesBySymptomId($this->object->getPrimaryKey());