As of the current EBNF, the syntax you used is invalid in Doctrine 2 ORM. You will have to join the related entity as following:
SELECT
p
FROM
Profile p
JOIN
p.user u
WHERE
u.username = :username
Question
I have two entities:
User
entity with two fields are: id
(@id), username
Profile
entity with two fields are: user
(@OneToOne,targetEntity="User"), fullname
But when I make a query try from things I read an JPA book:
SELECT p from Profile p where p.user.username = 'john'
It alerts to me a message:
[Syntax Error] line 0, col 55: Error: Expected =, <, <=, <>, >, >=, !=, got '.'
Solution
As of the current EBNF, the syntax you used is invalid in Doctrine 2 ORM. You will have to join the related entity as following:
SELECT
p
FROM
Profile p
JOIN
p.user u
WHERE
u.username = :username