partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit c544d57d23e70274c3e5ab5bc8b5f6fd853823d3
parent e0bd85b2989b7280faa3ba315a2b2252576fe530
Author: Felicitus <felicitus@felicitus.org>
Date:   Tue,  7 Jul 2015 17:11:39 +0200

Allow any object to be set. This is a workaround.

Diffstat:
Msrc/PartKeepr/ManufacturerBundle/Entity/Manufacturer.php | 14+++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/PartKeepr/ManufacturerBundle/Entity/Manufacturer.php b/src/PartKeepr/ManufacturerBundle/Entity/Manufacturer.php @@ -3,7 +3,6 @@ namespace PartKeepr\ManufacturerBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; -use Doctrine\ORM\PersistentCollection; use PartKeepr\DoctrineReflectionBundle\Annotation\TargetService; use PartKeepr\UploadedFileBundle\Annotation\UploadedFileCollection; use PartKeepr\Util\BaseEntity; @@ -250,10 +249,14 @@ class Manufacturer extends BaseEntity /** * Adds an IC Logo. * - * @param ManufacturerICLogo $icLogo + * @param object $icLogo Either a ManufacturerICLogo or a TempImage */ - public function addIcLogo(ManufacturerICLogo $icLogo) { - $icLogo->setManufacturer($this); + public function addIcLogo($icLogo) + { + if ($icLogo instanceof ManufacturerICLogo) { + $icLogo->setManufacturer($this); + } + $this->icLogos->add($icLogo); } @@ -262,7 +265,8 @@ class Manufacturer extends BaseEntity * * @param ManufacturerICLogo $icLogo */ - public function removeIcLogo(ManufacturerICLogo $icLogo) { + public function removeIcLogo(ManufacturerICLogo $icLogo) + { $icLogo->setManufacturer(null); $this->icLogos->removeElement($icLogo); }