aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/UserBundle/Entity
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2017-05-30 07:56:01 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2017-05-30 07:56:01 +0200
commit5709ecb36809fb009446a11a758232bbe8f264e4 (patch)
tree0880f40fe8e6e563ef5648c267bb1f65251a0355 /src/Wallabag/UserBundle/Entity
parent2251045901875aa815dee43ec467fb1af8d416d0 (diff)
downloadwallabag-5709ecb36809fb009446a11a758232bbe8f264e4.tar.gz
wallabag-5709ecb36809fb009446a11a758232bbe8f264e4.tar.zst
wallabag-5709ecb36809fb009446a11a758232bbe8f264e4.zip
Re-use `NewUserType` to validate registration
The only ugly things is how we handle error by generating the view and then parse the content to retrieve all errors… Fix exposition fields in User entity
Diffstat (limited to 'src/Wallabag/UserBundle/Entity')
-rw-r--r--src/Wallabag/UserBundle/Entity/User.php25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php
index 1863c966..1ff3046a 100644
--- a/src/Wallabag/UserBundle/Entity/User.php
+++ b/src/Wallabag/UserBundle/Entity/User.php
@@ -5,11 +5,10 @@ namespace Wallabag\UserBundle\Entity;
5use Doctrine\Common\Collections\ArrayCollection; 5use Doctrine\Common\Collections\ArrayCollection;
6use Doctrine\ORM\Mapping as ORM; 6use Doctrine\ORM\Mapping as ORM;
7use JMS\Serializer\Annotation\Groups; 7use JMS\Serializer\Annotation\Groups;
8use JMS\Serializer\Annotation\XmlRoot;
8use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; 9use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface;
9use Scheb\TwoFactorBundle\Model\TrustedComputerInterface; 10use Scheb\TwoFactorBundle\Model\TrustedComputerInterface;
10use FOS\UserBundle\Model\User as BaseUser; 11use FOS\UserBundle\Model\User as BaseUser;
11use JMS\Serializer\Annotation\ExclusionPolicy;
12use JMS\Serializer\Annotation\Expose;
13use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; 12use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
14use Symfony\Component\Security\Core\User\UserInterface; 13use Symfony\Component\Security\Core\User\UserInterface;
15use Wallabag\ApiBundle\Entity\Client; 14use Wallabag\ApiBundle\Entity\Client;
@@ -19,23 +18,24 @@ use Wallabag\CoreBundle\Entity\Entry;
19/** 18/**
20 * User. 19 * User.
21 * 20 *
21 * @XmlRoot("user")
22 * @ORM\Entity(repositoryClass="Wallabag\UserBundle\Repository\UserRepository") 22 * @ORM\Entity(repositoryClass="Wallabag\UserBundle\Repository\UserRepository")
23 * @ORM\Table(name="`user`") 23 * @ORM\Table(name="`user`")
24 * @ORM\HasLifecycleCallbacks() 24 * @ORM\HasLifecycleCallbacks()
25 * @ExclusionPolicy("all")
26 * 25 *
27 * @UniqueEntity("email") 26 * @UniqueEntity("email")
28 * @UniqueEntity("username") 27 * @UniqueEntity("username")
29 */ 28 */
30class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface 29class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface
31{ 30{
31 /** @Serializer\XmlAttribute */
32 /** 32 /**
33 * @var int 33 * @var int
34 * 34 *
35 * @Expose
36 * @ORM\Column(name="id", type="integer") 35 * @ORM\Column(name="id", type="integer")
37 * @ORM\Id 36 * @ORM\Id
38 * @ORM\GeneratedValue(strategy="AUTO") 37 * @ORM\GeneratedValue(strategy="AUTO")
38 *
39 * @Groups({"user_api"}) 39 * @Groups({"user_api"})
40 */ 40 */
41 protected $id; 41 protected $id;
@@ -44,14 +44,30 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
44 * @var string 44 * @var string
45 * 45 *
46 * @ORM\Column(name="name", type="text", nullable=true) 46 * @ORM\Column(name="name", type="text", nullable=true)
47 *
47 * @Groups({"user_api"}) 48 * @Groups({"user_api"})
48 */ 49 */
49 protected $name; 50 protected $name;
50 51
51 /** 52 /**
53 * @var string
54 *
55 * @Groups({"user_api"})
56 */
57 protected $username;
58
59 /**
60 * @var string
61 *
62 * @Groups({"user_api"})
63 */
64 protected $email;
65
66 /**
52 * @var date 67 * @var date
53 * 68 *
54 * @ORM\Column(name="created_at", type="datetime") 69 * @ORM\Column(name="created_at", type="datetime")
70 *
55 * @Groups({"user_api"}) 71 * @Groups({"user_api"})
56 */ 72 */
57 protected $createdAt; 73 protected $createdAt;
@@ -60,6 +76,7 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
60 * @var date 76 * @var date
61 * 77 *
62 * @ORM\Column(name="updated_at", type="datetime") 78 * @ORM\Column(name="updated_at", type="datetime")
79 *
63 * @Groups({"user_api"}) 80 * @Groups({"user_api"})
64 */ 81 */
65 protected $updatedAt; 82 protected $updatedAt;