|
|
@@ -9,6 +9,7 @@ namespace Lc\CaracoleBundle\Resolver; |
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
|
|
use Lc\CaracoleBundle\Model\Section\SectionInterface; |
|
|
|
use Lc\CaracoleBundle\Repository\Section\SectionRepository; |
|
|
|
use Lc\SovBundle\Doctrine\EntityManager; |
|
|
|
use Lc\SovBundle\Resolver\UrlResolver; |
|
|
|
use Symfony\Component\HttpFoundation\RequestStack; |
|
|
|
use Symfony\Component\Security\Core\Security; |
|
|
@@ -18,9 +19,9 @@ class SectionResolver |
|
|
|
protected $sectionRepository; |
|
|
|
protected $merchantResolver; |
|
|
|
|
|
|
|
public function __construct(MerchantResolver $merchantResolver, SectionRepository $sectionRepository) |
|
|
|
public function __construct(MerchantResolver $merchantResolver, EntityManagerInterface $em) |
|
|
|
{ |
|
|
|
$this->sectionRepository = $sectionRepository; |
|
|
|
$this->em = $em; |
|
|
|
$this->merchantResolver = $merchantResolver; |
|
|
|
} |
|
|
|
|
|
|
@@ -29,13 +30,16 @@ class SectionResolver |
|
|
|
$currentAdminSection = null; |
|
|
|
$userMerchant = $this->merchantResolver->getUserMerchant(); |
|
|
|
|
|
|
|
if($userMerchant!==null){ |
|
|
|
if ($userMerchant !== null) { |
|
|
|
$currentAdminSection = $userMerchant->getCurrentAdminSection(); |
|
|
|
} |
|
|
|
|
|
|
|
if($currentAdminSection === null){ |
|
|
|
$currentAdminSection = $this->sectionRepository->findOneBy(array('isDefault'=>true)); |
|
|
|
if ($currentAdminSection === null) { |
|
|
|
$currentAdminSection = $this->em->getRepository(SectionInterface::class)->findOneBy( |
|
|
|
array('isDefault' => true) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
return $currentAdminSection; |
|
|
|
} |
|
|
|
|