commit 0224c388a6d360d869c1cf215087b0b293f527ba
parent 23085c66f6b77ed8325daa56f7c6a3128df93115
Author: Felicitus <felicitus@felicitus.org>
Date: Sat, 18 Jul 2015 01:17:07 +0200
Automatically remove orphans, allow the footprint to be null for automatic removal
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/PartKeepr/FootprintBundle/Entity/Footprint.php b/src/PartKeepr/FootprintBundle/Entity/Footprint.php
@@ -59,7 +59,7 @@ class Footprint extends BaseEntity
* Holds the footprint attachments
*
* @ORM\OneToMany(targetEntity="PartKeepr\FootprintBundle\Entity\FootprintAttachment",
- * mappedBy="footprint", cascade={"persist", "remove"})
+ * mappedBy="footprint", cascade={"persist", "remove"}, orphanRemoval=true)
* @UploadedFileCollection()
* @Groups({"default"})
*
diff --git a/src/PartKeepr/FootprintBundle/Entity/FootprintAttachment.php b/src/PartKeepr/FootprintBundle/Entity/FootprintAttachment.php
@@ -33,7 +33,7 @@ class FootprintAttachment extends UploadedFile
*
* @param Footprint $footprint The footprint to set
*/
- public function setFootprint(Footprint $footprint)
+ public function setFootprint(Footprint $footprint = null)
{
$this->footprint = $footprint;
}