Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 336e71d

Browse files
committed
Changed doctrine event subscribver to listener
1 parent e9dd0d4 commit 336e71d

File tree

3 files changed

+6
-26
lines changed

3 files changed

+6
-26
lines changed

Subscriber/AutoRouteSubscriber.php renamed to EventListener/AutoRouteListener.php

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,26 @@
11
<?php
22

3-
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\Subscriber;
3+
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\Listener;
44

5-
use Doctrine\Common\EventSubscriber;
6-
use Doctrine\ODM\PHPCR\Event;
7-
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\AutoRouteManager;
8-
use Doctrine\ODM\PHPCR\Event\LifecycleEventArgs;
9-
use Doctrine\ODM\PHPCR\Event\PostFlushEventArgs;
105
use Doctrine\ODM\PHPCR\Event\OnFlushEventArgs;
116
use Symfony\Component\DependencyInjection\ContainerInterface;
127

138
/**
14-
* Doctrine PHPCR ODM Subscriber for maintaining automatic routes.
9+
* Doctrine PHPCR ODM listener for maintaining automatic routes.
1510
*
1611
* @author Daniel Leech <[email protected]>
1712
*/
18-
class AutoRouteSubscriber implements EventSubscriber
13+
class AutoRouteListener
1914
{
20-
protected $persistQueue = array();
21-
protected $removeQueue = array();
22-
2315
public function __construct(ContainerInterface $container)
2416
{
2517
$this->container = $container;
2618
}
2719

28-
public function getSubscribedEvents()
29-
{
30-
return array(
31-
Event::onFlush,
32-
);
33-
}
34-
3520
protected function getArm()
3621
{
22+
// lazy load the auto_route_manager service to prevent a cirular-reference
23+
// to the document manager.
3724
return $this->container->get('symfony_cmf_routing_auto_route.auto_route_manager');
3825
}
3926

@@ -68,4 +55,3 @@ public function onFlush(OnFlushEventArgs $args)
6855
}
6956
}
7057
}
71-

Tests/Functional/Subscriber/AutoRouteSubscriberTest.php renamed to Tests/Functional/EventListener/AutoRouteListenerTest.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,8 @@
55
use Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Functional\app\Document\Blog;
66
use Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Functional\BaseTestCase;
77

8-
class AutoRouteSubscriberTest extends BaseTestCase
8+
class AutoRouteListenerTest extends BaseTestCase
99
{
10-
public function setUp()
11-
{
12-
parent::setUp();
13-
$this->manager = $this->getContainer()->get('symfony_cmf_routing_auto_route.auto_route_manager');
14-
}
15-
1610
protected function createBlog()
1711
{
1812
$post = new Blog;

Tests/Subscriber/AutoRoute.php

Whitespace-only changes.

0 commit comments

Comments
 (0)