Skip to content

Commit

Permalink
add HeadLink Listener
Browse files Browse the repository at this point in the history
  • Loading branch information
mamuz committed Sep 6, 2014
1 parent 262dbde commit a385bb7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/MamuzBlogFeed/Controller/Plugin/Feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ private function createFeedByTag($tag = null)
}

$feedOptions = $this->configProvider->getFor($tag);
// @todo inject route

/** @var \IteratorAggregate $posts */
return $this->feedFactory->create($feedOptions, $posts);
Expand Down
27 changes: 9 additions & 18 deletions src/MamuzBlogFeed/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,31 @@
namespace MamuzBlogFeed;

use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManagerInterface;
use Zend\ModuleManager\Feature;
use Zend\ModuleManager\ModuleManagerInterface;
use Zend\Mvc\ApplicationInterface;
use Zend\Mvc\MvcEvent;
use Zend\ServiceManager\ServiceLocatorInterface;

class Module implements
Feature\AutoloaderProviderInterface,
Feature\BootstrapListenerInterface,
Feature\ConfigProviderInterface,
Feature\InitProviderInterface
{
/** @var ApplicationInterface */
private $application;

/** @var ServiceLocatorInterface */
private $domainManager;

/** @var EventManagerInterface */
private $eventManager;

public function onBootstrap(EventInterface $e)
{
/** @var MvcEvent $e */
$this->application = $e->getApplication();
$this->eventManager = $this->application->getEventManager();
$this->domainManager = $this->application->getServiceManager()->get(
if (!$e instanceof MvcEvent) {
return;
}

$application = $e->getApplication();
$domainManager = $application->getServiceManager()->get(
'MamuzBlog\DomainManager'
);

/* @var \Zend\EventManager\ListenerAggregateInterface $listenerAggregate */
$listenerAggregate = $this->domainManager->get('MamuzBlogFeed\Listener\HeadLinkAggregate');
$this->eventManager->attachAggregate($listenerAggregate);
$listenerAggregate = $domainManager->get('MamuzBlogFeed\Listener\HeadLinkAggregate');
$eventManager = $application->getEventManager();
$eventManager->attachAggregate($listenerAggregate);
}

public function init(ModuleManagerInterface $modules)
Expand Down

0 comments on commit a385bb7

Please sign in to comment.