Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

41 lines
1.2KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Ticket;
  3. use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
  4. use Lc\CaracoleBundle\Controller\AdminControllerTrait;
  5. use Lc\CaracoleBundle\Definition\ActionDefinition;
  6. use Lc\SovBundle\Controller\Ticket\TicketAdminController as SovTicketAdminController;
  7. abstract class TicketAdminController extends SovTicketAdminController
  8. {
  9. use AdminControllerTrait;
  10. public function createEntity(string $entityFqcn)
  11. {
  12. return $this->getTicketContainer()
  13. ->getFactory()
  14. ->setSection($this->getSectionCurrent())
  15. ->create();
  16. }
  17. public function configureFields(string $pageName): iterable
  18. {
  19. return $this->getTicketContainer()->getFieldDefinition()
  20. ->setMerchant($this->getMerchantCurrent())
  21. ->setSection($this->getSectionCurrent())
  22. ->getFields($pageName);
  23. }
  24. public function configureActions(Actions $actions): Actions
  25. {
  26. $actions = parent::configureActions($actions);
  27. if(!$this->getSectionCurrent()) {
  28. $actions->disable(ActionDefinition::NEW);
  29. }
  30. return $actions;
  31. }
  32. }