[eluser]msteudel[/eluser]
I have a three table many-to-many relationship:
Code:
sites
id | site_name
locations
id | location_name
locations_sites
site_id | location_id
I'm trying to delete all the locations associated with a specific site. I tried to do it like so:
Code:
$site = new Site();
$site->where( 'id', $site_id )->get();
$location = new Location();
$locations = $location->where( 'site_id', $site_id )->get();
foreach( $locations as $l ) {
echo $l->location_name . ' ';
}
$site->delete( $locations );
But it's not deleting the associated locations. I feel like I'm close ...
TIA