Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.
Prev Previous commit
Ensure all listener aggregates are attached correctly.
This patch ensures that all listener aggregates use the form:

```php
    $aggregate->attach($events);
```

vs

```php
    $events->attach($aggregate);
```

as the latter is unsupported in v3 versions of zend-eventmanager.
  • Loading branch information
weierophinney committed Jul 6, 2016
commit c5e10ffbcc3add4fde3665c400144a6eb0108a42
4 changes: 2 additions & 2 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function onBootstrap(MvcEvent $e)
$serviceManager = $app->getServiceManager();
$eventManager = $app->getEventManager();

$eventManager->attach($serviceManager->get('ZF\ApiProblem\ApiProblemListener'));
$serviceManager->get('ZF\ApiProblem\ApiProblemListener')->attach($eventmanager);
$eventManager->attach(MvcEvent::EVENT_RENDER, [$this, 'onRender'], 100);

$sendResponseListener = $serviceManager->get('SendResponseListener');
Expand Down Expand Up @@ -67,7 +67,7 @@ public function onRender(MvcEvent $e)

// register at high priority, to "beat" normal json strategy registered
// via view manager, as well as HAL strategy.
$events->attach($services->get('ZF\ApiProblem\ApiProblemStrategy'), 400);
$services->get('ZF\ApiProblem\ApiProblemStrategy')->attach($events, 400);
}
}
}
2 changes: 1 addition & 1 deletion src/Listener/ApiProblemListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function onDispatch(MvcEvent $e)

// Attach the ApiProblem render.error listener
$events = $app->getEventManager();
$events->attach($services->get('ZF\ApiProblem\RenderErrorListener'));
$services->get('ZF\ApiProblem\RenderErrorListener')->attach($events);
}

/**
Expand Down