aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Entity
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-10-02 14:51:41 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2015-10-03 13:31:48 +0200
commit1210dae10589515d6f3824c75639342c5e1d52dd (patch)
treea26f0401a6f980f3ef96d3dc76ff3303b2943720 /src/Wallabag/CoreBundle/Entity
parent772d8c4b93adc36baefda93ec37007e4a85321de (diff)
downloadwallabag-1210dae10589515d6f3824c75639342c5e1d52dd.tar.gz
wallabag-1210dae10589515d6f3824c75639342c5e1d52dd.tar.zst
wallabag-1210dae10589515d6f3824c75639342c5e1d52dd.zip
remove old implementation for login/register/recover
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity')
-rw-r--r--src/Wallabag/CoreBundle/Entity/Config.php10
-rw-r--r--src/Wallabag/CoreBundle/Entity/Entry.php5
-rw-r--r--src/Wallabag/CoreBundle/Entity/Tag.php2
-rw-r--r--src/Wallabag/CoreBundle/Entity/User.php201
4 files changed, 9 insertions, 209 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php
index 025d94ef..ddd4f7d9 100644
--- a/src/Wallabag/CoreBundle/Entity/Config.php
+++ b/src/Wallabag/CoreBundle/Entity/Config.php
@@ -72,14 +72,14 @@ class Config
72 private $rssLimit; 72 private $rssLimit;
73 73
74 /** 74 /**
75 * @ORM\OneToOne(targetEntity="User", inversedBy="config") 75 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
76 */ 76 */
77 private $user; 77 private $user;
78 78
79 /* 79 /*
80 * @param User $user 80 * @param User $user
81 */ 81 */
82 public function __construct(User $user) 82 public function __construct(Wallabag\UserBundle\Entity\User $user)
83 { 83 {
84 $this->user = $user; 84 $this->user = $user;
85 } 85 }
@@ -169,11 +169,11 @@ class Config
169 /** 169 /**
170 * Set user. 170 * Set user.
171 * 171 *
172 * @param \Wallabag\CoreBundle\Entity\User $user 172 * @param User $user
173 * 173 *
174 * @return Config 174 * @return Config
175 */ 175 */
176 public function setUser(\Wallabag\CoreBundle\Entity\User $user = null) 176 public function setUser(User $user = null)
177 { 177 {
178 $this->user = $user; 178 $this->user = $user;
179 179
@@ -183,7 +183,7 @@ class Config
183 /** 183 /**
184 * Get user. 184 * Get user.
185 * 185 *
186 * @return \Wallabag\CoreBundle\Entity\User 186 * @return User
187 */ 187 */
188 public function getUser() 188 public function getUser()
189 { 189 {
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php
index 9e81ba12..f6206a09 100644
--- a/src/Wallabag/CoreBundle/Entity/Entry.php
+++ b/src/Wallabag/CoreBundle/Entity/Entry.php
@@ -7,6 +7,7 @@ use Doctrine\ORM\Mapping as ORM;
7use Symfony\Component\Validator\Constraints as Assert; 7use Symfony\Component\Validator\Constraints as Assert;
8use Hateoas\Configuration\Annotation as Hateoas; 8use Hateoas\Configuration\Annotation as Hateoas;
9use JMS\Serializer\Annotation\XmlRoot; 9use JMS\Serializer\Annotation\XmlRoot;
10use Wallabag\UserBundle\Entity\User;
10 11
11/** 12/**
12 * Entry. 13 * Entry.
@@ -129,7 +130,7 @@ class Entry
129 private $isPublic; 130 private $isPublic;
130 131
131 /** 132 /**
132 * @ORM\ManyToOne(targetEntity="User", inversedBy="entries") 133 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries")
133 */ 134 */
134 private $user; 135 private $user;
135 136
@@ -142,7 +143,7 @@ class Entry
142 /* 143 /*
143 * @param User $user 144 * @param User $user
144 */ 145 */
145 public function __construct(User $user) 146 public function __construct(Wallabag\UserBundle\Entity\User $user)
146 { 147 {
147 $this->user = $user; 148 $this->user = $user;
148 $this->tags = new ArrayCollection(); 149 $this->tags = new ArrayCollection();
diff --git a/src/Wallabag/CoreBundle/Entity/Tag.php b/src/Wallabag/CoreBundle/Entity/Tag.php
index 97c4579f..6067360f 100644
--- a/src/Wallabag/CoreBundle/Entity/Tag.php
+++ b/src/Wallabag/CoreBundle/Entity/Tag.php
@@ -42,7 +42,7 @@ class Tag
42 private $entries; 42 private $entries;
43 43
44 /** 44 /**
45 * @ORM\ManyToOne(targetEntity="User", inversedBy="tags") 45 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="tags")
46 */ 46 */
47 private $user; 47 private $user;
48 48
diff --git a/src/Wallabag/CoreBundle/Entity/User.php b/src/Wallabag/CoreBundle/Entity/User.php
deleted file mode 100644
index ae2902a3..00000000
--- a/src/Wallabag/CoreBundle/Entity/User.php
+++ /dev/null
@@ -1,201 +0,0 @@
1<?php
2
3namespace Wallabag\CoreBundle\Entity;
4
5use Doctrine\Common\Collections\ArrayCollection;
6use Doctrine\ORM\Mapping as ORM;
7use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
8use Symfony\Component\Security\Core\User\UserInterface;
9use JMS\Serializer\Annotation\ExclusionPolicy;
10use JMS\Serializer\Annotation\Expose;
11use FOS\UserBundle\Model\User as BaseUser;
12
13/**
14 * User.
15 *
16 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\UserRepository")
17 * @ORM\Table
18 * @ORM\HasLifecycleCallbacks()
19 * @ExclusionPolicy("all")
20 *
21 * @UniqueEntity("email")
22 * @UniqueEntity("username")
23 */
24class User extends BaseUser
25{
26 /**
27 * @var int
28 *
29 * @Expose
30 * @ORM\Column(name="id", type="integer")
31 * @ORM\Id
32 * @ORM\GeneratedValue(strategy="AUTO")
33 */
34 protected $id;
35
36 /**
37 * @var string
38 *
39 * @ORM\Column(name="name", type="text", nullable=true)
40 */
41 protected $name;
42
43 /**
44 * @var date
45 *
46 * @ORM\Column(name="created_at", type="datetime")
47 */
48 protected $createdAt;
49
50 /**
51 * @var date
52 *
53 * @ORM\Column(name="updated_at", type="datetime")
54 */
55 protected $updatedAt;
56
57 /**
58 * @ORM\OneToMany(targetEntity="Entry", mappedBy="user", cascade={"remove"})
59 */
60 protected $entries;
61
62 /**
63 * @ORM\OneToOne(targetEntity="Config", mappedBy="user")
64 */
65 protected $config;
66
67 /**
68 * @ORM\OneToMany(targetEntity="Tag", mappedBy="user", cascade={"remove"})
69 */
70 protected $tags;
71
72 public function __construct()
73 {
74 parent::__construct();
75 $this->entries = new ArrayCollection();
76 $this->tags = new ArrayCollection();
77 $this->roles = array('ROLE_USER');
78 }
79
80 /**
81 * @ORM\PrePersist
82 * @ORM\PreUpdate
83 */
84 public function timestamps()
85 {
86 if (is_null($this->createdAt)) {
87 $this->createdAt = new \DateTime();
88 }
89
90 $this->updatedAt = new \DateTime();
91 }
92
93 /**
94 * Set name.
95 *
96 * @param string $name
97 *
98 * @return User
99 */
100 public function setName($name)
101 {
102 $this->name = $name;
103
104 return $this;
105 }
106
107 /**
108 * Get name.
109 *
110 * @return string
111 */
112 public function getName()
113 {
114 return $this->name;
115 }
116
117 /**
118 * @return string
119 */
120 public function getCreatedAt()
121 {
122 return $this->createdAt;
123 }
124
125 /**
126 * @return string
127 */
128 public function getUpdatedAt()
129 {
130 return $this->updatedAt;
131 }
132
133 /**
134 * @param Entry $entry
135 *
136 * @return User
137 */
138 public function addEntry(Entry $entry)
139 {
140 $this->entries[] = $entry;
141
142 return $this;
143 }
144
145 /**
146 * @return ArrayCollection<Entry>
147 */
148 public function getEntries()
149 {
150 return $this->entries;
151 }
152
153 /**
154 * @param Entry $entry
155 *
156 * @return User
157 */
158 public function addTag(Tag $tag)
159 {
160 $this->tags[] = $tag;
161
162 return $this;
163 }
164
165 /**
166 * @return ArrayCollection<Tag>
167 */
168 public function getTags()
169 {
170 return $this->tags;
171 }
172
173 public function isEqualTo(UserInterface $user)
174 {
175 return $this->username === $user->getUsername();
176 }
177
178 /**
179 * Set config.
180 *
181 * @param \Wallabag\CoreBundle\Entity\Config $config
182 *
183 * @return User
184 */
185 public function setConfig(\Wallabag\CoreBundle\Entity\Config $config = null)
186 {
187 $this->config = $config;
188
189 return $this;
190 }
191
192 /**
193 * Get config.
194 *
195 * @return \Wallabag\CoreBundle\Entity\Config
196 */
197 public function getConfig()
198 {
199 return $this->config;
200 }
201}