use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
+use Hateoas\Configuration\Annotation as Hateoas;
+use JMS\Serializer\Annotation\XmlRoot;
/**
* Entry
*
+ * @XmlRoot("entry")
* @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntryRepository")
* @ORM\Table(name="entry")
* @ORM\HasLifecycleCallbacks()
- *
+ * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())")
*/
class Entry
{
+ /** @Serializer\XmlAttribute */
/**
* @var integer
*
*/
private $isStarred = false;
- /**
- * @var boolean
- *
- * @ORM\Column(name="is_deleted", type="boolean")
- */
- private $isDeleted = false;
-
/**
* @var string
*
*/
private $updatedAt;
- /**
- * @var string
- *
- * @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true)
- */
- private $userId;
-
/**
* @var string
*
*/
private $isPublic;
+ /**
+ * @ORM\ManyToOne(targetEntity="User", inversedBy="entries")
+ */
+ private $user;
+
+ /*
+ * @param User $user
+ */
+ public function __construct(User $user)
+ {
+ $this->user = $user;
+ }
+
/**
* Get id
*
}
/**
- * Set userId
- *
- * @param string $userId
- * @return Entry
- */
- public function setUserId($userId)
- {
- $this->userId = $userId;
-
- return $this;
- }
-
- /**
- * Get userId
- *
- * @return string
- */
- public function getUserId()
- {
- return $this->userId;
- }
-
- /**
- * @return string
- */
- public function isDeleted()
- {
- return $this->isDeleted;
- }
-
- /**
- * @param string $isDeleted
+ * @return User
*/
- public function setDeleted($isDeleted)
+ public function getUser()
{
- $this->isDeleted = $isDeleted;
+ return $this->user;
}
/**