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.5KB

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