$qb = $em->createQueryBuilder(); $qb ->select('c', 'o') ->from('Customer', 'c') ->leftJoin('c.orders', 'o') ->getQuery();
$qb = $em->createQueryBuilder(); $qb ->select('p', 'c') ->from('Product', 'p') ->leftJoin('p.category', 'c') ->getQuery();This query selects all columns from the Product table and the Category table, joining them on the category_id column in Product. The left join ensures that all products are returned, even if they have no category. The package library for Doctrine Query is the Doctrine ORM (Object-Relational Mapping) library. This library provides a powerful mapping between object-oriented code and relational databases, making it easy to work with databases using PHP.