You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.4KB

  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. if ($reductionCart = $this->orderUtils->getReductionCartByCode($code)) {
  17. $this->addFlash('success', "Le code " . $code . " est déjà utilisé dans la réduction #" . $reductionCart->getId() . " " . $reductionCart->getTitle());
  18. $displayError = true;
  19. }
  20. }
  21. if ($displayError == false) parent::updateEntity($entity);
  22. }
  23. /* public function persistProductFamilyEntity($entity, $newForm)
  24. {
  25. $entity = $this->productFamilyUtils->processBeforePersistProductFamily($entity, $newForm);
  26. $this->em->persist($entity);
  27. $this->em->flush();
  28. }*/
  29. }