Skip to content

AdminRoute requirements option #7496

@madflow

Description

@madflow

Describe the bug

The requirements option in an AdminRoute seems to be evaluated after fetching the entity from the database (or not all all).

This works in Symfony:

  • When I request /admin/dashboard/preview/foo -> I get a 404
    #[Route(path: '/admin/dashboard/preview/{entityId}', name: 'preview', requirements: ['entityId' => Requirement::UUID_V7])]
    public function preview(): Response
    {

When I am using AdminRoute:

    #[AdminRoute(path: '/preview/{entityId}', name: 'preview', options: ['requirements' => ['entityId' => Requirement::UUID_V7]])]
    public function preview(AdminContext $context): Response
  • When I request /admin/dashboard/preview/foo -> I get
Doctrine\DBAL\Types\ConversionException:
Could not convert database value "foo" to Doctrine Type uuid

To Reproduce

  • Create an AdminRoute with a requirements option.

(OPTIONAL) Additional context

  • I would expect the requirements array to be evaluated before, the Entity is fetched from the database.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions