[symfony-users] Re: Having a web layer for the model

2010-10-07 Thread pghoratiu
You can have another layer of business logic classes that you store in lib/ which interact with your models directly. gabriel On Oct 6, 7:24 am, 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

Re: [symfony-users] Re: Having a web layer for the model

2010-10-07 Thread Gareth McCumskey
class WebModelClass extends ModelClass { public function __toString() { return this-getUrl(); } public function getUrl() { return Whatever I decide to do to generate URL here!; } public function initialiseForm() { //Whatever I want to do to initialise the correct form

Re: [symfony-users] Re: Having a web layer for the model

2010-10-07 Thread Bernhard Schussek
I rather prefer to compose than to subclass here. class ProductView { public function __construct(Product $product) { $this-product = $product; } public function setSelected($selected)... public function getUrl()... etc. } Bernhard -- If you want to report a vulnerability

Re: [symfony-users] Re: Having a web layer for the model

2010-10-07 Thread Sebastien Armand [Pink]
Bunch of nice ideas here! Gotta find how to make my own sauce now! On Thu, Oct 7, 2010 at 9:40 PM, Bernhard Schussek bschus...@gmail.comwrote: I rather prefer to compose than to subclass here. class ProductView { public function __construct(Product $product) { $this-product =

[symfony-users] Re: Having a web layer for the model

2010-10-06 Thread Richtermeister
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

Re: [symfony-users] Re: Having a web layer for the model

2010-10-06 Thread Sebastien Armand [Pink]
It does indeed! Thanks On Thu, Oct 7, 2010 at 12:37 AM, Richtermeister nex...@gmail.com wrote: 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.