Perform the duplicate check of parameter names already on initial creation

This fixes issue #568
This commit is contained in:
Jan Böhmer 2024-04-28 19:38:39 +02:00
parent dfe4568991
commit b70d74ae4b
4 changed files with 12 additions and 2 deletions

View file

@ -54,6 +54,7 @@ use App\Entity\Parts\PartTraits\OrderTrait;
use App\Entity\Parts\PartTraits\ProjectTrait;
use App\EntityListeners\TreeCacheInvalidationListener;
use App\Repository\PartRepository;
use App\Validator\Constraints\UniqueObjectCollection;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@ -119,6 +120,7 @@ class Part extends AttachmentContainingDBElement
#[Groups(['full', 'part:read', 'part:write'])]
#[ORM\OneToMany(mappedBy: 'element', targetEntity: PartParameter::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['group' => 'ASC', 'name' => 'ASC'])]
#[UniqueObjectCollection(fields: ['name', 'group', 'element'])]
protected Collection $parameters;