mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-26 11:48:49 +02:00
Allow to create parameters via the API
This commit is contained in:
parent
e3d2012809
commit
e843286ea7
12 changed files with 48 additions and 2 deletions
|
@ -44,8 +44,10 @@ namespace App\Entity\Parameters;
|
|||
use App\Repository\ParameterRepository;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Serializer\OverrideClassDenormalizer;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Symfony\Component\Serializer\Attribute\Context;
|
||||
|
||||
#[UniqueEntity(fields: ['name', 'group', 'element'])]
|
||||
#[ORM\Entity(repositoryClass: ParameterRepository::class)]
|
||||
|
@ -58,5 +60,6 @@ class MeasurementUnitParameter extends AbstractParameter
|
|||
*/
|
||||
#[ORM\ManyToOne(targetEntity: MeasurementUnit::class, inversedBy: 'parameters')]
|
||||
#[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')]
|
||||
#[Context(denormalizationContext: [OverrideClassDenormalizer::CONTEXT_KEY => self::ALLOWED_ELEMENT_CLASS])]
|
||||
protected ?AbstractDBElement $element = null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue