$query = $this->getEntityManager()->createQueryBuilder();
$query->select('i','u', 'e')
->from('Rangos\Entity\usuariosIdentidade','i')
->innerJoin("i.userIUser", 'u')
->join("Rangos\Entity\UsuariosEndereco", 'e')
->where("e.userEndUser", 'u.userId');
$result = $query->getQuery()->execute();
Em segunda-feira, 24 de fevereiro de 2014 16h19min12s UTC-3, João Carlos
Santa Ana escreveu:
>
> OK, excuse my bad english.
> But I need to bring several tables 1,2,3,4 with reference to a table.
> Where tables 1,2,3,4 contains id of the reference table.
> In DTL consulting encontri not this formula. can help an example?
> thank you
>
> Em segunda-feira, 24 de fevereiro de 2014 15h57min44s UTC-3, Herman Peeren
> escreveu:
>>
>> This mailing list is in English. Obrigado!
>>
>> What you are doing wrong here is: defining an ON-clause. That is how
>> you'd do it in SQL. In DQL however you define the relationship between your
>> entities in the mapping-information (via annotations, xml, yaml or php) and
>> in the query you use that relationship. So: define a OneToOne, OneToMany,
>> ManyToOne or ManyToMany relationship and use that in the query (and
>> consequently no need to use a ON).
>>
>>
>> On Monday, 24 February 2014 19:46:41 UTC+1, João Carlos Santa Ana wrote:
>>>
>>> Alguém ajuda por favor.
>>>
>>> Tenho varias tabelas: endereco, identidade, cartao, contato, debitos ....
>>> Todas com o id da tabela do usuario.
>>>
>>> preciso fazer uma consulta que traga todas as tabelas relacionadas de
>>> uma vez.
>>>
>>> Tentei fazer uma consulta simples:
>>>
>>> $query = $this->em->createQuery("SELECT i, e FROM
>>> R\Entity\UsuariosIdentidade as i "
>>> . " JOIN R\Entity\UsuariosEndereco as e ON
>>> e.userEndUser = i.userIUser ");
>>> $result = $query->getResult();
>>>
>>> Recebo este erro:
>>> OBS: SILEX
>>>
>>> QueryException: [Semantical Error] line 0, col 92 near 'as e ON
>>> e.userEndUser': Error: Identification Variable R\Entity\UsuariosEndereco
>>> used in join path expression but was not defined before.
>>>
>>> Alguem pode dar alguma direção do que devo fazer para conseguir uma
>>> query que me traga todas as tabela seja com createQueryBuilder, createQuery
>>> ou EntityRepository;
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/groups/opt_out.