Hey Sebastien, your intuition is right, those things don't belong in the model, as they differ from application to application. There are easy ways to have the best of both worlds though.
First, links to, say, a product I find pretty simple: link_to($product, "product_show", $product); However, if they do get more complex, I just add a view helper: link_to_product($product, "optional title here"); that encapsulates the logic for the given application. With regards to cache, you can either add a custom CacheManager class to house that code: CacheManager::clearProductCache($product); or you could put those methods into the application configuration and then call sfContext::getInstance() -> getConfiguration() -> clearProductCache($product); Make sense? Daniel On Oct 5, 9:24 pm, "Sebastien Armand [Pink]" <khe...@gmail.com> wrote: > Most of the times in symfony applications, we'll have a model let's say it's > 'Product' and then many interactions that I don't think belong to the model > part of the application still would be really convenient if you could write > them as $myModel->doThis() > > The kind of interaction I'm thinking about are more 'application' level. > For example I'll usually have a link to a page where this product is > displayed, and instead of having to write the url_for ('product_route', > $myProduct), it seems to me much more natural if I could write something > like $myProduct->getUrl(). > Same thing for removing bits of cache related to this product, it seems > correct in a way to write $myProduct->removeCachedElements(); or something > like this. > > However those interactions as I see them don't belong to the model, they are > much more linked with a higher presentational or web level of interaction. > > Just wondering how other people do things this way or not? -- 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