]> Raphaƫl G. Git Repositories - userbundle/blobdiff - Repository/UserRepository.php
Add getVersion member function
[userbundle] / Repository / UserRepository.php
index d75e229959d12b4ccacb903f73d8c574839ba40e..db4d84e5cdff0e32df9b54f17ff0203f979b5539 100644 (file)
@@ -13,11 +13,15 @@ namespace Rapsys\UserBundle\Repository;
 
 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;
+
+use Rapsys\UserBundle\Repository;
 
 /**
  * UserRepository
  */
-class UserRepository extends EntityRepository {
+class UserRepository extends Repository implements PasswordUpgraderInterface {
        /**
         * Find user count as int
         *
@@ -142,4 +146,15 @@ SQL;
                //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();
+       }
 }