foreach ($entity->getActions() as $action){ | foreach ($entity->getActions() as $action){ | ||||
if($action->getName() == ActionDefinition::SWITCH_USER){ | if($action->getName() == ActionDefinition::SWITCH_USER){ | ||||
$sectionDefault = $this->getSectionContainer()->getStore()->setMerchant($this->getMerchantCurrent())->getOneDefault(); | $sectionDefault = $this->getSectionContainer()->getStore()->setMerchant($this->getMerchantCurrent())->getOneDefault(); | ||||
$url = $this->generateUrl($this->getParameter('lc_sov.homepage_route'), array('_switch_user' => $entity->getInstance()->getEmail(), 'section'=> $sectionDefault)); | |||||
dump($sectionDefault); | |||||
$url = $this->generateUrl($this->getParameter('lc_sov.homepage_route'), array('_switch_user' => $entity->getInstance()->getEmail(), 'section'=> $sectionDefault->getSlug())); | |||||
$action->setLinkUrl($url); | $action->setLinkUrl($url); | ||||
} | } | ||||
} | } |
$this->leftJoin('.productFamilySectionProperties', 'productFamilySectionProperties'); | $this->leftJoin('.productFamilySectionProperties', 'productFamilySectionProperties'); | ||||
if ($addSelect) { | if ($addSelect) { | ||||
$this->addSelect('productFamilySectionProperties'); | |||||
//NB : Ici le select est en commentaire car si il est actif doctrine n'hydrate pas correectement ProductFamilySectionProperties (si filtre sur section les ProductFamilySectionProperties des autres sections ne sont pas chargé et ça peut être problématique pr la gestion des stocks) | |||||
//$this->addSelect('productFamilySectionProperties'); | |||||
} | } | ||||
} | } | ||||
return $this; | return $this; |
trait StoreTrait | trait StoreTrait | ||||
{ | { | ||||
public function resetContext(): void | |||||
public function resetContext(): self | |||||
{ | { | ||||
if(method_exists($this, 'setMerchant')) { | if(method_exists($this, 'setMerchant')) { | ||||
$this->setMerchant(null); | $this->setMerchant(null); | ||||
if(method_exists($this, 'setSection')) { | if(method_exists($this, 'setSection')) { | ||||
$this->setSection(null); | $this->setSection(null); | ||||
} | } | ||||
return $this; | |||||
} | } | ||||
} | } |