table: users - id - first_name
table: clients - id - user_id - phone_number
class UserReminders
{
public function addReminder(User $objUser, string $strReminderText)
{
// Save reminder to database here
}
}
Situation: I'd like to save a reminder for a client. With ORM my 'Client' model would not be a descendant of the 'User' model so polymorphism would not be achievable and I would have to get the 'User' object for every client object to use this method.
My opinion: In the above situation I think the correct object oriented design would be for the client to extend the user as it is in fact a type of user. This leads me to believe it is not possible create a true object oriented application using ORM directly within the application for the reason highlighted above. I think ORM is great for making it easy to access the database so the only way I can see that it could be used is as a tool for properly object oriented models to query the database.
I would like to know if this is the opinion of many others?
Aucun commentaire:
Enregistrer un commentaire