]> Raphaƫl G. Git Repositories - userbundle/blobdiff - Repository/UserRepository.php
Cleanup flash messages
[userbundle] / Repository / UserRepository.php
index d75e229959d12b4ccacb903f73d8c574839ba40e..da5952fa5a05bba066c634e3740f5ddc10e7c072 100644 (file)
@@ -13,11 +13,13 @@ namespace Rapsys\UserBundle\Repository;
 
 use Doctrine\ORM\Query\ResultSetMapping;
 use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
 
 use Doctrine\ORM\Query\ResultSetMapping;
 use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
+use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
+use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
 
 /**
  * UserRepository
  */
 
 /**
  * UserRepository
  */
-class UserRepository extends EntityRepository {
+class UserRepository extends EntityRepository implements PasswordUpgraderInterface {
        /**
         * Find user count as int
         *
        /**
         * Find user count as int
         *
@@ -142,4 +144,15 @@ SQL;
                //Send result
                return $ret;
        }
                //Send result
                return $ret;
        }
+
+       /**
+        * {@inheritdoc}
+        */
+       public function upgradePassword(PasswordAuthenticatedUserInterface $user, string $hash): void {
+               //Set new hashed password
+               $user->setPassword($hash);
+
+               //Flush data to database
+               $this->getEntityManager()->flush();
+       }
 }
 }