I'm used to using MVC where models can serialise themselves (into an
array, which is easily JSON-able).

I'm trying to build an API app where multiple views in multiple
modules serialise the same object. I can easily add that code to the
model, which works fine. However the problem arises when I try and add
a URL (created using url_for) to the serialised object. This only
seems to work from the view.

So does this mean the serialisation logic really should go in the
view? If so I want to create a helper function called
serialiseMyModel($model) that can be called from the multiple views.
Where can I create this so that it's available to all the views?

(I know you can call genUrl() from a controller, but the same problem
persists there about sharing the code)

Thanks!

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to