Page 1 of 1

Relationships between table objects

Posted: Wed Nov 25, 2009 4:13 pm
by thinsoldier
I'm working on a system where a HomeOwner can have multiple Pets, Employees, and Vehicles
I have a class for each of those.

I'm wondering which is best for deleting a record:

Code: Select all

$homeOwner->deletePetByID( $petID );
or
$Pets->deleteByID( $petID, $ownerID );
the reason being that you have to specify WHERE pet_id=X AND ownder_id=X in the pets table in order to be allowed to delete a pet
Same goes for employees and cars.