Relationships between table objects

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thinsoldier
Forum Contributor
Posts: 367
Joined: Fri Jul 20, 2007 11:29 am
Contact:

Relationships between table objects

Post 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.
Warning: I have no idea what I'm talking about.
Post Reply