|
@@ -5,12 +5,18 @@ namespace AppBundle\Entity;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Security\Core\User\UserInterface;
|
|
use Symfony\Component\Security\Core\User\UserInterface;
|
|
|
|
+use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
+use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
|
|
|
|
|
/**
|
|
/**
|
|
* User
|
|
* User
|
|
*
|
|
*
|
|
* @ORM\Table(name="user")
|
|
* @ORM\Table(name="user")
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
|
|
* @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
|
|
|
|
+ * @UniqueEntity(fields="username", message="Le username est déjà utilisé")
|
|
|
|
+ * @UniqueEntity(fields="mail", message="L'email est déjà utilisé")
|
|
|
|
+ * @UniqueEntity(fields="token", message="Erreur, token non unique")
|
|
|
|
+ *
|
|
*/
|
|
*/
|
|
class User implements UserInterface
|
|
class User implements UserInterface
|
|
{
|
|
{
|
|
@@ -357,6 +363,8 @@ class User implements UserInterface
|
|
public function __construct()
|
|
public function __construct()
|
|
{
|
|
{
|
|
$this->films = new \Doctrine\Common\Collections\ArrayCollection();
|
|
$this->films = new \Doctrine\Common\Collections\ArrayCollection();
|
|
|
|
+ $this->setToken();
|
|
|
|
+ $this->setLastActivity(new \DateTime('now'));
|
|
}
|
|
}
|
|
|
|
|
|
///////////////////////////////////////////////////////////////
|
|
///////////////////////////////////////////////////////////////
|