Skip to content

Commit

Permalink
fix bag. did not set the event dispatcher in connection. need invoke …
Browse files Browse the repository at this point in the history
…$capsule->setEventDispatcher before $capsule->getConnection
  • Loading branch information
Rakitin committed Oct 11, 2016
1 parent 775f2b2 commit af80269
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Silex/Provider/CapsuleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public function register(PimpleContainer $app)
$app['capsule'] = function (Application $app) {
$capsule = new Capsule($app['capsule.container']);

// Set the event dispatcher used by Eloquent models...
if (!empty($app['capsule.dispatcher'])) {
$capsule->setEventDispatcher($app['capsule.dispatcher']);
}

// Connections
foreach ($app['capsule.connections'] as $connectionName => $connectionConfig) {
$connectionConfig += $app['capsule.connectionDefault'];
Expand All @@ -62,11 +67,6 @@ public function register(PimpleContainer $app)
}
}

// Set the event dispatcher used by Eloquent models...
if (!empty($app['capsule.dispatcher'])) {
$capsule->setEventDispatcher($app['capsule.dispatcher']);
}

// Make this Capsule instance available globally via static methods...
if (!empty($app['capsule.options']['setAsGlobal'])) {
$capsule->setAsGlobal();
Expand Down

0 comments on commit af80269

Please sign in to comment.