You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.9KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Product;
  3. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  7. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  8. use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
  9. use Lc\CaracoleBundle\Controller\AbstractAdminController;
  10. use Lc\SovBundle\Field\CKEditorField;
  11. use Lc\SovBundle\Field\StatusField;
  12. use Lc\SovBundle\Field\ToggleField;
  13. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  14. abstract class ProductCategoryAdminController extends AbstractAdminController
  15. {
  16. public function getRepositoryQuery() :RepositoryQueryInterface
  17. {
  18. return $this->getProductCategoryContainer()->getRepositoryQuery();
  19. }
  20. public function createEntity(string $entityFqcn)
  21. {
  22. return $this->getProductCategoryContainer()->getFactory()->create($this->getSectionCurrent());
  23. }
  24. public function configureFields(string $pageName): iterable
  25. {
  26. return array_merge(
  27. [
  28. FormField::addPanel('general'),
  29. IntegerField::new('id')->onlyOnIndex()->setSortable(true),
  30. TextField::new('title')->setSortable(true),
  31. NumberField::new('position')->hideOnForm()->setSortable(true),
  32. AssociationField::new('parent')->hideOnIndex(),
  33. DateTimeField::new('createdAt')->setFormat('short')->setSortable(true),
  34. CKEditorField::new('description')->hideOnIndex(),
  35. StatusField::new('status')->setSortable(true),
  36. ToggleField::new('saleStatus')->setSortable(true),
  37. ToggleField::new('isEligibleTicketRestaurant')->setSortable(true),
  38. ],
  39. $this->getSeoPanel(),
  40. $this->getConfPanel()
  41. );
  42. }
  43. }