I have a mysql database with some tables in it. An example of two tables:
TABLE "dogtoilets"
- type
- location_id (FK)TABLE "locations"
- id
- latitude
- longitude
My question is how can I clear the table "dogtoilets and also clear the locations in my locations table that are linked to dogtoilets?
Tried this but locations don't delete ...
$dogtoilets = DogToiletQuery::create()
->leftJoinWith('Dogtoilet.Location')
->find();
$dogtoilets->delete();
Hope this help: http://en.wikipedia.org/wiki/Foreign_key#CASCADE
Cascade will only work when you delete row in "locations", it automatically delete related rows in "dogtoilets"
In this case you should delete manually using your code.