Symfony Leftjoin createQueryBuilder Error

Asked

Viewed 14 times

-1

I’m trying to run this query,

Query com LEFT JOIN

My relationship is not explicit between Customer and Competitor;

inserir a descrição da imagem aqui

I’m getting this error, that I can’t get details of what’s going on, I can’t get the $queryBuilder->getQuery()->getSQL().

ERRO ao executar o $queryBuilder->getQuery()->getResult(1)

this image of the query I made in the group and try to replicate in Doctrine:

Query no banco de dados

some hint of how to run this Leftjoin?

thank you.

  • I haven’t programmed in PHP for many years and I don’t even use any framework like symfony. But, a suggestion I give you, first thing: Do the SQL query right in the database for what you need. Then, see if there is a feature in Symphony that allows you to show the generated SQL to test in the database and check if the command works with the expected results. Compare the two queries. If it doesn’t work you will find the error but easily. If you put this inside a Try-catch cannot capture the exception?

  • @Matthew I generated the desired query in the database, and it works perfectly. this penultimate photo is from Try catch with the error returned. added the photo with the query I did in the databank.

1 answer

0

I adjusted the SQL:

I switched to WITH, I didn’t understand the difference yet. I’ll research.

Ajustei e funcionou

Browser other questions tagged

You are not signed in. Login or sign up in order to post.