fileUploader + edit profile

This commit is contained in:
Olivier PARPAILLON
2024-11-20 10:53:29 +01:00
parent caa78c634b
commit 7091bd4094
10 changed files with 259 additions and 30 deletions

View File

@@ -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;
}
// /**