Skip to content

Commit

Permalink
fix(Core): event manager factory reuses EventManager instance
Browse files Browse the repository at this point in the history
Instead, a new instance of an EventManager is now created on every invokation.
  • Loading branch information
TiSiE committed Jul 8, 2021
1 parent 10b50b0 commit 4a76d9f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @license MIT
* @copyright 2013 - 2016 Cross Solution <http://cross-solution.de>
*/

/** */
namespace Core\Factory\EventManager;

Expand Down Expand Up @@ -145,7 +145,7 @@ public function canCreate(ContainerInterface $container, $requestedName)
*/
return 0 === strpos(strrev($requestedName), 'stnevE/');
}

public function canCreateServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
{
return $this->canCreate($serviceLocator, $requestedName);
Expand Down Expand Up @@ -221,7 +221,7 @@ protected function createEventManager($services, $config)
/* @var \Laminas\EventManager\EventManagerInterface|\Core\EventManager\EventProviderInterface $events */

if ($services->has($config['service'])) {
$events = $services->get($config['service']);
$events = $services->build($config['service']);
} else {
if (!class_exists($config['service'], true)) {
throw new \UnexpectedValueException(sprintf(
Expand All @@ -238,7 +238,7 @@ protected function createEventManager($services, $config)
}

$events->setIdentifiers($config['identifiers']);

/* @var \Laminas\EventManager\EventInterface $event */
$event = $services->has($config['event']) ? $services->get($config['event']) : new $config['event']();
$events->setEventPrototype($event);
Expand Down

0 comments on commit 4a76d9f

Please sign in to comment.