Allow only a single orderinfo with a supplier and order nr.

This commit is contained in:
Jan Böhmer 2020-03-30 15:21:21 +02:00
parent 25a4f804d7
commit 3b4d6e0736

View file

@ -59,6 +59,7 @@ use App\Entity\Parts\Supplier;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/** /**
@ -67,6 +68,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Table("`orderdetails`") * @ORM\Table("`orderdetails`")
* @ORM\Entity() * @ORM\Entity()
* @ORM\HasLifecycleCallbacks() * @ORM\HasLifecycleCallbacks()
* @UniqueEntity({"supplierpartnr", "supplier", "part"})
*/ */
class Orderdetail extends AbstractDBElement implements TimeStampableInterface, NamedElementInterface class Orderdetail extends AbstractDBElement implements TimeStampableInterface, NamedElementInterface
{ {