aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Entity/User.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-02-06 15:18:54 +0100
committerJeremy <jeremy.benoist@gmail.com>2015-02-08 23:13:40 +0100
commit5f09650eef7bea52b7c54c074c0f873f96e53c86 (patch)
tree1445f0f07ee0cc04b57e0228f3fded0bdfcf3c94 /src/Wallabag/CoreBundle/Entity/User.php
parent8af35ad932177e0363412a868afc128b406e3322 (diff)
downloadwallabag-5f09650eef7bea52b7c54c074c0f873f96e53c86.tar.gz
wallabag-5f09650eef7bea52b7c54c074c0f873f96e53c86.tar.zst
wallabag-5f09650eef7bea52b7c54c074c0f873f96e53c86.zip
add a real relation between user and entry
Diffstat (limited to 'src/Wallabag/CoreBundle/Entity/User.php')
-rw-r--r--src/Wallabag/CoreBundle/Entity/User.php29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Entity/User.php b/src/Wallabag/CoreBundle/Entity/User.php
index 6abfd3ae..cfbd57f8 100644
--- a/src/Wallabag/CoreBundle/Entity/User.php
+++ b/src/Wallabag/CoreBundle/Entity/User.php
@@ -2,6 +2,7 @@
2 2
3namespace Wallabag\CoreBundle\Entity; 3namespace Wallabag\CoreBundle\Entity;
4 4
5use Doctrine\Common\Collections\ArrayCollection;
5use Doctrine\ORM\Mapping as ORM; 6use Doctrine\ORM\Mapping as ORM;
6use Symfony\Component\Security\Core\User\UserInterface; 7use Symfony\Component\Security\Core\User\UserInterface;
7use Symfony\Component\Security\Core\User\AdvancedUserInterface; 8use Symfony\Component\Security\Core\User\AdvancedUserInterface;
@@ -78,10 +79,16 @@ class User implements AdvancedUserInterface, \Serializable
78 */ 79 */
79 private $updatedAt; 80 private $updatedAt;
80 81
82 /**
83 * @ORM\OneToMany(targetEntity="Entry", mappedBy="user", cascade={"remove"})
84 */
85 private $entries;
86
81 public function __construct() 87 public function __construct()
82 { 88 {
83 $this->isActive = true; 89 $this->isActive = true;
84 $this->salt = md5(uniqid(null, true)); 90 $this->salt = md5(uniqid(null, true));
91 $this->entries = new ArrayCollection();
85 } 92 }
86 93
87 /** 94 /**
@@ -232,6 +239,26 @@ class User implements AdvancedUserInterface, \Serializable
232 } 239 }
233 240
234 /** 241 /**
242 * @param Entry $entry
243 *
244 * @return User
245 */
246 public function addEntry(Entry $entry)
247 {
248 $this->entries[] = $entry;
249
250 return $this;
251 }
252
253 /**
254 * @return ArrayCollection<Entry>
255 */
256 public function getEntries()
257 {
258 return $this->entries;
259 }
260
261 /**
235 * @inheritDoc 262 * @inheritDoc
236 */ 263 */
237 public function eraseCredentials() 264 public function eraseCredentials()