0
if条件でクエリにジョインを追加したいが、エラーを返しました。 私たちは教義においてそれをどうやって行うことができますか? のようなものがあります: $ qb-> andWhere( 'p。$ gender =:g') - > setParameter( 'g'、$ gender); doctrine symfonyでの参加のための ??ドクトリンでqbの連結に参加する方法は?
$qb->select("p")->from("PfmSanadBundle:Person", "p");
if ((isset($province) && trim($province) !== '') && (isset($City) && trim($City) !== '')){
$qb->join("p" ,"students", "ps")
->join("ps" ,"organization", "po")
->join("po" ,"cityProvince", "pc")
->join("pc" ,"province", "pp");
}
if ((isset($province) && trim($province) !== '') && !isset($City)) {
$qb->join("p.students", "ps")
->join("ps.organization", "po");
}
$res = $qb->getQuery()->getArrayResult();
エラー(郵便配達):
"error": { "code": 500, "message": "Internal Server Error", "exception": [ { "message": "[Semantical Error] line 0, col 49 near 'p students INNER': Error: Class 'p' is not defined.", "class": "Doctrine\ORM\Query\QueryException", "trace": [ {
ありがとうございました。 – vahid