@@ -13,7 +13,7 @@ class RefreshCommand extends ContainerAwareCommand
13
13
public function configure ()
14
14
{
15
15
$ this
16
- ->setName ('cmf:routing- auto:refresh ' )
16
+ ->setName ('cmf:routing: auto:refresh ' )
17
17
->setDescription (<<<HERE
18
18
This command iterates over all Documents that are mapped by the auto
19
19
routing system and re-applys the auto routing logic.
@@ -43,23 +43,22 @@ public function configure()
43
43
*/
44
44
public function execute (InputInterface $ input , OutputInterface $ output )
45
45
{
46
-
47
46
$ container = $ this ->getContainer ();
48
47
$ dm = $ container ->get ('doctrine_phpcr.odm.default_document_manager ' );
49
48
$ factory = $ container ->get ('symfony_cmf_routing_auto.factory ' );
50
49
$ arm = $ container ->get ('symfony_cmf_routing_auto.auto_route_manager ' );
51
50
$ uow = $ dm ->getUnitOfWork ();
51
+
52
52
$ session = $ input ->getOption ('session ' );
53
+ $ dryRun = $ input ->getOption ('dry-run ' );
54
+ $ class = $ input ->getOption ('class ' );
55
+ $ verbose = $ input ->getOption ('verbose ' );
53
56
54
57
DoctrineCommandHelper::setApplicationPHPCRSession (
55
58
$ this ->getApplication (),
56
59
$ session
57
60
);
58
61
59
- $ dryRun = $ input ->getOption ('dry-run ' );
60
- $ class = $ input ->getOption ('class ' );
61
- $ verbose = $ input ->getOption ('verbose ' );
62
-
63
62
if ($ class ) {
64
63
$ mapping = array ($ class => $ class );
65
64
} else {
@@ -69,6 +68,7 @@ public function execute(InputInterface $input, OutputInterface $output)
69
68
foreach (array_keys ($ mapping ) as $ classFqn ) {
70
69
71
70
$ output ->writeln (sprintf ('<info>Processing class: </info> %s ' , $ classFqn ));
71
+
72
72
$ qb = $ dm ->createQueryBuilder ();
73
73
$ qb ->from ($ classFqn );
74
74
$ q = $ qb ->getQuery ();
@@ -78,6 +78,7 @@ public function execute(InputInterface $input, OutputInterface $output)
78
78
$ id = $ uow ->getDocumentId ($ autoRouteableDocument );
79
79
$ output ->writeln (' <info>Refreshing: </info> ' .$ id );
80
80
$ context = $ arm ->updateAutoRouteForDocument ($ autoRouteableDocument );
81
+
81
82
foreach ($ context ->getRoutes () as $ route ) {
82
83
$ dm ->persist ($ route );
83
84
$ routeId = $ uow ->getDocumentId ($ route );
0 commit comments