- <?php
-
- namespace Lc\CaracoleBundle\Controller\Product;
-
- use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
- use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
- use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
- use Lc\CaracoleBundle\Controller\AbstractAdminController;
- use Lc\CaracoleBundle\Definition\ActionDefinition;
- use Lc\SovBundle\Field\CKEditorField;
- use Lc\SovBundle\Field\StatusField;
- use Lc\SovBundle\Field\ToggleField;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- abstract class ProductCategoryAdminController extends AbstractAdminController
- {
- public function getRepositoryQuery() :RepositoryQueryInterface
- {
- return $this->getProductCategoryContainer()->getRepositoryQuery();
- }
-
- public function createEntity(string $entityFqcn)
- {
- return $this->getProductCategoryContainer()->getFactory()->create($this->getSectionCurrent());
- }
-
- public function configureFields(string $pageName): iterable
- {
- return $this->getProductCategoryContainer()->getFieldDefinition()
- ->setMerchant($this->getMerchantCurrent())
- ->setSection($this->getSectionCurrent())
- ->getFields($pageName);
- }
-
- public function configureActions(Actions $actions): Actions
- {
- $actions = parent::configureActions($actions);
-
- if(!$this->getSectionCurrent()) {
- $actions->disable(ActionDefinition::NEW);
- }
-
- return $actions;
- }
- }
|