]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Entity/Entry.php
add a real relation between user and entry
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Entry.php
index a00762cadfbc1a58a4250f09b1e803529fbd71af..937213b4477b85f294bf143529eaf38d032672e0 100644 (file)
@@ -81,13 +81,6 @@ class Entry
      */
     private $updatedAt;
 
-    /**
-     * @var string
-     *
-     * @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true)
-     */
-    private $userId;
-
     /**
      * @var string
      *
@@ -123,6 +116,19 @@ class Entry
      */
     private $isPublic;
 
+    /**
+     * @ORM\ManyToOne(targetEntity="User", inversedBy="entries")
+     */
+    private $user;
+
+    /*
+     * @param User     $user
+     */
+    public function __construct(User $user)
+    {
+        $this->user = $user;
+    }
+
     /**
      * Get id
      *
@@ -263,26 +269,11 @@ class Entry
     }
 
     /**
-     * Set userId
-     *
-     * @param  string $userId
-     * @return Entry
-     */
-    public function setUserId($userId)
-    {
-        $this->userId = $userId;
-
-        return $this;
-    }
-
-    /**
-     * Get userId
-     *
-     * @return string
+     * @return User
      */
-    public function getUserId()
+    public function getUser()
     {
-        return $this->userId;
+        return $this->user;
     }
 
     /**