mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-22 18:03:37 +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\Mapping as ORM;
|
||||||
use Doctrine\ORM\PersistentCollection;
|
use Doctrine\ORM\PersistentCollection;
|
||||||
use App\Validator\Constraints\NoneOfItsChildren;
|
use App\Validator\Constraints\NoneOfItsChildren;
|
||||||
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All elements with the fields "id", "name" and "parent_id" (at least).
|
* 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!
|
* an attribute of a root element, you will get an exception!
|
||||||
*
|
*
|
||||||
* @ORM\MappedSuperclass(repositoryClass="App\Repository\StructuralDBElementRepository")
|
* @ORM\MappedSuperclass(repositoryClass="App\Repository\StructuralDBElementRepository")
|
||||||
|
*
|
||||||
|
* @UniqueEntity(fields={"name", "parent"}, ignoreNull=false, message="structural.entity.unique_name")
|
||||||
*/
|
*/
|
||||||
abstract class StructuralDBElement extends AttachmentContainingDBElement
|
abstract class StructuralDBElement extends AttachmentContainingDBElement
|
||||||
{
|
{
|
||||||
|
|
11
translations/validators.de.xlf
Normal file
11
translations/validators.de.xlf
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en" trgLang="de">
|
||||||
|
<file id="validators.de">
|
||||||
|
<unit id="VJHTkxx" name="structural.entity.unique_name">
|
||||||
|
<segment>
|
||||||
|
<source>structural.entity.unique_name</source>
|
||||||
|
<target>Es kann auf jeder Ebene nur ein Objekt mit dem gleichem Namen geben!</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
</file>
|
||||||
|
</xliff>
|
Loading…
Add table
Add a link
Reference in a new issue