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

MerchantAdminController.php 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. }