Allow to create Attachments for all entity types using the API

This fixes issue #502
This commit is contained in:
Jan Böhmer 2024-03-02 21:39:30 +01:00
parent 16b3d58242
commit ce768764cc
14 changed files with 47 additions and 9 deletions

View file

@ -46,7 +46,6 @@ class PartAttachment extends Attachment
*/
#[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'attachments')]
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
// Set the correct type for the element property to use
#[Context(denormalizationContext: [OverrideClassDenormalizer::CONTEXT_KEY => Part::class])]
#[Context(denormalizationContext: [OverrideClassDenormalizer::CONTEXT_KEY => self::ALLOWED_ELEMENT_CLASS])]
protected ?AttachmentContainingDBElement $element = null;
}