You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 23, 2020. It is now read-only.
I have created a custom entity type called Event which I wish to designate as an RNG event type. I have set up the configuration as required and I can see Event and Register tabs when viewing an entity of type Event. Great.
However, when I attempt to visit the Event or Register tabs I get presented with a 404. I have done extensive debugging on why this may be. I have checked out all the registered routes using both Drupal Console and this snippet:
So the routes exist, but I cannot access them. So I then began to dig through the Drupal routing and I checked the router database table and sure enough I spot the following:
Clearly the pattern_outline field (3rd field above) is incorrect. It should be /events/series/%/event. And that can be confirmed by verifying the path ancestors from RouteProvider:
Eventually I managed to figure out that the way the way that RNG defines RouteSubscriber::alterRoutes() it is defining the default parameter values are below:
array(
'_form' => '\Drupal\rng\Form\EventSettingsForm',
'_title' => 'Manage event',
// Tell controller which parameter the event entity is stored.
'event' => $entity_type,
),
In this case, the killer is event because \Drupal\Core\Routing\RouteCompiler::getPathWithoutDefaults() then strips out the defaults from the path in this case it would strip out /{_form} , /{_title}, and critically /{event} which is how we end up with /events/series/event instead of /events/series/%/event.
So because my entity type is named event and the routing parameter is called event in my custom routes this breaks all RNG paths.
Given the likelihood of developers naming an entity type used for events as event this seems like it could have pretty dire consequences for people other than myself.
Could the default parameter be named something else - like rng_event ?
The text was updated successfully, but these errors were encountered:
if-owen
changed the title
RNG routes fail if the entity name is 'Event' due to default route parameters.
RNG routes fail if the entity routing parameter is name 'event' due to default route parameters.
Jun 7, 2018
if-owen
changed the title
RNG routes fail if the entity routing parameter is name 'event' due to default route parameters.
RNG routes fail if the entity routing parameter is named 'event' due to default route parameters.
Jun 7, 2018
I have created a custom entity type called
Event
which I wish to designate as an RNG event type. I have set up the configuration as required and I can seeEvent
andRegister
tabs when viewing an entity of typeEvent
. Great.However, when I attempt to visit the
Event
orRegister
tabs I get presented with a 404. I have done extensive debugging on why this may be. I have checked out all the registered routes using both Drupal Console and this snippet:I could see the paths in there that I would expect to see such as this one for
.../event
So the routes exist, but I cannot access them. So I then began to dig through the Drupal routing and I checked the
router
database table and sure enough I spot the following:rng.event.event.event /events/series/{event}/event /events/series/event
Clearly the pattern_outline field (3rd field above) is incorrect. It should be
/events/series/%/event
. And that can be confirmed by verifying the path ancestors from RouteProvider:Eventually I managed to figure out that the way the way that RNG defines
RouteSubscriber::alterRoutes()
it is defining the default parameter values are below:In this case, the killer is
event
because\Drupal\Core\Routing\RouteCompiler::getPathWithoutDefaults()
then strips out the defaults from the path in this case it would strip out/{_form}
,/{_title}
, and critically/{event}
which is how we end up with/events/series/event
instead of/events/series/%/event
.So because my entity type is named
event
and the routing parameter is calledevent
in my custom routes this breaks all RNG paths.Given the likelihood of developers naming an entity type used for events as
event
this seems like it could have pretty dire consequences for people other than myself.Could the default parameter be named something else - like
rng_event
?The text was updated successfully, but these errors were encountered: