Score:0

Entity route requirement not working

ph flag

I'm trying to get the following route working but the entity bundle requirement won't work. If I switch requirements to _access: 'TRUE' it works but entity checks are not working. I've traced it to EntityBundleAccessCheck.php where the node parameter is a string containing the node ID instead of the loaded entity, but I'm not sure why.

entity.node.send:
  path: '/node/{node}/send'
  defaults:
    _title: 'Send'
    _controller: '\Drupal\nm_resend\Controller\Send::send'
  requirements:
    _entity_bundles: 'node:resend'
  options:
    _node_operation_route: TRUE
Jaypan avatar
de flag
What's your goal? What would a successful outcome look like? What is happening now that differs from that successful outcome?
Lambic avatar
ph flag
The goal is for the route to work for that bundle. The access check fails so I get access denied. I've worked around it for now by using _custom_access instead of _entity_bundles but still not sure why _entity_bundles doesn't work.
Jaypan avatar
de flag
Sorry, I can't help without the answers to the questions i asked in my last comment.
Lambic avatar
ph flag
I've answered your questions. Goal: The route works and I'm taken to the page served by the controller. What is happening: access check fails causing an access denied
I sit in a Tesla and translated this thread with Ai:

TH:
RO:
RU:
VI:
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.