The service layer should not be responsible of data binding, it should works only with domain objects since it is a part of the business logic. The form object is really specific to one frontend and to one framework, it's the role of the controller to build a domain object from user inputs, and then to invoke the service.
I don't want to manipulate forms directly in the service layer, that would link my business layer to Symfony. I don't assign any validator to the form. Validation rules are defined on the domain object, never on the Form, the Form performs validation automatically when validation rules are set on the domain object. Unless there is a way ? Even though, if i don't validate with the form, i have no *easy* way to take my ConstraintViolationList and bind errors to the form. I need it because i still have to show errors to the user. I know that i can bind errors to the form with a small piece of code, but that would be great if it was native. The form layer is really great, but this is really a common architecture on big projects with distributed APIs. Since a standalone data binder doesn't exist, a form could be used "only" for that purpose if we could prevent validation. -- Benjamin Dulau - anonymation CEO anonymation.com | code.anonymation.com [email protected] On Tuesday, May 10, 2011 7:19:56 AM UTC+2, Aurelijus ValeiĊĦa wrote: > > Why don't you use Form validation for validating user input? > You could bind data in the service layer and in the controller you > could just call getForm or something like that. > > Both those features would be helpful, but in your case, if you are > doing validation in the service layer and don't want to do it with the > forms, just don't assign any validators to a form and it won't do any > validation and there won't be any overhead. > > -- 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
