|
- <?php
-
- namespace Lc\CaracoleBundle\Controller\User;
-
-
- use EasyCorp\Bundle\EasyAdminBundle\Collection\EntityCollection;
- use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
- use Lc\CaracoleBundle\Controller\ControllerTrait;
- use Lc\SovBundle\Container\User\UserContainer;
- use Lc\SovBundle\Controller\User\UserAdminController as SovUserAdminController;
- use Lc\SovBundle\Definition\ActionDefinition;
- use Lc\SovBundle\Repository\RepositoryQueryInterface;
-
- abstract class UserAdminController extends SovUserAdminController
- {
- use ControllerTrait;
-
- public function getRepositoryQuery(): RepositoryQueryInterface
- {
- return $this->getUserContainer()->getRepositoryQuery();
- }
-
- public function createEntity(string $entityFqcn)
- {
- return $this->getUserContainer()->getFactory()->create();
- }
-
- public function overrideEntitiesActions(?EntityCollection $entities): void
- {
- foreach ($entities as $entity) {
- foreach ($entity->getActions() as $action){
- if($action->getName() == ActionDefinition::SWITCH_USER){
- $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->getSlug()));
- $action->setLinkUrl($url);
- }
- }
-
- }
- }
-
-
-
-
- }
|