diff options
Diffstat (limited to 'src/Wallabag/UserBundle/Entity')
-rw-r--r-- | src/Wallabag/UserBundle/Entity/User.php | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php index 3a167de7..1ff3046a 100644 --- a/src/Wallabag/UserBundle/Entity/User.php +++ b/src/Wallabag/UserBundle/Entity/User.php | |||
@@ -4,11 +4,11 @@ namespace Wallabag\UserBundle\Entity; | |||
4 | 4 | ||
5 | use Doctrine\Common\Collections\ArrayCollection; | 5 | use Doctrine\Common\Collections\ArrayCollection; |
6 | use Doctrine\ORM\Mapping as ORM; | 6 | use Doctrine\ORM\Mapping as ORM; |
7 | use JMS\Serializer\Annotation\Groups; | ||
8 | use JMS\Serializer\Annotation\XmlRoot; | ||
7 | use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; | 9 | use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; |
8 | use Scheb\TwoFactorBundle\Model\TrustedComputerInterface; | 10 | use Scheb\TwoFactorBundle\Model\TrustedComputerInterface; |
9 | use FOS\UserBundle\Model\User as BaseUser; | 11 | use FOS\UserBundle\Model\User as BaseUser; |
10 | use JMS\Serializer\Annotation\ExclusionPolicy; | ||
11 | use JMS\Serializer\Annotation\Expose; | ||
12 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; | 12 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
13 | use Symfony\Component\Security\Core\User\UserInterface; | 13 | use Symfony\Component\Security\Core\User\UserInterface; |
14 | use Wallabag\ApiBundle\Entity\Client; | 14 | use Wallabag\ApiBundle\Entity\Client; |
@@ -18,23 +18,25 @@ use Wallabag\CoreBundle\Entity\Entry; | |||
18 | /** | 18 | /** |
19 | * User. | 19 | * User. |
20 | * | 20 | * |
21 | * @XmlRoot("user") | ||
21 | * @ORM\Entity(repositoryClass="Wallabag\UserBundle\Repository\UserRepository") | 22 | * @ORM\Entity(repositoryClass="Wallabag\UserBundle\Repository\UserRepository") |
22 | * @ORM\Table(name="`user`") | 23 | * @ORM\Table(name="`user`") |
23 | * @ORM\HasLifecycleCallbacks() | 24 | * @ORM\HasLifecycleCallbacks() |
24 | * @ExclusionPolicy("all") | ||
25 | * | 25 | * |
26 | * @UniqueEntity("email") | 26 | * @UniqueEntity("email") |
27 | * @UniqueEntity("username") | 27 | * @UniqueEntity("username") |
28 | */ | 28 | */ |
29 | class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface | 29 | class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface |
30 | { | 30 | { |
31 | /** @Serializer\XmlAttribute */ | ||
31 | /** | 32 | /** |
32 | * @var int | 33 | * @var int |
33 | * | 34 | * |
34 | * @Expose | ||
35 | * @ORM\Column(name="id", type="integer") | 35 | * @ORM\Column(name="id", type="integer") |
36 | * @ORM\Id | 36 | * @ORM\Id |
37 | * @ORM\GeneratedValue(strategy="AUTO") | 37 | * @ORM\GeneratedValue(strategy="AUTO") |
38 | * | ||
39 | * @Groups({"user_api"}) | ||
38 | */ | 40 | */ |
39 | protected $id; | 41 | protected $id; |
40 | 42 | ||
@@ -42,13 +44,31 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf | |||
42 | * @var string | 44 | * @var string |
43 | * | 45 | * |
44 | * @ORM\Column(name="name", type="text", nullable=true) | 46 | * @ORM\Column(name="name", type="text", nullable=true) |
47 | * | ||
48 | * @Groups({"user_api"}) | ||
45 | */ | 49 | */ |
46 | protected $name; | 50 | protected $name; |
47 | 51 | ||
48 | /** | 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 | /** | ||
49 | * @var date | 67 | * @var date |
50 | * | 68 | * |
51 | * @ORM\Column(name="created_at", type="datetime") | 69 | * @ORM\Column(name="created_at", type="datetime") |
70 | * | ||
71 | * @Groups({"user_api"}) | ||
52 | */ | 72 | */ |
53 | protected $createdAt; | 73 | protected $createdAt; |
54 | 74 | ||
@@ -56,6 +76,8 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf | |||
56 | * @var date | 76 | * @var date |
57 | * | 77 | * |
58 | * @ORM\Column(name="updated_at", type="datetime") | 78 | * @ORM\Column(name="updated_at", type="datetime") |
79 | * | ||
80 | * @Groups({"user_api"}) | ||
59 | */ | 81 | */ |
60 | protected $updatedAt; | 82 | protected $updatedAt; |
61 | 83 | ||