mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-25 11:18:51 +02:00
Fixed orphanRemoval problem with parts collection.
Also ElementPermissionListener was improved, and multiple special cases were unified.
This commit is contained in:
parent
7a9bfdf7f9
commit
3d790db559
4 changed files with 38 additions and 46 deletions
|
@ -78,9 +78,6 @@ use Symfony\Component\Validator\Constraints as Assert;
|
|||
/**
|
||||
* Part class.
|
||||
*
|
||||
* DONT USE orphanRemoval on properties with ColumnSecurity!! An empty collection will be created as placeholder,
|
||||
* and the partlots are deleted, even if we want dont want that!
|
||||
*
|
||||
* The class properties are split over various traits in directory PartTraits.
|
||||
* Otherwise this class would be too big, to be maintained.
|
||||
*
|
||||
|
@ -125,7 +122,7 @@ class Part extends AttachmentContainingDBElement
|
|||
protected $name = '';
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=false)
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @ColumnSecurity(type="collection", prefix="attachments")
|
||||
* @Assert\Valid()
|
||||
*/
|
||||
|
|
|
@ -45,7 +45,7 @@ trait InstockTrait
|
|||
{
|
||||
/**
|
||||
* @var ?PartLot[]|Collection A list of part lots where this part is stored
|
||||
* @ORM\OneToMany(targetEntity="PartLot", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=false)
|
||||
* @ORM\OneToMany(targetEntity="PartLot", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
* @ColumnSecurity(type="collection", prefix="lots")
|
||||
*/
|
||||
|
|
|
@ -45,7 +45,7 @@ trait OrderTrait
|
|||
{
|
||||
/**
|
||||
* @var Orderdetail[] The details about how and where you can order this part.
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=false)
|
||||
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true)
|
||||
* @Assert\Valid()
|
||||
* @ColumnSecurity(prefix="orderdetails", type="collection")
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue