mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 09:53:35 +02:00
Enforce unique names per level on structural elements.
This commit is contained in:
parent
7c43feefbe
commit
09eb3c226a
2 changed files with 14 additions and 0 deletions
|
@ -26,6 +26,7 @@ namespace App\Entity;
|
|||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use App\Validator\Constraints\NoneOfItsChildren;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
|
||||
/**
|
||||
* All elements with the fields "id", "name" and "parent_id" (at least).
|
||||
|
@ -37,6 +38,8 @@ use App\Validator\Constraints\NoneOfItsChildren;
|
|||
* an attribute of a root element, you will get an exception!
|
||||
*
|
||||
* @ORM\MappedSuperclass(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||
*
|
||||
* @UniqueEntity(fields={"name", "parent"}, ignoreNull=false, message="structural.entity.unique_name")
|
||||
*/
|
||||
abstract class StructuralDBElement extends AttachmentContainingDBElement
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue