Skip to content
Advertisement

Trying to join 2 different entities in different bundles, failed

I’m trying to launch a query in Symfony2 (I’m quite new), where I need to join two different entities, in different bundles:

  • Candc/ComercioBundle/Entity/Venta/ItemVentaCarta And
  • Candc/ProductoBundle/Entity/Producto.

They have a relation manytoone-onetomany.

And:

This is the query I’m launching:

I’m in Symfony 2.7.7 and the exception I get is that one:

[Semantical Error] line 0, col 105 near ‘p WHERE’: Error: Class CandcComercioBundleEntityVentaItemVentaCarta has no association named producto

(I tried both producto and Producto, to avoid Typo errors) Also searched in the forum, founded many post related, but cant solve it.

I cleared cache, and also tried a schema update, but I get a message that says:

“there’s nothing to update buddy, your db is already sync with the entity metadata”

Advertisement

Answer

Hi DQL is bound to the object properties, not the mapped entity name, please update your code by doing the following:

Also, it looks like your query needs changing to:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement