Skip to content

Please let us to decide if an entity it is dereferencable or not, don't fore us to do this. #2214

@videni

Description

@videni

I have created some related issues at api-platform/api-platform repo, but there are fewer people watching that repo, I created here. this issue is very important, I hope to raise our community notice.

Why I think it is a issue?

when an entity is used for admin user, it is dereferencable, but when it is used for customer, it might not. api-platform gives me lots of troubles because of this design.

Case 1: dereferencable for admin, not for customer.

for example , a Order entity has a property car, the car property is also an entity. when car entity is used for admin, it is dereferencable, but it is not for customer. the car entity is only showed when customer views order details, it is not necessary to add an item operation to car for customer.

Case 2: change get item operation

let's assume the Order entity has another property payment, payment is dereferencable for admin and customer, which means, for admin, the get item operation path is /api/admin/payment/{id} , for customer, it is /api/shop/payment/{id}, then when we try to serialize the Order for customer, how can we choose the get item operation for customer , not the admin one?

Related issues

How to disable a single itemOperation
don't force use to specify item route for an entity

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions