1

I have created a custom config entity, which declares a list_builder controller to return a list of the created entities. Before creating a config entity, it renders as expected. Once I create a config entity via its add form, which redirects back to the list_builder controller, the error is thrown. The config entity is saved, but the redirect fails.

Here's the redirect in the config entity form class's ::save() method.

$form_state->setRedirect('my_module.entity.list');

Also, navigating directly to the list_builder controller path throws the same error.

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.config_entity_id.edit_form" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 187 of /home/vagrant/docroot/core/lib/Drupal/Core/Routing/RouteProvider.php)

I have no idea where the route entity.config_entity_id.edit_form is coming from. How to resolve the thrown error?

1
  • Add the annotation of the entity class and your routing.yml file.
    – Berdir
    Commented Jul 13, 2016 at 19:46

1 Answer 1

1

You have somewhere in your code the wrong route.

Probably your route in *.routing.yml is:

entity.my_new_entity.edit_form

But now you are redirecting to

entity.config_entity_id.edit_form

where there is still the placeholder from some example code.

4
  • 1
    I added my form redirect in the question above. I'm redirecting to the list_builder route, which is why I can't determine how the route that does not exist is being passed on to Symfony's router. Additionally, if I navigate directly to the list_builder path, I get the same error.
    – Jason
    Commented Jul 13, 2016 at 14:38
  • 1
    grep for the string config_entity_id, if you find it replace it with the correct id of your new config entity
    – 4uk4
    Commented Jul 13, 2016 at 15:20
  • 1
    I think the route, entity.config_entity_id.edit_form, was generated dynamically from the schema definition. Changing the schema fixed the issue.
    – Jason
    Commented Jul 17, 2016 at 20:15
  • 1
    Please put this in an answer, and accept it, so also others can see the end result!
    – ssibal
    Commented Feb 4, 2019 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.