Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

41 linhas
1.5KB

  1. <?php
  2. namespace Lc\ShopBundle\Controller\Backend;
  3. use Doctrine\ORM\EntityManagerInterface;
  4. use FOS\UserBundle\Model\UserManagerInterface;
  5. use Lc\ShopBundle\Services\UtilsManager;
  6. use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
  7. use Symfony\Component\Security\Core\Security;
  8. use Symfony\Contracts\Translation\TranslatorInterface;
  9. use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
  10. class ReductionCartController extends AdminController
  11. {
  12. public function updateReductionCartEntity($entity, $editForm = false)
  13. {
  14. $displayError =false;
  15. foreach ($entity->getCodes() as $code) {
  16. $reductionCart = $this->orderUtils->getReductionCartByCode($code);
  17. if ($reductionCart && $reductionCart->getId() != $entity->getId()) {
  18. $this->addFlash('error', "Le code " . $code . " est déjà utilisé dans la réduction #" . $reductionCart->getId() . " " . $reductionCart->getTitle());
  19. $displayError = true;
  20. }
  21. }
  22. if ($displayError == false) parent::updateEntity($entity);
  23. }
  24. /* public function persistProductFamilyEntity($entity, $newForm)
  25. {
  26. $entity = $this->productFamilyUtils->processBeforePersistProductFamily($entity, $newForm);
  27. $this->em->persist($entity);
  28. $this->em->flush();
  29. }*/
  30. }