mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-24 10:49:00 +02:00
Perform the duplicate check of parameter names already on initial creation
This fixes issue #568
This commit is contained in:
parent
dfe4568991
commit
b70d74ae4b
4 changed files with 12 additions and 2 deletions
|
@ -53,6 +53,7 @@ use ApiPlatform\Metadata\Patch;
|
|||
use ApiPlatform\Metadata\Post;
|
||||
use App\ApiPlatform\Filter\LikeFilter;
|
||||
use App\Repository\ParameterRepository;
|
||||
use App\Validator\UniqueValidatableInterface;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
|
@ -94,7 +95,7 @@ use function sprintf;
|
|||
#[ApiFilter(OrderFilter::class, properties: ['name', 'id', 'addedDate', 'lastModified'])]
|
||||
//This discriminator map is required for API platform to know which class to use for deserialization, when creating a new parameter.
|
||||
#[DiscriminatorMap(typeProperty: '_type', mapping: self::API_DISCRIMINATOR_MAP)]
|
||||
abstract class AbstractParameter extends AbstractNamedDBElement
|
||||
abstract class AbstractParameter extends AbstractNamedDBElement implements UniqueValidatableInterface
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -458,4 +459,9 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
|||
{
|
||||
return static::ALLOWED_ELEMENT_CLASS;
|
||||
}
|
||||
|
||||
public function getComparableFields(): array
|
||||
{
|
||||
return ['name' => $this->name, 'group' => $this->group, 'element' => $this->element?->getId()];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue