Allow to create attachments and parameters via PATCH operations on their owning elemens as direct POST operations are not possible yet

This partly fixes issue #502
This commit is contained in:
Jan Böhmer 2024-01-28 19:50:59 +01:00
parent 3548f12deb
commit 7ae0fad356
11 changed files with 11 additions and 11 deletions

View file

@ -153,7 +153,7 @@ abstract class Attachment extends AbstractNamedDBElement
#[ORM\ManyToOne(targetEntity: AttachmentType::class, inversedBy: 'attachments_with_type')]
#[ORM\JoinColumn(name: 'type_id', nullable: false)]
#[Selectable()]
#[Groups(['attachment:read', 'attachment_write'])]
#[Groups(['attachment:read', 'attachment:write'])]
protected ?AttachmentType $attachment_type = null;
#[Groups(['attachment:read'])]

View file

@ -66,7 +66,7 @@ use Symfony\Component\Validator\Constraints as Assert;
new Delete(security: 'is_granted("delete", object)'),
],
normalizationContext: ['groups' => ['attachment_type:read', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
denormalizationContext: ['groups' => ['attachment_type:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
denormalizationContext: ['groups' => ['attachment_type:write', 'api:basic:write', 'attachment:write', 'parameter:write'], 'openapi_definition_name' => 'Write'],
)]
#[ApiResource(
uriTemplate: '/attachment_types/{id}/children.{_format}',