[Doctrine] Not include write operations for readonly entities
Description
Entities can be marked as readonly. The ApiResource operations could respect that, and by default not include the write-related operations.
Example
<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use Doctrine\ORM\Mapping as ORM;
#[ApiResource]
#[ORM\Entity(readOnly: true)]
class Foo
{
# ...
}
Actual
Expected
This is a new feature?
https://github.com/api-platform/core/blob/main/src/Doctrine/Orm/Metadata/Resource/DoctrineOrmResourceCollectionMetadataFactory.php for reference to where to add this
Curious whether or not this feature should be considered as a BC break, by not including write actions anymore. Another perspective; these entities already are readOnly, so probably don't allow any writes either way.
For now you just need to specify the operations:
#[ApiResource(operations: [new Get(), new GetCollection()])]