Fixed problem that no datastructures with an parent element could be created/edited via API

This fixes issue #512.
The error was introduced when trying to allow the modification of attachments/parameters throught the parent element. We need a seperate write scope to the element, or we end up with an infinite loop.
This commit is contained in:
Jan Böhmer 2024-02-06 22:42:25 +01:00
parent fea8109789
commit 3cc1fb40f0
2 changed files with 4 additions and 4 deletions

View file

@ -77,7 +77,7 @@ use LogicException;
new Delete(security: 'is_granted("delete", object)'),
],
normalizationContext: ['groups' => ['attachment:read', 'attachment:read:standalone', 'api:basic:read'], 'openapi_definition_name' => 'Read'],
denormalizationContext: ['groups' => ['attachment:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
denormalizationContext: ['groups' => ['attachment:write', 'attachment:write:standalone', 'api:basic:write'], 'openapi_definition_name' => 'Write'],
)]
#[DocumentedAPIProperty(schemaName: 'Attachment-Read', property: 'media_url', type: 'string', nullable: true,
description: 'The URL to the file, where the attachment file can be downloaded. This can be an internal or external URL.',
@ -142,7 +142,7 @@ abstract class Attachment extends AbstractNamedDBElement
* ORM mapping is done in subclasses (like PartAttachment).
* @phpstan-param T|null $element
*/
#[Groups(['attachment:read:standalone', 'attachment:write'])]
#[Groups(['attachment:read:standalone', 'attachment:write:standalone'])]
protected ?AttachmentContainingDBElement $element = null;
#[ORM\Column(type: Types::BOOLEAN)]