Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

53 lines
1.7KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Merchant;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  7. use Lc\CaracoleBundle\Controller\AdminControllerTrait;
  8. use Lc\CaracoleBundle\Factory\Merchant\MerchantFactory;
  9. use Lc\CaracoleBundle\Field\Address\AddressField;
  10. use Lc\SovBundle\Controller\AbstractAdminController;
  11. use Lc\SovBundle\Field\CKEditorField;
  12. use Lc\SovBundle\Field\StatusField;
  13. abstract class MerchantAdminController extends AbstractAdminController
  14. {
  15. use AdminControllerTrait;
  16. public function configureFields(string $pageName): iterable
  17. {
  18. $panel = parent::configureFields($pageName);
  19. return array_merge(
  20. [
  21. FormField::addPanel('general'),
  22. TextField::new('title'),
  23. NumberField::new('position')
  24. ->hideOnForm()
  25. ->hideOnIndex(),
  26. CKEditorField::new('description')
  27. ->hideOnIndex(),
  28. AssociationField::new('taxRate')
  29. ->setRequired(true)
  30. ->hideOnIndex(),
  31. StatusField::new('status'),
  32. FormField::addPanel('address'),
  33. AddressField::new('address')
  34. ->setRequired(true),
  35. ],
  36. $panel
  37. );
  38. }
  39. public function createEntity(string $entityFqcn)
  40. {
  41. $factory = new MerchantFactory();
  42. return $factory->create();
  43. }
  44. }