Skip to content

Commit

Permalink
Apply setEventManager() in src.
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Pustułka committed Apr 21, 2017
1 parent babd5c4 commit a95249a
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Controller/Component/AuthComponent.php
Expand Up @@ -252,7 +252,7 @@ class AuthComponent extends Component
public function initialize(array $config)
{
$controller = $this->_registry->getController();
$this->eventManager($controller->getEventManager());
$this->setEventManager($controller->getEventManager());
$this->response =& $controller->response;
$this->session = $controller->request->getSession();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/ComponentRegistry.php
Expand Up @@ -68,7 +68,7 @@ public function getController()
public function setController(Controller $controller)
{
$this->_Controller = $controller;
$this->eventManager($controller->getEventManager());
$this->setEventManager($controller->getEventManager());
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Controller.php
Expand Up @@ -248,7 +248,7 @@ public function __construct(ServerRequest $request = null, Response $response =
$this->response = $response !== null ? $response : new Response();

if ($eventManager !== null) {
$this->eventManager($eventManager);
$this->setEventManager($eventManager);
}

$this->modelFactory('Table', [$this->tableLocator(), 'get']);
Expand Down
2 changes: 1 addition & 1 deletion src/Http/ActionDispatcher.php
Expand Up @@ -55,7 +55,7 @@ class ActionDispatcher
public function __construct($factory = null, $eventManager = null, array $filters = [])
{
if ($eventManager) {
$this->eventManager($eventManager);
$this->setEventManager($eventManager);
}
foreach ($filters as $filter) {
$this->addFilter($filter);
Expand Down
5 changes: 4 additions & 1 deletion src/ORM/BehaviorRegistry.php
Expand Up @@ -75,7 +75,10 @@ public function __construct($table = null)
public function setTable(Table $table)
{
$this->_table = $table;
$this->eventManager($table->getEventManager());
$eventManager = $table->getEventManager();
if ($eventManager !== null) {
$this->setEventManager($eventManager);
}
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/View/Cell.php
Expand Up @@ -144,7 +144,9 @@ public function __construct(
EventManager $eventManager = null,
array $cellOptions = []
) {
$this->eventManager($eventManager);
if ($eventManager !== null) {
$this->setEventManager($eventManager);
}
$this->request = $request;
$this->response = $response;
$this->modelFactory('Table', [$this->tableLocator(), 'get']);
Expand Down
2 changes: 1 addition & 1 deletion src/View/HelperRegistry.php
Expand Up @@ -44,7 +44,7 @@ class HelperRegistry extends ObjectRegistry implements EventDispatcherInterface
public function __construct(View $view)
{
$this->_View = $view;
$this->eventManager($view->getEventManager());
$this->setEventManager($view->getEventManager());
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/View/View.php
Expand Up @@ -333,7 +333,9 @@ public function __construct(
$this->{$var} = $viewOptions[$var];
}
}
$this->eventManager($eventManager);
if ($eventManager !== null) {
$this->setEventManager($eventManager);
}
$this->request = $request ?: Router::getRequest(true);
$this->response = $response ?: new Response();
if (!$this->request) {
Expand Down

0 comments on commit a95249a

Please sign in to comment.