I have two tables, one containing cities and one containing countries. Every city is linked to a country by a ManyToOne relation (via field country_id) to a country.
What I need to do now is, to render a list of every country form this database with all cities linked to it.
Can't figure out, how to build this query using doctrine.
Add OneToMany relation to country between city and country, then:
Have a look at the OneToMany bi-directional setup
http://docs.doctrine-project.org/projects/doctrine-orm/en/2.0.x/reference/association-mapping.html#one-to-many-bidirectional
Here is an example using annotations :
You need to set this up to allow the
$country->getCities()
method to work