I wan't to make a "classic" API without IRI. I just want the ID in return, not an IRI nor the object/entity.
I already allow plain identifiers:
// config/packages/api_platform.yml
api_platform:
allow_plain_identifiers: true
If I make any request with Header Accept: application/json, it's still the same.
I I try to cheat and replace my getter of my linked entity by a getId()
public function getStatus(): AngelRelationshipStatus
{
return $this->status;
}
by
public function getStatus(): int
{
return $this->status->getId();
}
I'm getting the Following error : "Warning: get_class() expects parameter 1 to be object, integer given"
Why can't I just get a simple ID?
Environment:
- PHP 7.2
- API Platform 2.3