removeProductImage() public method

Remove ProductImage
public removeProductImage ( Eccube\Entity\ProductImage $productImage )
$productImage Eccube\Entity\ProductImage
Esempio n. 1
0
 /**
  * 商品画像の削除、登録
  */
 protected function createProductImage($row, Product $Product)
 {
     if ($row['商品画像'] != '') {
         // 画像の削除
         $ProductImages = $Product->getProductImage();
         foreach ($ProductImages as $ProductImage) {
             $Product->removeProductImage($ProductImage);
             $this->em->remove($ProductImage);
         }
         // 画像の登録
         $images = explode(',', $row['商品画像']);
         $rank = 1;
         foreach ($images as $image) {
             $ProductImage = new ProductImage();
             $ProductImage->setFileName(Str::trimAll($image));
             $ProductImage->setProduct($Product);
             $ProductImage->setRank($rank);
             $Product->addProductImage($ProductImage);
             $rank++;
             $this->em->persist($ProductImage);
         }
     }
 }
 /**
  * {@inheritDoc}
  */
 public function removeProductImage(\Eccube\Entity\ProductImage $productImage)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'removeProductImage', array($productImage));
     return parent::removeProductImage($productImage);
 }