Преглед на файлове

Gestion des utilisateurs

reduction
Guillaume преди 4 години
родител
ревизия
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);
}
}

Loading…
Отказ
Запис