Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

51 line
1.6KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Definition\Field\Ticket;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
  4. use Lc\CaracoleBundle\Definition\Field\FieldDefinitionTrait;
  5. use Lc\CaracoleBundle\Repository\Section\SectionStore;
  6. use Lc\CaracoleBundle\Solver\Ticket\TicketSolver;
  7. use Lc\SovBundle\Definition\Field\Ticket\TicketFieldDefinition as SovTicketFieldDefinition;
  8. use Lc\SovBundle\Translation\TranslatorAdmin;
  9. class TicketFieldDefinition extends SovTicketFieldDefinition
  10. {
  11. use FieldDefinitionTrait;
  12. protected SectionStore $sectionStore;
  13. public function __construct(
  14. TranslatorAdmin $translatorAdmin,
  15. TicketSolver $ticketSolver,
  16. SectionStore $sectionStore
  17. ) {
  18. parent::__construct($translatorAdmin, $ticketSolver);
  19. $this->sectionStore = $sectionStore;
  20. }
  21. public function configureFields(): array
  22. {
  23. return array_merge(parent::configureFields(), [
  24. 'type' => ChoiceField::new('type')
  25. ->autocomplete()
  26. ->setChoices(
  27. $this->translatorAdmin->transChoices(
  28. TicketSolver::getTypeChoices(),
  29. 'Ticket',
  30. 'type'
  31. )
  32. ),
  33. ]);
  34. }
  35. public function configureIndex(): array
  36. {
  37. return $this->addSectionToFieldArrayIfOutOfSection($this->section, parent::configureIndex());
  38. }
  39. public function configureForm(): array
  40. {
  41. return array_merge(['section'], parent::configureForm());
  42. }
  43. }