I am creating a new entity and would like it to be in the users profile.
The path should be "/user/{user-id}/documents/X":
/*
* links = {
* "canonical" = "/user/{user}/documents/{document}",
* "add-form" = "/user/{user}/documents/add",
* "edit-form" = "/user/{user}/documents/{document}/edit",
* "delete-form" = "/user/{user}/documents/{document}/delete",
* "collection" = "/user/{user}/documents",
* },
*/
When I enter any page, the following error appears.
SymfonyComponentRoutingExceptionMissingMandatoryParametersException: Some mandatory parameters are missing ("user") to generate a URL for route "entity.document.collection". in DrupalCoreRoutingUrlGenerator->doGenerate() (line 182 of /var/www/html/web/core/lib/Drupal/Core/Routing/UrlGenerator.php).
I have also tried to create the routing.yml file but it still gives the same error.
entity.document.collection:
path: '/user/{user}/documents'
defaults:
_entity_list: 'document'
_title: 'Document List'
requirements:
_permission: 'access content'
options:
parameters:
user:
type: entity:user
Is there any way to achieve what I want?