I think that Symfony2 lacks the concept of ViewModel (e.g. ASP.NET MVC Framework), i.e. the model associated with the view. Symfony2 (as documentation) usually assigns an array to the view .
A view model may be a PHP class, but it is something different from a form model, and sometimes the same as a domain object. This is sometimes useful when working with a lot of information to display.
Anyway, is there any agreement on where presentation models should go in Symfony2? Any specific folder? To date, I have:
Symfony2/src/MyCompany/MyBundle/Form/Model
which contains models associated with forms. AND:
Symfony2/src/MyCompany/MyBundle/Entity
for domain objects (limited by database tables).
Suggestions are greatly appreciated. What about Symfony2/src/MyCompany/MyBundle/Model?
gremo source
share