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

Commit 4c1953f

Browse files
committed
Functional tests fail
1 parent e63393a commit 4c1953f

21 files changed

+135
-374
lines changed

AutoRoute/DefunctRouteHandler.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute;
44

5+
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\OperationStack;
6+
57
/**
68
* Class which takes actions on routes which are left behind
79
* after a content changes its URL.
@@ -16,28 +18,28 @@
1618
class DefunctRouteHandler implements DefunctRouteHandlerInterface
1719
{
1820
protected $serviceRegistry;
19-
protected $driver;
21+
protected $adapter;
2022

2123
/**
2224
* @param ServiceRegistry auto routing service registry (for getting old route action)
23-
* @param DriverInterface auto routing backend driver
24-
* @param MappingFactory auto routing mapping factory
25+
* @param AdapterInterface auto routing backend adapter
26+
* @param MetadataFactory auto routing metadata factory
2527
*/
2628
public function __consturct(
27-
ServiceRegistry $serviceRegistry,
28-
DriverInterface $driver,
29-
MappingFactory $mappingFactory
29+
MetadataFactory $metadataFactory,
30+
AdapterInterface $adapter,
31+
ServiceRegistry $serviceRegistry
3032
)
3133
{
3234
$this->serviceRegistry = $serviceRegistry;
33-
$this->driver = $driver;
34-
$this->mappingFactory = $mappingFactory;
35+
$this->adapter = $adapter;
36+
$this->metadataFactory = $metadataFactory;
3537
}
3638

3739
/**
3840
* {@inheritDoc}
3941
*/
40-
public function handleDefunctRoutes($oldRoutes, $document, $operationStack)
42+
public function handleDefunctRoutes($document, OperationStack $operationStack)
4143
{
4244
}
4345
}

AutoRoute/DefunctRouteHandlerInterface.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute;
44

5+
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\OperationStack;
6+
57
/**
68
* @author Daniel Leech <[email protected]>
79
*/
@@ -18,10 +20,7 @@ interface DefunctRouteHandlerInterface
1820
* or perhaps replaced with a redirect route, or indeed
1921
* left alone to continue depending on the configuration.
2022
*
21-
* @param object $contentDocument Document which is the subject
22-
* of the routes
23-
* @param string[] $urls List of URLs which now represent
24-
* the set of valid auto routes for this document
23+
* TODO
2524
*/
26-
public function handleDefunctRoutes($document, $urls);
25+
public function handleDefunctRoutes($document, OperationStack $operationStack);
2726
}

AutoRoute/Mapping/ClassMetadata.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,4 @@ public function merge(MergeableInterface $metadata)
106106
$this->addTokenProvider($tokenName, $provider, true);
107107
}
108108
}
109-
110-
public function getTokenProviderConfigs()
111-
{
112-
}
113109
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\Mapping\Exception;
4+
5+
class ClassNotMappedException extends \RuntimeException
6+
{
7+
}

AutoRoute/Mapping/Loader/YmlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function load($file, $type = null)
5050

5151
// empty file
5252
if (empty($config)) {
53-
return;
53+
return array();
5454
}
5555

5656
if (!is_array($config)) {

AutoRoute/Mapping/MetadataFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\Mapping;
1313

14-
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\Exception;
14+
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\Mapping\Exception;
1515
use Symfony\Component\Config\Loader\LoaderInterface;
1616
use Metadata\MetadataFactoryInterface;
1717
use Metadata\Cache\CacheInterface;

AutoRoute/Mapping/MetadataFactoryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\Metadata;
12+
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\Mapping;
1313

1414
use Symfony\Component\Config\Loader\LoaderInterface;
1515

AutoRoute/UrlGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute;
44

5-
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\Driver\DriverInterface;
5+
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\Adapter\AdapterInterface;
66
use Metadata\MetadataFactoryInterface;
77

88
/**
@@ -18,12 +18,12 @@ class UrlGenerator implements UrlGeneratorInterface
1818

1919
/**
2020
* @param MetadataFactory the metadata factory
21-
* @param DriverInterface the autoroute backend driver (odm ,orm, etc)
21+
* @param AdapterInterface the autoroute backend driver (odm ,orm, etc)
2222
* @param ServiceRegistry the auto route service registry
2323
*/
2424
public function __construct(
2525
MetadataFactoryInterface $metadataFactory,
26-
DriverInterface $driver,
26+
AdapterInterface $driver,
2727
ServiceRegistry $serviceRegistry
2828
)
2929
{
@@ -40,7 +40,7 @@ public function generateUrl($document)
4040
$realClassName = $this->driver->getRealClassName(get_class($document));
4141
$metadata = $this->metadataFactory->getMetadataForClass($realClassName);
4242

43-
$tokenProviderConfigs = $metadata->getTokenProviderConfigs();
43+
$tokenProviderConfigs = $metadata->getTokenProviders();
4444

4545
$tokens = array();
4646
foreach ($tokenProviderConfigs as $name => $options) {

DependencyInjection/CmfRoutingAutoExtension.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,19 @@ public function load(array $configs, ContainerBuilder $container)
2828
$configuration = new Configuration();
2929
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
3030
$loader->load('auto_route.xml');
31-
$loader->load('path_provider.xml');
32-
$loader->load('exists_action.xml');
33-
$loader->load('not_exists_action.xml');
34-
$loader->load('route_maker.xml');
3531

3632
$config = $processor->processConfiguration($configuration, $configs);
37-
$chainFactoryDef = $container->getDefinition('cmf_routing_auto.factory');
3833

39-
$paths = array();
34+
$resources = array();
35+
4036
// auto mapping
4137
if ($config['auto_mapping']) {
42-
$paths = $this->findMappingFiles($container->getParameter('kernel.bundles'));
38+
$resources = $this->findMappingFiles($container->getParameter('kernel.bundles'));
4339
}
4440

45-
// add configured mapping file paths
46-
foreach ($config['mapping']['paths'] as $path) {
47-
$paths[] = $path;
41+
// add configured mapping file resources
42+
foreach ($config['mapping']['resources'] as $path) {
43+
$resources[] = $path;
4844
}
4945
$container->setParameter('cmf_routing_auto.mapping.loader.resources', $paths);
5046

@@ -55,16 +51,16 @@ public function load(array $configs, ContainerBuilder $container)
5551

5652
protected function findMappingFiles($bundles)
5753
{
58-
$paths = array();
54+
$resources = array();
5955
foreach ($bundles as $bundle) {
6056
foreach (array('xml', 'yml') as $extension) {
6157
if (file_exists($bundles->getPath().'/Resources/config/auto_routing.'.$extension)) {
62-
$paths[] = $extension;
58+
$resources[] = $extension;
6359
}
6460
}
6561
}
6662

67-
return $paths;
63+
return $resources;
6864
}
6965

7066
public function getNamespace()

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getConfigTreeBuilder()
2828
->children()
2929
->booleanNode('auto_mapping')->defaultTrue()->end()
3030
->arrayNode('mapping')
31-
->fixXmlConfig('path')
31+
->fixXmlConfig('resource')
3232
->children()
3333
->arrayNode('paths')
3434
->prototype('array')

0 commit comments

Comments
 (0)