Kaynağa Gözat

EntityComponent : adaptation duplicate ProductFamily

develop
Guillaume 11 ay önce
ebeveyn
işleme
cecb72f9bc
1 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  1. +3
    -1
      Component/EntityComponent.php

+ 3
- 1
Component/EntityComponent.php Dosyayı Görüntüle

namespace Lc\SovBundle\Component; namespace Lc\SovBundle\Component;


use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\SovBundle\Doctrine\Extension\BlameableInterface; use Lc\SovBundle\Doctrine\Extension\BlameableInterface;
use Lc\SovBundle\Doctrine\Extension\DevAliasInterface; use Lc\SovBundle\Doctrine\Extension\DevAliasInterface;
use Lc\SovBundle\Doctrine\Extension\SeoInterface; use Lc\SovBundle\Doctrine\Extension\SeoInterface;


public function duplicateEntity($entity) public function duplicateEntity($entity)
{ {

$newEntity = clone $entity; $newEntity = clone $entity;

$classMetadata = $this->entityManager->getClassMetadata(get_class($newEntity)); $classMetadata = $this->entityManager->getClassMetadata(get_class($newEntity));


//Dupplication de l'image ou du fichier lier //Dupplication de l'image ou du fichier lier
} }


$this->eventDispatcher->dispatch(new EntityComponentEvent($newEntity), EntityComponentEvent::DUPLICATE_EVENT); $this->eventDispatcher->dispatch(new EntityComponentEvent($newEntity), EntityComponentEvent::DUPLICATE_EVENT);

//Ne pas utiliser create ici! Sinon pour certaine entité comme ProductFamily on réajoute un orginProduct //Ne pas utiliser create ici! Sinon pour certaine entité comme ProductFamily on réajoute un orginProduct
$this->entityManager->create($newEntity, false); $this->entityManager->create($newEntity, false);



Yükleniyor…
İptal
Kaydet