This repository was archived by the owner on Sep 16, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +6
-26
lines changed Expand file tree Collapse file tree 3 files changed +6
-26
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- namespace Symfony \Cmf \Bundle \RoutingAutoBundle \Subscriber ;
3
+ namespace Symfony \Cmf \Bundle \RoutingAutoBundle \Listener ;
4
4
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 ;
10
5
use Doctrine \ODM \PHPCR \Event \OnFlushEventArgs ;
11
6
use Symfony \Component \DependencyInjection \ContainerInterface ;
12
7
13
8
/**
14
- * Doctrine PHPCR ODM Subscriber for maintaining automatic routes.
9
+ * Doctrine PHPCR ODM listener for maintaining automatic routes.
15
10
*
16
11
* @author Daniel Leech <[email protected] >
17
12
*/
18
- class AutoRouteSubscriber implements EventSubscriber
13
+ class AutoRouteListener
19
14
{
20
- protected $ persistQueue = array ();
21
- protected $ removeQueue = array ();
22
-
23
15
public function __construct (ContainerInterface $ container )
24
16
{
25
17
$ this ->container = $ container ;
26
18
}
27
19
28
- public function getSubscribedEvents ()
29
- {
30
- return array (
31
- Event::onFlush,
32
- );
33
- }
34
-
35
20
protected function getArm ()
36
21
{
22
+ // lazy load the auto_route_manager service to prevent a cirular-reference
23
+ // to the document manager.
37
24
return $ this ->container ->get ('symfony_cmf_routing_auto_route.auto_route_manager ' );
38
25
}
39
26
@@ -68,4 +55,3 @@ public function onFlush(OnFlushEventArgs $args)
68
55
}
69
56
}
70
57
}
71
-
Original file line number Diff line number Diff line change 5
5
use Symfony \Cmf \Bundle \RoutingAutoBundle \Tests \Functional \app \Document \Blog ;
6
6
use Symfony \Cmf \Bundle \RoutingAutoBundle \Tests \Functional \BaseTestCase ;
7
7
8
- class AutoRouteSubscriberTest extends BaseTestCase
8
+ class AutoRouteListenerTest extends BaseTestCase
9
9
{
10
- public function setUp ()
11
- {
12
- parent ::setUp ();
13
- $ this ->manager = $ this ->getContainer ()->get ('symfony_cmf_routing_auto_route.auto_route_manager ' );
14
- }
15
-
16
10
protected function createBlog ()
17
11
{
18
12
$ post = new Blog ;
You can’t perform that action at this time.
0 commit comments