Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

42 linhas
1.4KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Controller\Config;
  3. use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
  4. use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
  5. use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
  6. use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
  7. use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
  8. use Lc\CaracoleBundle\Container\Config\UnitContainer;
  9. use Lc\CaracoleBundle\Controller\AdminControllerTrait;
  10. use Lc\CaracoleBundle\Factory\Config\UnitFactory;
  11. use Lc\SovBundle\Controller\AbstractAdminController;
  12. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  13. abstract class UnitAdminController extends AbstractAdminController
  14. {
  15. use AdminControllerTrait;
  16. public function getRepositoryQuery() :RepositoryQueryInterface
  17. {
  18. return $this->get(UnitContainer::class)->getRepositoryQuery();
  19. }
  20. public function configureFields(string $pageName): iterable
  21. {
  22. return [
  23. TextField::new('unit'),
  24. TextField::new('wording'),
  25. TextField::new('wordingUnit'),
  26. TextField::new('wordingShort'),
  27. IntegerField::new('coefficient'),
  28. AssociationField::new('unitReference')
  29. ->setCustomOption('filter', false),
  30. ];
  31. }
  32. public function createEntity(string $entityFqcn)
  33. {
  34. return $this->get(UnitContainer::class)->getFactory()->create();
  35. }
  36. }