選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

TicketAdminController.php 1.6KB

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