Commit 7c58d4e2 authored by webchick's avatar webchick

Issue #2105821 by cosmicdreams: Fixed Updated Symfony CMF's Routing Component to v1.1.0 .

parent 73f2d97f
......@@ -1157,27 +1157,32 @@
},
{
"name": "symfony-cmf/routing",
"version": "1.1.0-beta1",
"version": "1.1.0",
"target-dir": "Symfony/Cmf/Component/Routing",
"source": {
"type": "git",
"url": "https://github.com/symfony-cmf/Routing.git",
"reference": "1.1.0-beta1"
"reference": "9f8607950cbf888ec678713a35f3d0088857c85f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony-cmf/Routing/zipball/1.1.0-beta1",
"reference": "1.1.0-beta1",
"url": "https://api.github.com/repos/symfony-cmf/Routing/zipball/9f8607950cbf888ec678713a35f3d0088857c85f",
"reference": "9f8607950cbf888ec678713a35f3d0088857c85f",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"psr/log": ">=1.0,<2.0",
"symfony/http-kernel": ">=2.2,<3.0",
"symfony/routing": ">=2.2,<3.0"
"psr/log": "~1.0",
"symfony/http-kernel": "~2.2",
"symfony/routing": "~2.2"
},
"require-dev": {
"symfony/config": "~2.2",
"symfony/dependency-injection": "~2.0",
"symfony/event-dispatcher": "~2.1"
},
"suggest": {
"symfony/http-foundation": "ChainRouter/DynamicRouter have optional support for Request instances, several enhancers require a Request instances, ~2.2"
"symfony/event-dispatcher": "DynamicRouter can optionally trigger an event at the start of matching. Minimal version ~2.1"
},
"type": "library",
"extra": {
......@@ -1206,7 +1211,7 @@
"database",
"routing"
],
"time": "2013-06-03 17:23:01"
"time": "2013-10-14 15:32:46"
},
{
"name": "symfony/class-loader",
......
<?php
// autoload.php @generated by Composer
// autoload.php generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit7ffa68419492d19fe654de54c86ae5d2::getLoader();
return ComposerAutoloaderInit2f086fd5a6ac4778e93c60384b7d424a::getLoader();
......@@ -49,7 +49,7 @@ class ClassLoader
public function getPrefixes()
{
return call_user_func_array('array_merge', $this->prefixes);
return $this->prefixes;
}
public function getFallbackDirs()
......@@ -98,21 +98,19 @@ public function add($prefix, $paths, $prepend = false)
return;
}
$first = $prefix[0];
if (!isset($this->prefixes[$first][$prefix])) {
$this->prefixes[$first][$prefix] = (array) $paths;
if (!isset($this->prefixes[$prefix])) {
$this->prefixes[$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixes[$first][$prefix] = array_merge(
$this->prefixes[$prefix] = array_merge(
(array) $paths,
$this->prefixes[$first][$prefix]
$this->prefixes[$prefix]
);
} else {
$this->prefixes[$first][$prefix] = array_merge(
$this->prefixes[$first][$prefix],
$this->prefixes[$prefix] = array_merge(
$this->prefixes[$prefix],
(array) $paths
);
}
......@@ -121,8 +119,8 @@ public function add($prefix, $paths, $prepend = false)
/**
* Registers a set of classes, replacing any others previously set.
*
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
* @param string $prefix The classes prefix
* @param array|string $paths The location(s) of the classes
*/
public function set($prefix, $paths)
{
......@@ -131,7 +129,7 @@ public function set($prefix, $paths)
return;
}
$this->prefixes[substr($prefix, 0, 1)][$prefix] = (array) $paths;
$this->prefixes[$prefix] = (array) $paths;
}
/**
......@@ -197,7 +195,6 @@ public function loadClass($class)
*/
public function findFile($class)
{
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
......@@ -208,7 +205,7 @@ public function findFile($class)
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$classPath = strtr(substr($class, 0, $pos), '\\', DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)) . DIRECTORY_SEPARATOR;
$className = substr($class, $pos + 1);
} else {
// PEAR-like class name
......@@ -216,16 +213,13 @@ public function findFile($class)
$className = $class;
}
$classPath .= strtr($className, '_', DIRECTORY_SEPARATOR) . '.php';
$classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
$first = $class[0];
if (isset($this->prefixes[$first])) {
foreach ($this->prefixes[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
foreach ($this->prefixes as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) {
return $dir . DIRECTORY_SEPARATOR . $classPath;
}
}
}
......
<?php
// autoload_classmap.php @generated by Composer
// autoload_classmap.php generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname(dirname($vendorDir));
......
<?php
// autoload_namespaces.php @generated by Composer
// autoload_namespaces.php generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname(dirname($vendorDir));
return array(
'Zend\\Stdlib\\' => array($vendorDir . '/zendframework/zend-stdlib'),
'Zend\\Feed\\' => array($vendorDir . '/zendframework/zend-feed'),
'Zend\\Escaper\\' => array($vendorDir . '/zendframework/zend-escaper'),
'Twig_' => array($vendorDir . '/twig/twig/lib'),
'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'),
'Symfony\\Component\\Validator\\' => array($vendorDir . '/symfony/validator'),
'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'),
'Symfony\\Component\\Serializer\\' => array($vendorDir . '/symfony/serializer'),
'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'),
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'),
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'),
'Symfony\\Component\\DependencyInjection\\' => array($vendorDir . '/symfony/dependency-injection'),
'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
'Symfony\\Component\\ClassLoader\\' => array($vendorDir . '/symfony/class-loader'),
'Symfony\\Cmf\\Component\\Routing' => array($vendorDir . '/symfony-cmf/routing'),
'Psr\\Log\\' => array($vendorDir . '/psr/log'),
'Guzzle\\Stream' => array($vendorDir . '/guzzle/stream'),
'Guzzle\\Parser' => array($vendorDir . '/guzzle/parser'),
'Guzzle\\Http' => array($vendorDir . '/guzzle/http'),
'Guzzle\\Common' => array($vendorDir . '/guzzle/common'),
'Gliph' => array($vendorDir . '/sdboyer/gliph/src'),
'EasyRdf_' => array($vendorDir . '/easyrdf/easyrdf/lib'),
'Drupal\\Driver' => array($baseDir . '/drivers/lib'),
'Drupal\\Core' => array($baseDir . '/core/lib'),
'Drupal\\Component' => array($baseDir . '/core/lib'),
'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib'),
'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib'),
'Doctrine\\Common\\Collections\\' => array($vendorDir . '/doctrine/collections/lib'),
'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib'),
'Doctrine\\Common\\Annotations\\' => array($vendorDir . '/doctrine/annotations/lib'),
'Doctrine\\Common\\' => array($vendorDir . '/doctrine/common/lib'),
'Assetic' => array($vendorDir . '/kriswallsmith/assetic/src'),
'Zend\\Stdlib\\' => $vendorDir . '/zendframework/zend-stdlib',
'Zend\\Feed\\' => $vendorDir . '/zendframework/zend-feed',
'Zend\\Escaper\\' => $vendorDir . '/zendframework/zend-escaper',
'Twig_' => $vendorDir . '/twig/twig/lib',
'Symfony\\Component\\Yaml\\' => $vendorDir . '/symfony/yaml',
'Symfony\\Component\\Validator\\' => $vendorDir . '/symfony/validator',
'Symfony\\Component\\Translation\\' => $vendorDir . '/symfony/translation',
'Symfony\\Component\\Serializer\\' => $vendorDir . '/symfony/serializer',
'Symfony\\Component\\Routing\\' => $vendorDir . '/symfony/routing',
'Symfony\\Component\\Process\\' => $vendorDir . '/symfony/process',
'Symfony\\Component\\HttpKernel\\' => $vendorDir . '/symfony/http-kernel',
'Symfony\\Component\\HttpFoundation\\' => $vendorDir . '/symfony/http-foundation',
'Symfony\\Component\\EventDispatcher\\' => $vendorDir . '/symfony/event-dispatcher',
'Symfony\\Component\\DependencyInjection\\' => $vendorDir . '/symfony/dependency-injection',
'Symfony\\Component\\Debug\\' => $vendorDir . '/symfony/debug',
'Symfony\\Component\\ClassLoader\\' => $vendorDir . '/symfony/class-loader',
'Symfony\\Cmf\\Component\\Routing' => $vendorDir . '/symfony-cmf/routing',
'Psr\\Log\\' => $vendorDir . '/psr/log',
'Guzzle\\Stream' => $vendorDir . '/guzzle/stream',
'Guzzle\\Parser' => $vendorDir . '/guzzle/parser',
'Guzzle\\Http' => $vendorDir . '/guzzle/http',
'Guzzle\\Common' => $vendorDir . '/guzzle/common',
'Gliph' => $vendorDir . '/sdboyer/gliph/src',
'EasyRdf_' => $vendorDir . '/easyrdf/easyrdf/lib',
'Drupal\\Driver' => $baseDir . '/drivers/lib',
'Drupal\\Core' => $baseDir . '/core/lib',
'Drupal\\Component' => $baseDir . '/core/lib',
'Doctrine\\Common\\Lexer\\' => $vendorDir . '/doctrine/lexer/lib',
'Doctrine\\Common\\Inflector\\' => $vendorDir . '/doctrine/inflector/lib',
'Doctrine\\Common\\Collections\\' => $vendorDir . '/doctrine/collections/lib',
'Doctrine\\Common\\Cache\\' => $vendorDir . '/doctrine/cache/lib',
'Doctrine\\Common\\Annotations\\' => $vendorDir . '/doctrine/annotations/lib',
'Doctrine\\Common\\' => $vendorDir . '/doctrine/common/lib',
'Assetic' => $vendorDir . '/kriswallsmith/assetic/src',
);
<?php
// autoload_real.php @generated by Composer
// autoload_real.php generated by Composer
class ComposerAutoloaderInit7ffa68419492d19fe654de54c86ae5d2
class ComposerAutoloaderInit2f086fd5a6ac4778e93c60384b7d424a
{
private static $loader;
......@@ -19,9 +19,9 @@ public static function getLoader()
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit7ffa68419492d19fe654de54c86ae5d2', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit2f086fd5a6ac4778e93c60384b7d424a', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit7ffa68419492d19fe654de54c86ae5d2', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit2f086fd5a6ac4778e93c60384b7d424a', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir));
......@@ -32,7 +32,7 @@ public static function getLoader()
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
$loader->add($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
......@@ -42,10 +42,8 @@ public static function getLoader()
$loader->register(true);
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) {
require $file;
}
require $vendorDir . '/kriswallsmith/assetic/src/functions.php';
require $baseDir . '/core/lib/Drupal.php';
return $loader;
}
......
<?php
// include_paths.php @generated by Composer
// include_paths.php generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname(dirname($vendorDir));
......
......@@ -219,61 +219,6 @@
"minification"
]
},
{
"name": "symfony-cmf/routing",
"version": "1.1.0-beta1",
"version_normalized": "1.1.0.0-beta1",
"target-dir": "Symfony/Cmf/Component/Routing",
"source": {
"type": "git",
"url": "https://github.com/symfony-cmf/Routing.git",
"reference": "1.1.0-beta1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony-cmf/Routing/zipball/1.1.0-beta1",
"reference": "1.1.0-beta1",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"psr/log": ">=1.0,<2.0",
"symfony/http-kernel": ">=2.2,<3.0",
"symfony/routing": ">=2.2,<3.0"
},
"suggest": {
"symfony/http-foundation": "ChainRouter/DynamicRouter have optional support for Request instances, several enhancers require a Request instances, ~2.2"
},
"time": "2013-06-03 17:23:01",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Cmf\\Component\\Routing": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony CMF Community",
"homepage": "https://github.com/symfony-cmf/Routing/contributors"
}
],
"description": "Extends the Symfony2 routing component for dynamic routes and chaining several routers",
"homepage": "http://cmf.symfony.com",
"keywords": [
"database",
"routing"
]
},
{
"name": "phpunit/php-text-template",
"version": "1.1.4",
......@@ -2110,5 +2055,65 @@
"php",
"spl"
]
},
{
"name": "symfony-cmf/routing",
"version": "1.1.0",
"version_normalized": "1.1.0.0",
"target-dir": "Symfony/Cmf/Component/Routing",
"source": {
"type": "git",
"url": "https://github.com/symfony-cmf/Routing.git",
"reference": "9f8607950cbf888ec678713a35f3d0088857c85f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony-cmf/Routing/zipball/9f8607950cbf888ec678713a35f3d0088857c85f",
"reference": "9f8607950cbf888ec678713a35f3d0088857c85f",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"psr/log": "~1.0",
"symfony/http-kernel": "~2.2",
"symfony/routing": "~2.2"
},
"require-dev": {
"symfony/config": "~2.2",
"symfony/dependency-injection": "~2.0",
"symfony/event-dispatcher": "~2.1"
},
"suggest": {
"symfony/event-dispatcher": "DynamicRouter can optionally trigger an event at the start of matching. Minimal version ~2.1"
},
"time": "2013-10-14 15:32:46",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-0": {
"Symfony\\Cmf\\Component\\Routing": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony CMF Community",
"homepage": "https://github.com/symfony-cmf/Routing/contributors"
}
],
"description": "Extends the Symfony2 routing component for dynamic routes and chaining several routers",
"homepage": "http://cmf.symfony.com",
"keywords": [
"database",
"routing"
]
}
]
......@@ -3,6 +3,7 @@ language: php
php:
- 5.3
- 5.4
- 5.5
env:
- SYMFONY_VERSION=2.2.*
......@@ -10,11 +11,14 @@ env:
- SYMFONY_VERSION=dev-master
before_script:
- composer require symfony/routing:${SYMFONY_VERSION} --no-update
- composer install --dev
- composer require symfony/routing:${SYMFONY_VERSION} --prefer-source
script: phpunit --coverage-text
notifications:
irc: "irc.freenode.org#symfony-cmf"
email: "symfony-cmf-devs@googlegroups.com"
matrix:
allow_failures:
- env: SYMFONY_VERSION=dev-master
Changelog
=========
1.1
---
1.1.0-RC1
---------
* **2013-04-30**: Dropped Symfony 2.1 support and got rid of ConfigurableUrlMatcher class
* **2013-04-05**: [ContentAwareGenerator] Fix locale handling to always respect locale but never have unnecessary ?locale=
* **2013-07-31**: DynamicRouter now accepts an EventDispatcher to trigger a
RouteMatchEvent right before the matching starts
* **2013-07-29**: Renamed RouteAwareInterface to RouteReferrersReadInterface
for naming consistency and added RouteReferrersInterface for write access.
* **2013-07-13**: NestedMatcher now expects a FinalMatcherInterface as second
argument of the constructor
1.1.0-alpha1
------------
* **2013-04-30**: Dropped Symfony 2.1 support and got rid of
ConfigurableUrlMatcher class
* **2013-04-05**: [ContentAwareGenerator] Fix locale handling to always respect
locale but never have unnecessary ?locale=
Contributing
------------
Symfony2 CMF is an open source, community-driven project. We follow the same
guidelines as core Symfony2. If you'd like to contribute, please read the
[Contributing Code][1] part of the documentation. If you're submitting a pull
request, please follow the guidelines in the [Submitting a Patch][2] section
and use the [Pull Request Template][3].
[1]: http://symfony.com/doc/current/contributing/code/index.html
[2]: http://symfony.com/doc/current/contributing/code/patches.html#check-list
[3]: http://symfony.com/doc/current/contributing/code/patches.html#make-a-pull-request
<?php
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2013 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Cmf\Component\Routing;
use Symfony\Component\Routing\RouterInterface;
......@@ -168,6 +178,7 @@ private function doMatch($url, Request $request = null)
if (null === $request) {
$request = Request::create($url);
}
return $router->matchRequest($request);
}
// every router implements the match method
......@@ -217,9 +228,7 @@ public function generate($name, $parameters = array(), $absolute = false)
try {
return $router->generate($name, $parameters, $absolute);
} catch (RouteNotFoundException $e) {
$hint = ($router instanceof VersatileGeneratorInterface)
? $router->getRouteDebugMessage($name, $parameters)
: "Route '$name' not found";
$hint = $this->getErrorMessage($name, $router, $parameters);
$debug[] = $hint;
if ($this->logger) {
$this->logger->info('Router '.get_class($router)." was unable to generate route. Reason: '$hint': ".$e->getMessage());
......@@ -231,12 +240,28 @@ public function generate($name, $parameters = array(), $absolute = false)
$debug = array_unique($debug);
$info = implode(', ', $debug);
} else {
$info = "No route '$name' found";
$info = $this->getErrorMessage($name);
}
throw new RouteNotFoundException(sprintf('None of the chained routers were able to generate route: %s', $info));
}
private function getErrorMessage($name, $router = null, $parameters = null)
{
if ($router instanceof VersatileGeneratorInterface) {
$displayName = $router->getRouteDebugMessage($name, $parameters);
} elseif (is_object($name)) {
$displayName = method_exists($name, '__toString')
? (string) $name
: get_class($name)
;
} else {
$displayName = (string) $name;
}
return "Route '$displayName' not found";
}
/**
* {@inheritdoc}
*/
......
<?php
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2013 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Cmf\Component\Routing;
use Symfony\Component\Routing\RouterInterface;
......@@ -9,5 +19,4 @@
*/
interface ChainedRouterInterface extends RouterInterface, VersatileGeneratorInterface
{
// nothing new to add
}
<?php
/*
* This file is part of the Symfony CMF package.
*
* (c) 2011-2013 Symfony CMF
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Cmf\Component\Routing;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Routing\Route as SymfonyRoute;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Symfony\Component\Routing\RouteCollection;
......@@ -16,6 +27,14 @@
*/
class ContentAwareGenerator extends ProviderBasedGenerator
{
/**
* The locale to use when neither the parameters nor the request context
* indicate the locale to use.
*
* @var string
*/
protected $defaultLocale = null;
/**
* The content repository used to find content by it's id
* This can be used to specify a parameter content_id when generating urls
......@@ -42,7 +61,7 @@ public function setContentRepository(ContentRepositoryInterface $contentReposito
* @param string $name ignored
* @param array $parameters must either contain the field 'route' with a
* RouteObjectInterface or the field 'content_id' with a document
* id to get the route for (implementing RouteAwareInterface)
* id to get the route for (implementing RouteReferrersReadInterface)
*
* @throws RouteNotFoundException If there is no such route in the database
*/
......@@ -103,8 +122,8 @@ protected function getBestLocaleRoute(SymfonyRoute $route, $parameters)
}
$locale = $this->getLocale($parameters);
if (! $this->checkLocaleRequirement($route, $locale)) {
$content = $route->getRouteContent();
if ($content instanceof RouteAwareInterface) {
$content = $route->getContent();
if ($content instanceof RouteReferrersReadInterface) {
$routes = $content->getRoutes();
$contentRoute = $this->getRouteByLocale($routes, $locale);
if ($contentRoute) {
......@@ -117,9 +136,10 @@ protected function getBestLocaleRoute(SymfonyRoute $route, $parameters)
}
/**
* Get the route based on the $name that is a RouteAwareInterface or a
* RouteAwareInterface content found in the content repository with the
* content_id specified in parameters.
* Get the route based on the $name that is an object implementing
* RouteReferrersReadInterface or a content found in the content repository
* with the content_id specified in parameters that is an instance of
* RouteReferrersReadInterface.
*
* Called in generate when there is no route given in the parameters.
*
......@@ -131,7 +151,8 @@ protected function getBestLocaleRoute(SymfonyRoute $route, $parameters)
* first route.
*
* @param mixed $name
* @param array $parameters which should contain a content field containing a RouteAwareInterface object
* @param array $parameters which should contain a content field containing
* a RouteReferrersReadInterface object
*
* @return SymfonyRoute the route instance
*
......@@ -139,7 +160,7 @@ protected function getBestLocaleRoute(SymfonyRoute $route, $parameters)
*/
protected function getRouteByContent($name, &$parameters)
{
if ($name instanceof RouteAwareInterface) {
if ($name instanceof RouteReferrersReadInterface) {
$content = $name;
} elseif (isset($parameters['content_id'])
&& null !== $this->contentRepository
......@@ -148,12 +169,12 @@ protected function getRouteByContent($name, &$parameters)
if (empty($content)) {
throw new RouteNotFoundException('The content repository found nothing at id ' . $parameters['content_id']);
}
if (!$content instanceof RouteAwareInterface) {
throw new RouteNotFoundException('Content repository did not return a RouteAwareInterface for id ' . $parameters['content_id']);
if (!$content instanceof RouteReferrersReadInterface) {
throw new RouteNotFoundException('Content repository did not return a RouteReferrersReadInterface instance for id ' . $parameters['content_id']);
}
} else {
$hint = is_object($name) ? get_class($name) : gettype($name);
throw new RouteNotFoundException("The route name argument '$hint' is not RouteAwareInterface and there is no 'content_id' parameter");
throw new RouteNotFoundException("The route name argument '$hint' is not RouteReferrersReadInterface instance and there is no 'content_id' parameter");
}
$routes = $content->getRoutes();
......@@ -171,7 +192,11 @@ protected function getRouteByContent($name, &$parameters)
return $route;
}
// if none matched, continue and randomly return the first one
// if none matched, randomly return the first one
if ($routes instanceof Collection) {