Enforce unique constraint on relation activity storedobject

This commit is contained in:
2024-12-05 12:37:39 +00:00
committed by Julien Fastré
parent 486ad3bb41
commit b0f1cf272f
3 changed files with 56 additions and 0 deletions

View File

@@ -84,6 +84,11 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
*/
#[Assert\Valid(traverse: true)]
#[ORM\ManyToMany(targetEntity: StoredObject::class, cascade: ['persist'])]
#[ORM\JoinTable(
name: 'activity_storedobject',
joinColumns: new ORM\JoinColumn(name: 'activity_id', referencedColumnName: 'id', nullable: false),
inverseJoinColumns: new ORM\InverseJoinColumn(name: 'storedobject_id', referencedColumnName: 'id', unique: true, nullable: false)
)]
private Collection $documents;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TIME_MUTABLE, nullable: true)]