Procházet zdrojové kódy

Déplacement GroupUser Caracole -> Sov

feature/ticket
Fab před 3 roky
rodič
revize
d897b97325
6 změnil soubory, kde provedl 55 přidání a 34 odebrání
  1. +3
    -2
      Controller/User/AccountAdminController.php
  2. +13
    -8
      Controller/User/GroupUserAdminController.php
  3. +1
    -1
      Model/User/GroupUserInterface.php
  4. +3
    -22
      Model/User/GroupUserModel.php
  5. +34
    -0
      Model/User/User.php
  6. +1
    -1
      Repository/User/GroupUserRepository.php

+ 3
- 2
Controller/User/AccountAdminController.php Zobrazit soubor

@@ -12,6 +12,7 @@ use Lc\SovBundle\Model\User\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Translation\TranslatableMessage;

@@ -48,7 +49,7 @@ class AccountAdminController extends AbstractController
);
}

public function changePassword(Request $request, UserPasswordEncoderInterface $passwordEncoder): Response
public function changePassword(Request $request, UserPasswordHasherInterface $passwordEncoder): Response
{
$user = $this->getUser();
$form = $this->createForm(ChangePasswordFormType::class, $user);
@@ -60,7 +61,7 @@ class AccountAdminController extends AbstractController

$plainPassword = $form->get('plain_password')->getData();

$user->setPassword($passwordEncoder->encodePassword($user, $plainPassword));
$user->setPassword($passwordEncoder->hashPassword($user, $plainPassword));

$this->em->update($user);
$this->em->flush();

+ 13
- 8
Controller/User/GroupUserAdminController.php Zobrazit soubor

@@ -1,14 +1,19 @@
<?php

namespace App\Controller\User;
namespace Lc\SovBundle\Controller\User;

use App\Entity\User\GroupUser;
use Lc\CaracoleBundle\Controller\User\GroupUserAdminController as CaracAbstractUserAdminController;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\AbstractAdminController;

class GroupUserAdminController extends CaracAbstractUserAdminController
abstract class GroupUserAdminController extends AbstractAdminController
{
public static function getEntityFqcn(): string
{
return GroupUser::class;
}

public function configureFields(string $pageName): iterable
{
return [
TextField::new('title'),
TextField::new('devAlias'),
];

}
}

+ 1
- 1
Model/User/GroupUserInterface.php Zobrazit soubor

@@ -1,6 +1,6 @@
<?php

namespace Lc\CaracoleBundle\Model\User;
namespace Lc\SovBundle\Model\User;

interface GroupUserInterface
{

+ 3
- 22
Model/User/GroupUserModel.php Zobrazit soubor

@@ -1,15 +1,13 @@
<?php

namespace Lc\CaracoleBundle\Model\User;
namespace Lc\SovBundle\Model\User;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity;
use Lc\SovBundle\Model\User\UserInterface;



/**
@@ -23,12 +21,6 @@ abstract class GroupUserModel extends AbstractLightEntity implements FilterMerch
*/
protected $title;

/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="groupUsers")
* @ORM\JoinColumn(nullable=false)
*/
protected $merchant;

/**
* @ORM\ManyToMany(targetEntity="Lc\SovBundle\Model\User\UserInterface", mappedBy="groupUsers")
*/
@@ -58,19 +50,8 @@ abstract class GroupUserModel extends AbstractLightEntity implements FilterMerch
return $this;
}

public function getMerchant(): ?MerchantInterface
{
return $this->merchant;
}

public function setMerchant(?MerchantInterface $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function addUser(UserModel $user): self
public function addUser(UserInterface $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;

+ 34
- 0
Model/User/User.php Zobrazit soubor

@@ -2,6 +2,7 @@

namespace Lc\SovBundle\Model\User;

use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\EntityInterface;
use Symfony\Component\Security\Core\User\UserInterface;
@@ -42,6 +43,10 @@ abstract class User implements EntityInterface, UserInterface
*/
protected $isVerified = false;

/**
* @ORM\ManyToMany(targetEntity="Lc\SovBundle\Model\User\GroupUserInterface", inversedBy="users")
*/
protected $groupUsers;

public function getEmail(): ?string
{
@@ -175,4 +180,33 @@ abstract class User implements EntityInterface, UserInterface

return $this;
}

/**
* @return Collection|GroupUserInterface[]
*/
public function getGroupUsers(): Collection
{
return $this->groupUsers;
}

public function addGroupUser(GroupUserInterface $groupUser): self
{
if (!$this->groupUsers->contains($groupUser)) {
$this->groupUsers[] = $groupUser;
$groupUser->addUser($this);
}

return $this;
}

public function removeGroupUser(GroupUserInterface $groupUser): self
{
if ($this->groupUsers->contains($groupUser)) {
$this->groupUsers->removeElement($groupUser);
$groupUser->removeUser($this);
}

return $this;
}

}

+ 1
- 1
Repository/User/GroupUserRepository.php Zobrazit soubor

@@ -1,6 +1,6 @@
<?php

namespace Lc\CaracoleBundle\Repository\User;
namespace Lc\SovBundle\Repository\User;

use Lc\SovBundle\Model\User\GroupUserInterface;
use Lc\SovBundle\Repository\AbstractRepository;

Načítá se…
Zrušit
Uložit