Make NullGenerator fail gracefully, since we can't yet avoid it being called at all.

8.0.x
Larry Garfield 2012-12-24 18:37:36 -06:00
parent 99e068c486
commit ed9c2a50f5
1 changed files with 3 additions and 3 deletions

View File

@ -8,6 +8,7 @@
namespace Drupal\Core\Routing;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
/**
* No-op implementation of a Url Generator, needed for backward compatibility.
@ -15,14 +16,13 @@ use Symfony\Component\Routing\RequestContext;
class NullGenerator implements UrlGeneratorInterface {
public function generate($name, $parameters = array(), $absolute = FALSE) {
throw new \Exception('Method disabled. This is a dummy implementation.');
return '';
throw new RouteNotFoundException();
}
public function setContext(RequestContext $context) {
throw new \Exception('Method disabled. This is a dummy implementation.');
}
public function getContext() {
throw new \Exception('Method disabled. This is a dummy implementation.');
}
}