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 class etc
}
}
This way, all your regular model classes are still abstracted into the
correct layer but you have your additional functionality as well.
On Thu, Oct 7, 2010 at 8:38 AM, pghoratiu <[email protected]> wrote:
> 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]" <[email protected]> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]<symfony-users%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>
--
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en