Skip to content

Commit

Permalink
Check if shared event manager is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielss89 committed May 24, 2017
1 parent a13be2f commit b13c7ca
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/ZfcUser/Authentication/Adapter/AdapterChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,14 @@ public function prepareForAuthentication(Request $request)
*/
public function resetAdapters()
{
$listeners = $this->getEventManager()->getSharedManager()->getListeners(['authenticate'], 'authenticate');

foreach ($listeners as $listener) {
if (is_array($listener) && $listener[0] instanceof ChainableAdapter) {
$listener[0]->getStorage()->clear();
$sharedManager = $this->getEventManager()->getSharedManager();

if ($sharedManager) {
$listeners = $sharedManager->getListeners(['authenticate'], 'authenticate');
foreach ($listeners as $listener) {
if (is_array($listener) && $listener[0] instanceof ChainableAdapter) {
$listener[0]->getStorage()->clear();
}
}
}

Expand Down

0 comments on commit b13c7ca

Please sign in to comment.