I have two tables, one containing cities and one containing countries. Those are bi-directional linked as discussed here: Symfony2: List cities by country
Every city has a flag called ‘public’. What I need to do now is, to list only countries that have cities, that are marked as ‘public’ and this public cities to every country.
If a country has no public cities, it should not be listed.
How to handle this problem best?
You should override the
$country->getCities($onlyPublic = true)method and place that logic in there.