Skip to content

Commit

Permalink
Switch to bind to prevent decorator sharing
Browse files Browse the repository at this point in the history
Sometimes you may need to execute multiple commands at the same time, it will accidentally share same decorators which is not intended that they should be, because the decorators array is store in the shared command bus.

e.g.
$this->execute(PostJobListingCommand::class, $data, JobSanitizer);
$this->execute(ClearCacheCommand::class);

The second execute will take the JobSanitizer docorator which is not intended.
  • Loading branch information
yateric committed Nov 21, 2014
1 parent 2c97b9a commit 1400504
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Laracasts/Commander/CommanderServiceProvider.php
Expand Up @@ -49,7 +49,7 @@ protected function registerCommandTranslator()
*/
protected function registerCommandBus()
{
$this->app->bindShared('Laracasts\Commander\CommandBus', function($app)
$this->app->bind('Laracasts\Commander\CommandBus', function($app)
{
return $app->make('Laracasts\Commander\DefaultCommandBus');
});
Expand Down

0 comments on commit 1400504

Please sign in to comment.