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

Commit 7d93486

Browse files
committed
Merge branch 'refresh_command' of github.com:dantleech/RoutingAutoBundle into refresh_command
Conflicts: Command/RefreshCommand.php
2 parents d851a55 + 0af6938 commit 7d93486

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Command/RefreshCommand.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class RefreshCommand extends ContainerAwareCommand
1313
public function configure()
1414
{
1515
$this
16-
->setName('cmf:routing-auto:refresh')
16+
->setName('cmf:routing:auto:refresh')
1717
->setDescription(<<<HERE
1818
This command iterates over all Documents that are mapped by the auto
1919
routing system and re-applys the auto routing logic.
@@ -43,23 +43,22 @@ public function configure()
4343
*/
4444
public function execute(InputInterface $input, OutputInterface $output)
4545
{
46-
4746
$container = $this->getContainer();
4847
$dm = $container->get('doctrine_phpcr.odm.default_document_manager');
4948
$factory = $container->get('symfony_cmf_routing_auto.factory');
5049
$arm = $container->get('symfony_cmf_routing_auto.auto_route_manager');
5150
$uow = $dm->getUnitOfWork();
51+
5252
$session = $input->getOption('session');
53+
$dryRun = $input->getOption('dry-run');
54+
$class = $input->getOption('class');
55+
$verbose = $input->getOption('verbose');
5356

5457
DoctrineCommandHelper::setApplicationPHPCRSession(
5558
$this->getApplication(),
5659
$session
5760
);
5861

59-
$dryRun = $input->getOption('dry-run');
60-
$class = $input->getOption('class');
61-
$verbose = $input->getOption('verbose');
62-
6362
if ($class) {
6463
$mapping = array($class => $class);
6564
} else {
@@ -69,6 +68,7 @@ public function execute(InputInterface $input, OutputInterface $output)
6968
foreach (array_keys($mapping) as $classFqn) {
7069

7170
$output->writeln(sprintf('<info>Processing class: </info> %s', $classFqn));
71+
7272
$qb = $dm->createQueryBuilder();
7373
$qb->from($classFqn);
7474
$q = $qb->getQuery();
@@ -78,6 +78,7 @@ public function execute(InputInterface $input, OutputInterface $output)
7878
$id = $uow->getDocumentId($autoRouteableDocument);
7979
$output->writeln(' <info>Refreshing: </info>'.$id);
8080
$context = $arm->updateAutoRouteForDocument($autoRouteableDocument);
81+
8182
foreach ($context->getRoutes() as $route) {
8283
$dm->persist($route);
8384
$routeId = $uow->getDocumentId($route);

Tests/Functional/Command/RefreshCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ public function testCommand()
3737

3838
$application = $this->getApplication();
3939
$input = new ArrayInput(array(
40-
));;
40+
'foo:bar'
41+
));
4142
$output = new NullOutput();
4243
//$output = new StreamOutput(fopen('php://stdout', 'w'));
4344
$command = new RefreshCommand();
4445
$command->setApplication($application);
45-
$command->execute($input, $output);
46+
$command->run($input, $output);
4647
}
4748
}
48-

0 commit comments

Comments
 (0)