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
*
'pseudonym' => $data['pseudonym'],
'groups' => [],
'slug' => $this->slugger->slug($data['pseudonym']),
- 'link' => $this->router->generate('rapsys_user_edit', ['mail' => $short = $this->slugger->short($data['mail']), 'hash' => $this->slugger->hash($short)])
+ 'link' => $this->router->generate('rapsysuser_edit', ['mail' => $short = $this->slugger->short($data['mail']), 'hash' => $this->slugger->hash($short)])
];
//With groups
$ret[$data['id']]['groups'][$id] = [
'title' => $group = $this->translator->trans($titles[$k]),
#'slug' => $this->slugger->slug($group)
- #'link' => $this->router->generate('rapsys_user_group_view', ['id' => $id, 'slug' => $this->slugger->short($group)])
+ #'link' => $this->router->generate('rapsysuser_group_view', ['id' => $id, 'slug' => $this->slugger->short($group)])
];
}
}
//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();
+ }
}