Browse Source

Gestion des utilisateurs

reduction
Guillaume 4 years ago
parent
commit
f90f6e1ba7
2 changed files with 31 additions and 1 deletions
  1. +4
    -1
      ShopBundle/Controller/Admin/AdminController.php
  2. +27
    -0
      ShopBundle/Controller/Admin/UserController.php

+ 4
- 1
ShopBundle/Controller/Admin/AdminController.php View File

@@ -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 View File

@@ -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);
}
}

Loading…
Cancel
Save