Просмотр исходного кода

Gestion des utilisateurs

reduction
Guillaume 4 лет назад
Родитель
Сommit
f90f6e1ba7
2 измененных файлов: 31 добавлений и 1 удалений
  1. +4
    -1
      ShopBundle/Controller/Admin/AdminController.php
  2. +27
    -0
      ShopBundle/Controller/Admin/UserController.php

+ 4
- 1
ShopBundle/Controller/Admin/AdminController.php Просмотреть файл

@@ -4,16 +4,19 @@ namespace Lc\ShopBundle\Controller\Admin;

use EasyCorp\Bundle\EasyAdminBundle\Controller\EasyAdminController;
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use FOS\UserBundle\Model\UserManagerInterface;
use Lc\ShopBundle\Context\MerchantInterface;
use Symfony\Component\Security\Core\Security;

class AdminController extends EasyAdminController
{
protected $security;
protected $userManager;

public function __construct(Security $security)
public function __construct(Security $security, UserManagerInterface $userManager)
{
$this->security = $security;
$this->userManager = $userManager ;
}

protected function createListQueryBuilder($entityClass, $sortDirection, $sortField = null, $dqlFilter = null)

+ 27
- 0
ShopBundle/Controller/Admin/UserController.php Просмотреть файл

@@ -0,0 +1,27 @@
<?php

namespace Lc\ShopBundle\Controller\Admin;

use FOS\UserBundle\Doctrine\UserManager;
use FOS\UserBundle\Model\UserManagerInterface ;

class UserController extends AdminController
{

public function createNewEntity()
{
return $this->userManager->createUser();
}

public function persistEntity($user)
{
$this->userManager->updateUser($user, false);
parent::persistEntity($user);
}

public function updateEntity($user)
{
$this->userManager->updateUser($user, false);
parent::updateEntity($user);
}
}

Загрузка…
Отмена
Сохранить