fileUploader + edit profile
This commit is contained in:
@@ -5,15 +5,32 @@ namespace App\Repository;
|
||||
use App\Entity\Participant;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<Participant>
|
||||
*/
|
||||
class ParticipantRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
private UserPasswordHasherInterface $userPasswordHasher;
|
||||
public function __construct(ManagerRegistry $registry, UserPasswordHasherInterface $userPasswordHasher)
|
||||
{
|
||||
parent::__construct($registry, Participant::class);
|
||||
$this->userPasswordHasher = $userPasswordHasher;
|
||||
}
|
||||
|
||||
public function update(Participant $profile): ?Participant
|
||||
{
|
||||
$newProfile = $this->findOneBy(['idParticipant' => $profile->getIdParticipant()]);
|
||||
$newProfile->setPrenom($profile->getPrenom());
|
||||
$newProfile->setNom($profile->getNom());
|
||||
$newProfile->setEmail($profile->getEmail());
|
||||
$newProfile->setTelephone($profile->getTelephone());
|
||||
$newProfile->setPseudo($profile->getPseudo());
|
||||
$newProfile->setFileName($profile->getFileName());
|
||||
$newProfile->setPassword($this->userPasswordHasher->hashPassword($newProfile, $profile->getPassword()));
|
||||
$this->getEntityManager()->flush();
|
||||
return $newProfile;
|
||||
}
|
||||
|
||||
// /**
|
||||
|
||||
Reference in New Issue
Block a user