Problem/Motivation
In an effort to reduce the number of ways to generate a link, we deprecated calling Router::generate() in Drupal 8.3.0
Last time we tried to remove it, we realised we couldn't because it was on RouterInterface, so we said it will start throwing an exception in Drupal 10.
/**
* {@inheritdoc}
*/
public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH): string {
@trigger_error(__METHOD__ . '() is deprecated in drupal:8.3.0 and will throw an exception from drupal:10.0.0. Use the \Drupal\Core\Url object instead. See https://www.drupal.org/node/2820197', E_USER_DEPRECATED);
return $this->urlGenerator->generate($name, $parameters, $referenceType);
}
I think we need to remove the @inheritdoc, add a @throws, and then have an exception message which tells people to use the Url object instead.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3293284-3.patch | 2.69 KB | catch |
| #3 | 3293284-interdiff.txt | 535 bytes | catch |
| #2 | 3293284.patch | 2.68 KB | catch |
Comments
Comment #2
catchComment #3
catchAdding a line.
Comment #4
daffie commentedAll code changes look good to me.
This is a D10 change only.
It is RTBC for me.
Comment #5
alexpottCommitted and pushed c4edefd1d7 to 10.1.x and 678fdc7ff1 to 10.0.x. Thanks!