I have some query and I need in select block select id relation entity, how can I do it without some join, like in SQL? In example I add leftJoin but I want understand it's possible without join like lsc.serviceCompany.id or how ? 
        $qb
        ->select('
            ser_com.id as serviceCompanyId 
        ')
        ->from('AppBundle:LocationServiceCompany', 'lsc')
        ->leftJoin('lsc.serviceCompany', 'ser_com')
        ->where('lsc.serviceCompany = :sc')
        ->setParameter('sc', $serviceCompany);
                $qb->select(IDENTITY(lsc.serviceCompany)) (...)
Duplicate of this question
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With