commit fae3a9df814c0e7ab0ae4f110e61d2d6c794d621 parent ad70d9ea2769234890401455c0323c23f52206b0 Author: Felicitus <felicitus@felicitus.org> Date: Fri, 4 Sep 2015 19:08:51 +0200 Implemented adders and removers for manufacturers and distributors Diffstat:
M | src/PartKeepr/PartBundle/Entity/Part.php | | | 44 | ++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 44 insertions(+), 0 deletions(-)
diff --git a/src/PartKeepr/PartBundle/Entity/Part.php b/src/PartKeepr/PartBundle/Entity/Part.php @@ -677,6 +677,50 @@ class Part extends BaseEntity } /** + * Adds a Part Manufacturer + * + * @param PartManufacturer $partManufacturer A part manufacturer to add + */ + public function addManufacturer (PartManufacturer $partManufacturer) + { + $partManufacturer->setPart($this); + $this->manufacturers->add($partManufacturer); + } + + /** + * Removes a part manufacturer + * + * @param PartManufacturer $partManufacturer A part manufacturer to remove + */ + public function removeManufacturer(PartManufacturer $partManufacturer) + { + $partManufacturer->setPart(null); + $this->manufacturers->removeElement($partManufacturer); + } + + /** + * Adds a Part Distributor + * + * @param PartDistributor $partDistributor A part distributor to add + */ + public function addDistributor (PartDistributor $partDistributor) + { + $partDistributor->setPart($this); + $this->distributors->add($partDistributor); + } + + /** + * Removes a part distributor + * + * @param PartDistributor $partDistributor A part distributor to remove + */ + public function removeDistributor(PartDistributor $partDistributor) + { + $partDistributor->setPart(null); + $this->distributors->removeElement($partDistributor); + } + + /** * Returns the project parts * * @return ArrayCollection