Selaa lähdekoodia

[Backofiice] Bon de commande : envoie du bon avec email en copie caché

feature/export_comptable
Fab 4 vuotta sitten
vanhempi
commit
fd48308bcc
1 muutettua tiedostoa jossa 0 lisäystä ja 46 poistoa
  1. +0
    -46
      ShopBundle/Form/DataTransformer/StreetNumberTransformer.php

+ 0
- 46
ShopBundle/Form/DataTransformer/StreetNumberTransformer.php Näytä tiedosto

@@ -1,46 +0,0 @@
<?php

namespace Lc\ShopBundle\Form\DataTransformer;

use Lc\ShopBundle\Context\ProductInterface;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;

class ProductToIdTransformer implements DataTransformerInterface
{
private $em ;

public function __construct(EntityManagerInterface $em)
{
$this->em = $em;
}

public function transform($product)
{

if (null === $product) {
return '';
}

return $product->getId();
}

public function reverseTransform($productId)
{
if (!$productId) {
return;
}

$product = $this->em->getRepository($this->em->getClassMetadata(ProductInterface::class)->getName())->find($productId);

if (null === $product) {
throw new TransformationFailedException(sprintf(
'An issue with number "%s" does not exist!',
$productId
));
}

return $product;
}
}

Loading…
Peruuta
Tallenna