Skip to content

No 404 on subresources route when parent doesn't exist #1811

Description

@Nightbr

Hello,

Api platform seems to not handle when we call a subresource route and the parent doesn't exist.

For example if I called /books/99999999/reviews and the entity Book with id 99999999 doesn't exist, it returns a 200 OK response with no items. Book OneToMany Review.

And If I tried the same thing with a OneToOne relation: /apps/999999/menu it returns 200 OK response with null in the body the same as there is no menu.

I think here it should throw a 404 error Parent not found. see this.

I tried to dive in the code base of API Platform in order to identify where this verification can be done but I haven't found out...

If someone can lead me on this I can create a PR and add this feature. I think there is a lot of case where the client need to known when the parent doesn't exist to work properly.

Thanks for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions