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 4316f88 commit 262dbde
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
'blog_domain' => array(
'factories' => array(
'MamuzBlogFeed\Listener\QueryFilterAggregate' => 'MamuzBlogFeed\Listener\QueryFilterAggregateFactory',
'MamuzBlogFeed\Listener\HeadLinkAggregate' => 'MamuzBlogFeed\Listener\HeadLinkAggregateFactory',
'MamuzBlogFeed\Feed\Writer\Factory' => 'MamuzBlogFeed\Feed\WriterFactory',
'MamuzBlogFeed\Options\ConfigProvider' => 'MamuzBlogFeed\Options\ConfigProviderFactory',
),
Expand Down
29 changes: 29 additions & 0 deletions src/MamuzBlogFeed/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,43 @@

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(
'MamuzBlog\DomainManager'
);

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

public function init(ModuleManagerInterface $modules)
{
$modules->loadModule('MamuzBlog');
Expand Down

0 comments on commit 262dbde

Please sign in to comment.