Overriding accessors is something we will be addressing in the Doctrine core
itself. Currently sfDoctrinePlugin allows you to override accessors by
creating get/setFieldName() methods and they will be called when you access
a normal Doctrine accessor. In order for it to function correctly you must
use rawSet() to avoid an infinite loop.
- Jon
On Jan 7, 2008 6:00 PM, Karolis Tamutis <[EMAIL PROTECTED]> wrote:
> Sorry, I was too quick to jump the gun, this never get's called, using
> rawSet is the only working solution I have found.
>
> ublic function setFilePath($value)
>
> {
>
> // your logic
>
> $this->rawSet('file_path', $value); // not camelized!
>
> }
>
>
>
> On 1/8/08, Karolis Tamutis <[EMAIL PROTECTED]> wrote:
> >
> > To anyone who's facing a similar problem:
> >
> > for example you want a custom setter for a field file_path in Doctrine.
> >
> > Open up the generated model class and add a following method:
> >
> > public function filterSetFilePath($value)
> >
> > {
> >
> > return $modifiedValue;
> >
> > }
> >
> > now $modifiedValue will be saved in the database instead of $value, hope
> > it helps!
> >
> > On 1/6/08, Karolis Tamutis <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi everyone, with Propel, models had set* methods in autogenerated
> > > classes, so when you needed to extend some method, you'd just do
> > >
> > > public function method($val)
> > >
> > > {
> > >
> > > parent::method($val);
> > >
> > > // whatever goes here
> > >
> > > }
> > >
> > > but with Doctrine, there is _no_ parent::method, so, how do I execute
> > > someting on-save of a specific row?
> > >
> > > Thanks!
> > >
> >
> >
>
> >
>
--
Jonathan Wage
http://www.jwage.com
http://www.centresource.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
-~----------~----~----~----~------~----~------~--~---