I have two entities, country and Province, and I have set up a many-to-one relation in the Province entity:
Entity/Province
/**
* @var \AppBundle\Entity\Country
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Country")
* @ORM\JoinColumn(name="ubicacionpaisid", referencedColumnName="id")
*
*/
private $ubicacionpaisid;
Here I get all results using the Province entity:
$cb = $this->getDoctrine()
->getEntityManager()
->getRepository(Province::class)
->createQueryBuilder('a');
However, if I run:
var_dump($cb->getQuery()->getDQL());
it returns:
string(41) "SELECT a FROM AppBundle\Entity\Province a"
What I expected to see was a query that joins the Country entity, into the Province entity in the SQL.
What am I missing ?