Browse Source

Merge tag 'hotfix_402' into develop

hotfix_402
develop
Fabien Normand 2 years ago
parent
commit
ecb2ddc4ad
1 changed files with 21 additions and 5 deletions
  1. +21
    -5
      Controller/Product/ProductFamilyAdminController.php

+ 21
- 5
Controller/Product/ProductFamilyAdminController.php View File

{ {
$crud = parent::configureCrud($crud); $crud = parent::configureCrud($crud);


if($this->getRequestCrudAction() === ActionDefinition::SORT) {
if ($this->getRequestCrudAction() === ActionDefinition::SORT) {
$crud->setDefaultSort(['position' => 'ASC']); $crud->setDefaultSort(['position' => 'ASC']);
}else{
} else {
$crud->setDefaultSort(['id' => 'DESC']); $crud->setDefaultSort(['id' => 'DESC']);
} }


return $crud; return $crud;
} }


public function getRepositoryQuery() :RepositoryQueryInterface
public function getRepositoryQuery(): RepositoryQueryInterface
{ {
return $this->get(ProductFamilyContainer::class)->getRepositoryQuery(); return $this->get(ProductFamilyContainer::class)->getRepositoryQuery();
} }
public function createEntity(string $entityFqcn) public function createEntity(string $entityFqcn)
{ {
return $this->getProductFamilyContainer() return $this->getProductFamilyContainer()
->getFactory()
->create($this->getMerchantCurrent());
->getFactory()
->create($this->getMerchantCurrent());
} }




{ {
$responseParameters = parent::configureResponseParameters($responseParameters); $responseParameters = parent::configureResponseParameters($responseParameters);


$productFamiliesDto = [];
$productFamilies = [];
if ($responseParameters->get('entities')) {
$productFamiliesDto = $responseParameters->get('entities');
} elseif ($responseParameters->get('entity')) {
$productFamiliesDto = [$responseParameters->get('entity')];
}

foreach ($productFamiliesDto as $productFamilyDto) {
$productFamilies[] = $productFamilyDto->getInstance();
}

$this->getProductFamilyContainer()->getStore()
->setSection($this->getSectionCurrentDefault())
->getWithReductions($productFamilies);

// affichage du filtre sur section // affichage du filtre sur section
$responseParameters->set('display_switch_section', true); $responseParameters->set('display_switch_section', true);



Loading…
Cancel
Save