My application is growing in complexity, and I'm finding that going from ORM entities directly to the view is insufficient.
I want to add models. They will take the data from my ORM entities, but also add some functionality. For example, my User ORM entity has an endDate property and a trial property. I'd like to add an isExpired method that ensures
- The
endDateis later than today, and trialis false
(This is a simple example. My requirements are much more complex, which is why I want to move the logic outside of the view.)
What is the correct way to do this? Say I make a UserModel class. Will the User object be a property on that class, in addition to my other properties/methods? Will I be able to preserve Doctrines ability to fetch all objects in a single query?