vendredi 26 juin 2015

Laravel Command Bus Validation - Best Practice

I'm currently working on a project which involves leveraging a 3rd party Soap API by issuing long requests.

Since we where initially unsure as to how/when some of these requests would be executed (either in a queue or via some artisan command) we decided that the Command Bus pattern would likely be a good fit.

However, I have a some concerns as to how these commands are being issued and where validation is occurring. To start the commands are not immutable.

Being new to the Laravel framework I was impressed by the Service Container and contextual bindings support however I wasn't sure how this might be leveraged properly if I'm only referencing concrete classes everywhere. ie: $command = new CrudOperation(n.* arguments));

All of our data validation is taking place inside separate FormRequest validation objects which may not be the best approach.

I'm also wondering whether each of these command handlers should be responsible for building out the necessary objects for our Soap call since they're already sitting behind the command bus.

Any advice is appreciated. Thanks.

Aucun commentaire:

Enregistrer un commentaire