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ů.

54 lines
1.8KB

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