X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FModels%2FECommerce%2FECommerceCategory.php;fp=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FModels%2FECommerce%2FECommerceCategory.php;h=a8d8dc6bbb142d844923ef8438a4997303ac2287;hb=8b04b2d11798dee4f3e1358e4f43e97a6df851f6;hp=0000000000000000000000000000000000000000;hpb=73568cf05a785a45f94ca3f2351d9e07bf917958;p=zf2.biz%2Fapplication_blanche.git diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php b/vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php new file mode 100644 index 0000000..a8d8dc6 --- /dev/null +++ b/vendor/doctrine/orm/tests/Doctrine/Tests/Models/ECommerce/ECommerceCategory.php @@ -0,0 +1,126 @@ +products = new ArrayCollection(); + $this->children = new ArrayCollection(); + } + + public function getId() + { + return $this->id; + } + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } + + public function addProduct(ECommerceProduct $product) + { + if (!$this->products->contains($product)) { + $this->products[] = $product; + $product->addCategory($this); + } + } + + public function removeProduct(ECommerceProduct $product) + { + $removed = $this->products->removeElement($product); + if ($removed) { + $product->removeCategory($this); + } + } + + public function getProducts() + { + return $this->products; + } + + private function setParent(ECommerceCategory $parent) + { + $this->parent = $parent; + } + + public function getChildren() + { + return $this->children; + } + + public function getParent() + { + return $this->parent; + } + + public function addChild(ECommerceCategory $child) + { + $this->children[] = $child; + $child->setParent($this); + } + + /** does not set the owning side. */ + public function brokenAddChild(ECommerceCategory $child) + { + $this->children[] = $child; + } + + + public function removeChild(ECommerceCategory $child) + { + $removed = $this->children->removeElement($child); + if ($removed) { + $child->removeParent(); + } + } + + private function removeParent() + { + $this->parent = null; + } +}