I use doctrine to fetch data from the database. In my repository, I build the query
createQueryBuilder('p')
->select('p, bc, cp')
->innerJoin('p.customer', 'bc')
->innerJoin('bc.person', 'cp')
It works well for me, I get the data. But how can I say to doctrine to give me not all fields, but only certain fields, like p.id, p.name, cp.firstname etc?
Thank's for your answers.
$query->createQueryBuilder()
->select('p.id','p.name', 'bc.xyz', 'cp.xyz')
->from('entity','p')
->innerJoin('p.customer', 'bc')
->innerJoin('bc.person', 'cp');
This works for me
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