From c0d9eba07f40a52bdfcfca3e7a926163b17d83ab Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 17 Feb 2015 22:45:20 +0100 Subject: Updating logged in user (email, name, etc ..) --- src/Wallabag/CoreBundle/Entity/User.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src/Wallabag/CoreBundle/Entity/User.php') diff --git a/src/Wallabag/CoreBundle/Entity/User.php b/src/Wallabag/CoreBundle/Entity/User.php index c83250c3..193dfebc 100644 --- a/src/Wallabag/CoreBundle/Entity/User.php +++ b/src/Wallabag/CoreBundle/Entity/User.php @@ -6,6 +6,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\Component\Security\Core\User\AdvancedUserInterface; +use Symfony\Component\Validator\Constraints as Assert; /** * User @@ -29,6 +30,11 @@ class User implements AdvancedUserInterface, \Serializable * @var string * * @ORM\Column(name="username", type="text") + * @Assert\NotBlank() + * @Assert\Length( + * min = "3", + * max = "255" + * ) */ private $username; @@ -56,14 +62,16 @@ class User implements AdvancedUserInterface, \Serializable /** * @var string * - * @ORM\Column(name="email", type="text", nullable=true) + * @ORM\Column(name="email", type="text", nullable=false) + * @Assert\Email() + * @Assert\NotBlank() */ private $email; /** - * @ORM\Column(name="is_active", type="boolean") + * @ORM\Column(name="is_active", type="boolean", nullable=false) */ - private $isActive; + private $isActive = true; /** * @var date @@ -86,9 +94,8 @@ class User implements AdvancedUserInterface, \Serializable public function __construct() { - $this->isActive = true; - $this->salt = md5(uniqid(null, true)); - $this->entries = new ArrayCollection(); + $this->salt = md5(uniqid(null, true)); + $this->entries = new ArrayCollection(); } /** -- cgit v1.2.3