. */ declare(strict_types=1); namespace App\Entity\Attachments; use App\Entity\Parts\Part; use Doctrine\ORM\Mapping as ORM; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * A attachment attached to a part element. * @extends Attachment */ #[UniqueEntity(['name', 'attachment_type', 'element'])] #[ORM\Entity] class PartAttachment extends Attachment { final public const ALLOWED_ELEMENT_CLASS = Part::class; /** * @var Part the element this attachment is associated with */ #[ORM\ManyToOne(targetEntity: Part::class, inversedBy: 'attachments')] #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] protected ?AttachmentContainingDBElement $element = null; }