Convert sql to dql for the symfony query builder

I cannot succeed alone in transforming my SQL query (which works very well) into DQL for symfony. Ideas ?

SELECT
    t0.id AS id, t0.name AS name, t0.slug AS slug 
FROM
    activity t0 
INNER JOIN
    pack_activity ON t0.id = pack_activity.activity_id 
WHERE
    pack_activity.pack_id = 1

For another request I succeeded, but this one I do not succeed: /

public function findLocation()
    {
        return $this->createQueryBuilder('t')
            ->leftJoin('t.types', 'tc')
            ->where('tc.id = 4')
            ->getQuery()
            ->getResult();

    }

Thanks !

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *