The model class works as well, but some people prefer to leave the
data cleansing to the forms and use the model layer purely for storage/
retrieval. Matter of preference.

Daniel


On May 25, 6:27 am, Tom Haskins-Vaughan <t...@templestreetmedia.com>
wrote:
> > Using setDescription on model level probably doesn't work for the form
> > since form data is loaded into the object by calling ->fromArray()
> > which does not necessarily call mutators as far as Doctrine is
> > concerned (not sure what Propel does here).
>
> Do you mean that it won't work if I use the model class?
>
> On Tue, May 25, 2010 at 9:22 AM, Johannes
>
>
>
> <johannes.schmitt...@googlemail.com> wrote:
> > Forms allow you to perform that kind of change in updateXXXColumn
> > methods, e.g.
>
> > public function updateDescriptionColumn($value)
> > {
> >  return strip_tags($value);
> > }
>
> > Using setDescription on model level probably doesn't work for the form
> > since form data is loaded into the object by calling ->fromArray()
> > which does not necessarily call mutators as far as Doctrine is
> > concerned (not sure what Propel does here).
>
> > Johannes
>
> > On May 25, 2:36 pm, Tom Haskins-Vaughan <t...@templestreetmedia.com>
> > wrote:
> >> D'oh! I always have a tendency to over complicate things! Thanks, Gabriel!
>
> >> On Mon, May 24, 2010 at 6:45 PM, pghoratiu <pghora...@gmail.com> wrote:
> >> > You could do it either at object->save() or better at object->set*()
> >> > something like:
>
> >> > public function setDescription($value)
> >> > {
> >> >   parent::setDescription(strip_tags($value));
> >> > }
>
> >> >    gabriel
>
> >> > On May 24, 11:56 pm, Tom Haskins-Vaughan <t...@templestreetmedia.com>
> >> > wrote:
> >> >> Hi all,
>
> >> >> I need to call strip_tags() on a form field before I put it in my
> >> >> database, only allowing <strong> and <em> tags. I've done this by
> >> >> creating a custom validator (see below). It works fine, but is there a
> >> >> better way to do this?
>
> >> >> Thanks,
>
> >> >> Tom
>
> >> >> protected function doClean($value)
> >> >> {
> >> >>   return strip_tags($value, $this->getOption('allowable_tags'));
>
> >> >> }
>
> >> >> --
> >> >> 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 
> >> >> athttp://groups.google.com/group/symfony-users?hl=en
>
> >> > --
> >> > 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
>
> >> --
> >> 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 
> >> athttp://groups.google.com/group/symfony-users?hl=en
>
> > --
> > 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
>
> --
> 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 
> athttp://groups.google.com/group/symfony-users?hl=en

-- 
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