Benjamin, $this->userForm->errors is actually just an array of errors that have bubbled up from children that are set to bubble, usually hidden fields. Also this array is a numeric key array, so no association or knowledge of where the error has come from, something Bernhard is aware of as a problem.
What I would do is create a function that takes your errors, which are mapped to the same field names, and recurs over the form fields (getChildren i think). Creating a new FormError object for each error as you go. John On Tue, May 3, 2011 at 11:26 AM, dbenjamin <[email protected]> wrote: > Hi, > I have an architecture where a Service Layer is responsible of validation. > I can have several frontends consuming the same services. > > In one of the frontends, a website, i use forms exclusively for rendering > and request binding (the validation being handled by the Service Layer). > The thing is i still need to show validation errors next to the form fields > in this frontend, but when i'm not using the form validation process, i just > can't set errors to the form. > Well, i see an addError() method, but first it takes an FormError object, > and anyway i can't set all errors at once. > An use case: > http://pastie.org/1859881 > > Is there any solution ? :) > > Thanks. > > -- > Benjamin Dulau - anonymation CEO > anonymation.com | code.anonymation.com > [email protected] > > -- > 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 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 > -- 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 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
