public function copy() { // コピー対象外 $this->CustomerFavoriteProducts = new ArrayCollection(); $Categories = $this->getProductCategories(); $this->ProductCategories = new ArrayCollection(); foreach ($Categories as $Category) { $CopyCategory = clone $Category; $this->addProductCategory($CopyCategory); $CopyCategory->setProduct($this); } $Classes = $this->getProductClasses(); $this->ProductClasses = new ArrayCollection(); foreach ($Classes as $Class) { $CopyClass = clone $Class; $this->addProductClass($CopyClass); $CopyClass->setProduct($this); } $Images = $this->getProductImage(); $this->ProductImage = new ArrayCollection(); foreach ($Images as $Image) { $CloneImage = clone $Image; $this->addProductImage($CloneImage); $CloneImage->setProduct($this); } $Tags = $this->getProductTag(); $this->ProductTag = new ArrayCollection(); foreach ($Tags as $Tag) { $CloneTag = clone $Tag; $this->addProductTag($CloneTag); $CloneTag->setProduct($this); } return $this; }
/** * {@inheritDoc} */ public function copy() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'copy', array()); return parent::copy(); }