Permalink
Browse files

Initial work.

  • Loading branch information...
trq committed Feb 6, 2013
1 parent 588f4bd commit 1db75382490f6e22422d3583d969475065622dfd
Showing with 18 additions and 10 deletions.
  1. +2 −2 lib/Proem/Bootstrap/Dispatch.php
  2. +1 −1 lib/Proem/Bootstrap/Request.php
  3. +1 −1 lib/Proem/Bootstrap/Route.php
  4. +14 −6 lib/Proem/Proem.php
@@ -59,7 +59,7 @@ public function in(AssetManagerInterface $assetManager)
new Event('proem.in.setup.dispatch'),
function ($responseEvent) use ($assetManager) {
// Check for a customized Dispatch\Dispatcher.
- if ($responseEvent->has('dispatcherAsset')) {
+ if ($responseEvent instanceof Event && $responseEvent->has('dispatcherAsset')) {
$assetManager->overrideAsSingleton('dispatcher', $responseEvent->get('dispatcherAsset'));
}
}
@@ -70,7 +70,7 @@ function ($responseEvent) use ($assetManager) {
new Event('proem.in.dispatch'),
function ($responseEvent) use ($assetManager) {
// Check for a customised dispatch handler.
- if ($responseEvent->has('dispatchHandler') && $responseEvent->get('dispatcherHandler') instanceof \Closure) {
+ if ($responseEvent instanceof Event && $responseEvent->has('dispatchHandler') && $responseEvent->get('dispatcherHandler') instanceof \Closure) {
$action = $responseEvent->get('dispatcherHandler');
$action($assetManager->resolve('request'));
} else {
@@ -60,7 +60,7 @@ public function in(AssetManagerInterface $assetManager)
$assetManager->resolve('eventManager')->trigger(
new Event('proem.in.setup.request'),
function ($responseEvent) use ($assetManager) {
- if ($responseEvent->has('requestAsset')) {
+ if ($responseEvent instanceof Event && $responseEvent->has('requestAsset')) {
$assetManager->override('request', $responseEvent->get('requestAsset'));
}
}
@@ -65,7 +65,7 @@ public function in(AssetManagerInterface $assetManager)
$assetManager->resolve('eventManager')->trigger(
new Event('proem.in.setup.route'),
function ($responseEvent) use ($assetManager) {
- if ($responseEvent->has('routeManagerAsset')) {
+ if ($responseEvent instanceof Event && $responseEvent->has('routeManagerAsset')) {
$assetManager->override('routeManager', $responseEvent->get('routeManagerAsset'));
}
}
View
@@ -65,12 +65,20 @@ public function __construct(AssetManagerInterface $assetManager = null)
$this->assetManager = $assetManager;
}
- $this->assetManager->alias([
- 'Proem\Signal\EventManagerInterface' => 'Proem\Signal\EventManager',
- 'eventManager' => 'Proem\Signal\EventManagerInterface',
- 'Proem\Filter\ChainManagerInterface' => 'Proem\Filter\ChainManager',
- 'chainManager' => 'Proem\Filter\ChainManagerInterface'
- ]);
+ $this->assetManager->singleton(['eventManager' => '\Proem\Signal\EventManager']);
+ $this->assetManager->singleton(['chainManager' => '\Proem\Filter\ChainManager']);
+ }
+
+ public function getEventManager()
+ {
+
+ var_dump($this->assetManager);
+ var_dump($this->assetManager->resolve('eventManager') === $this->assetManager->resolve('eventManager'));
+ //$this->assetManager->resolve('eventManager');
+ var_dump($this->assetManager);
+ var_dump($this->assetManager->resolve('eventManager') === $this->assetManager->resolve('eventManager'));
+ var_dump($this->assetManager);
+ return $this->assetManager->resolve('eventManager');
}
/**

0 comments on commit 1db7538

Please sign in to comment.