Bacon / BaconUser

BaconUser provides simple user management
BSD 2-Clause "Simplified" License
14 stars 9 forks source link

Remove form in RegistrationService #12

Open bakura10 opened 11 years ago

bakura10 commented 11 years ago

Here: https://github.com/Bacon/BaconUser/blob/master/src/BaconUser/Service/RegistrationService.php#L27

The registration service is tied to a form. I think it's not responsability of the service to do that. The RegistrationService should only receive data considered as valid. When using REST we mostly don't use form but only input filter.

Furthermore, because the form is in the registration form itself, there is no way to retrieve it to show errors.

What do oyu think @ocramius?

Ocramius commented 11 years ago

@bakura10 agreed - forms are not a service layer concept - that's inputfilters/hydrators.

DASPRiD commented 11 years ago

@Ocramius @bakura10 But forms act as facade services for filtering/hydration, see: http://blog.ploeh.dk/2010/02/02/RefactoringtoAggregateServices/

Ocramius commented 11 years ago

The problem with forms is that forms imply a lot more things behind them - they dictate the structure of the output and such, while a simpler JSON/XML REST api is just input-filter | hydrator