|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?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, string $pageName): 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);
- }
- }
-
- }
- }
-
-
-
-
- }
|