Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

41 lines
1.2KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Config;
  3. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  6. use Lc\CaracoleBundle\Container\Config\TaxRateContainer;
  7. use Lc\CaracoleBundle\Controller\AdminControllerTrait;
  8. use Lc\CaracoleBundle\Factory\Config\TaxRateFactory;
  9. use Lc\SovBundle\Controller\AbstractAdminController;
  10. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  11. abstract class TaxRateAdminController extends AbstractAdminController
  12. {
  13. use AdminControllerTrait;
  14. public function getRepositoryQuery() :RepositoryQueryInterface
  15. {
  16. return $this->get(TaxRateContainer::class)->getRepositoryQuery();
  17. }
  18. public function configureFields(string $pageName): iterable
  19. {
  20. return [
  21. TextField::new('title'),
  22. NumberField::new('value')
  23. ];
  24. }
  25. public function configureCrud(Crud $crud): Crud
  26. {
  27. return $crud->setSearchFields(['id', 'title', 'value']);
  28. }
  29. public function createEntity(string $entityFqcn)
  30. {
  31. return $this->get(TaxRateContainer::class)->getFactory()->create();
  32. }
  33. }