core icon indicating copy to clipboard operation
core copied to clipboard

feat(doctrine): add requirements dynamically based on doctrine field

Open VincentLanglet opened this issue 4 months ago • 1 comments

Q A
Branch? main
Tickets Closes #7476
License MIT
Doc PR api-platform/docs#...

VincentLanglet avatar Oct 22 '25 12:10 VincentLanglet

Test are failing because of this line https://github.com/api-platform/core/blob/15ea6d8f7aa163d4daa06bc9b3080c14cb87daac/tests/Fixtures/TestBundle/State/ContainNonResourceProvider.php#L41

1-nested is set as id to the nested ressource and then the uri is not correctly generated because it's not a valid id.

I feel like the error is still legit because the resource has

    #[ORM\Column(type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'AUTO')]
    #[Groups('contain_non_resource')]

which means that 1-nested will never be a valid id.

But it still make me think I cannot add automatically a requirement if a Provider is used.

VincentLanglet avatar Oct 23 '25 20:10 VincentLanglet