|
- <?php
-
- namespace Lc\CaracoleBundle\Controller\Merchant;
-
- use App\Entity\Merchant\Merchant;
- use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
- use Lc\CaracoleBundle\Container\Merchant\MerchantContainer;
- use Lc\CaracoleBundle\Controller\AdminControllerTrait;
- use Lc\CaracoleBundle\Factory\Merchant\MerchantFactory;
- use Lc\CaracoleBundle\Field\Address\AddressField;
- use Lc\SovBundle\Controller\AbstractAdminController;
- use Lc\SovBundle\Field\CKEditorField;
- use Lc\SovBundle\Field\StatusField;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- abstract class MerchantAdminController extends AbstractAdminController
- {
- use AdminControllerTrait;
-
- public function getRepositoryQuery() :RepositoryQueryInterface
- {
- return $this->get(MerchantContainer::class)->getRepositoryQuery();
- }
-
- public function configureFields(string $pageName): iterable
- {
- $panel = parent::configureFields($pageName);
-
- return array_merge(
- [
- FormField::addPanel('general'),
- TextField::new('title'),
- NumberField::new('position')
- ->hideOnForm()
- ->hideOnIndex(),
- CKEditorField::new('description')
- ->hideOnIndex(),
- AssociationField::new('taxRate')
- ->setRequired(true)
- ->hideOnIndex(),
- StatusField::new('status'),
-
- FormField::addPanel('address'),
- AddressField::new('address')
- ->setRequired(true),
- ],
- $panel
- );
- }
-
- public function createEntity(string $entityFqcn)
- {
- return $this->get(MerchantContainer::class)->getFactory()->create();
- }
-
- }
|