Reputation: 992
So I'm trying to do a join in a query but doctrine is doing its usually and throwing back errors that are as useful as a broken leg.
Can anyone advice on where I am going wrong here. The error message I am getting; debug: [Syntax Error] line 0, col -1: Error: Expected Doctrine\ORM\Query\Lexer::T_IDENTIFIER, got end of string. in file "./vendor/symfony/doctrine-bridge/Messenger/DoctrineTransactionMiddleware.php" on line 64
Assessment entity
/**
* @var Candidate
* @ORM\ManyToOne(
* targetEntity="App\Domain\Candidate\Candidate",
* inversedBy="assessments")
* @ORM\JoinColumn(nullable=false)
*/
private $candidate;
Candidate entity
/**
* @var Assessment[]|Collection
* @ORM\OneToMany(
* targetEntity="App\Domain\Assessment\Assessment",
* mappedBy="candidate",
* cascade={"persist"})
* @ORM\JoinColumn(nullable=false)
*/
private $assessments;
Doctrine query
$qb = $this->entityManager->createQueryBuilder();
$qb->select('ca')
->from(Candidate::class, 'ca')
->innerJoin('ca.assessments', 'as');
Upvotes: 0
Views: 427
Reputation: 4611
You're using an alias in your join which is a reserved keyword (as
).
$qb->select('ca')
->from(Candidate::class, 'ca')
->innerJoin('ca.assessments', 'as'); // <-- change this alias
Change as
in your join to something else.
Upvotes: 1