I pop up this thread as I made two considerations since. I think
symfony should be smarter when processing forms. Most of time, when an
error occured after form submission we want to display the initial
state of the form with errors highlighted and new data filled in. So
the handleErrorXXX in the action.class.php just duplicates the code
the non posted part of the executeXXX method, which break the DRY
principle. Can we change the standard behaviour of symfony so by
default. I think is a major change in the page creation process of
symfony, but it let gain lots of time for uninteresting tasks.
The second point I want to talk about is validating datas. If we have
a e-mail field for a user, we now have to validate it at least 3 times
in a classic user management system: in the frontend, to let the user
change its e-mail. In the backend, so admin can change it to. And if
we have an import function from an uploaded CSV file, we need to
validate it again. Can't we imagine to validate datas at a model
level? Validation of action like it's currently done in the current
version is interesting to check application logic that cannot be
handle at a model level, but I think there's some place to a model-
level validation. It can be done with a more database abstracted model
where we describe fields as e-mail, URL, etc. When running the model
generation task, we transcript the field as a standard database field
with some extra controls in the model. That the way Django do for
example.

What do you think about that ?
Nautile

On 7 mai, 19:49, eric williams <[EMAIL PROTECTED]> wrote:
> nothing more than YAML syntax validation. YAML is ubiquitous in symfony,
>  and yet config files are just dumped into arrays and symfony hopes for
> the best, yielding cryptic offset notices and errors that dont even give
> the yaml file in question!
>
> i realize that this is a spyc issue (it's a VERY primitive yaml parser),
> and nothing better seems to be on the horizon for php (i dont see syntax
> checking/exception handling on the roadmap for syck).
>
> pyyaml apparently offers a nice parser that's been ported to ruby.
> anyone know python and care to port it to symfony? :)
>
> cheers,
> -eric
>
> Martin Kreidenweis wrote:
> > Hi.
>
> >> - I would be nice to have more custom type form fields in the backend.
> >> For Example, if I have a Int field in a Model DB-Table and I want it to 
> >> carry
> >> just digits from 1 - 6 (a Rating), I cannot render it to a select field 
> >> without
> >> making a new (Model) class for just this one Table-field. A bit to much
> >> overhead for not even a byte of information IMHO.
>
> > You could write a object_select_rating_tag helper like that instead:
>
> > function select_rating_tag($name, $selected, $options) {
> >   return select_tag($name, options_for_select(range(1, 6), $selected));
> > }
>
> > function object_select_rating_tag($object, $method, $options = array(),
> >     $default_value = null)
> > {
> >   $options = _parse_attributes($options);
>
> >   $value = _get_object_value($object, $method, $default_value);
>
> >   return select_rating_tag(_convert_method_to_name($method, $options),
> >                            $value, $options);
> > }
>
> > Then just set the edit control type in your generator.yml to
> > select_rating_tag for the respective field.
>
> > Or if you have no need to reuse the code simply put it in a partial.
>
> >  Martin


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" 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-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to