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.

UnitAdminController.php 1.4KB

3 jaren geleden
3 jaren geleden
3 jaren geleden
3 jaren geleden
1234567891011121314151617181920212223242526272829303132333435363738394041
  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. }