Added the possibility to edit/create/delete part lots.

This commit is contained in:
Jan Böhmer 2019-08-19 23:31:16 +02:00
parent 6a0adae8f3
commit 813e7dc85b
11 changed files with 226 additions and 43 deletions

View file

@ -179,7 +179,8 @@ class Part extends AttachmentContainingDBElement
/**
* @var ?PartLot[]
* @ORM\OneToMany(targetEntity="PartLot", mappedBy="part")
* @ORM\OneToMany(targetEntity="PartLot", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
* @Assert\Valid()
*/
protected $partLots;
@ -593,6 +594,18 @@ class Part extends AttachmentContainingDBElement
return $this->partLots;
}
public function addPartLot(PartLot $lot): Part
{
$lot->setPart($this);
$this->partLots->add($lot);
return $this;
}
public function removePartLot(PartLot $lot): Part
{
$this->partLots->removeElement($lot);
return $this;
}
/**
* Returns the assigned manufacturer product number (MPN) for this part.