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.

ReductionCartController.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. }