3 namespace Wallabag\AnnotationBundle\Entity
;
5 use Doctrine\ORM\Mapping
as ORM
;
6 use JMS\Serializer\Annotation\ExclusionPolicy
;
7 use JMS\Serializer\Annotation\Exclude
;
8 use JMS\Serializer\Annotation\VirtualProperty
;
9 use JMS\Serializer\Annotation\SerializedName
;
10 use Wallabag\UserBundle\Entity\User
;
11 use Wallabag\CoreBundle\Entity\Entry
;
16 * @ORM\Table(name="annotation")
17 * @ORM\Entity(repositoryClass="Wallabag\AnnotationBundle\Repository\AnnotationRepository")
18 * @ORM\HasLifecycleCallbacks()
19 * @ExclusionPolicy("none")
26 * @ORM\Column(name="id", type="integer")
28 * @ORM\GeneratedValue(strategy="AUTO")
35 * @ORM\Column(name="text", type="text")
42 * @ORM\Column(name="created_at", type="datetime")
49 * @ORM\Column(name="updated_at", type="datetime")
56 * @ORM\Column(name="quote", type="string")
63 * @ORM\Column(name="ranges", type="array")
70 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User")
77 * @ORM\ManyToOne(targetEntity="Wallabag\CoreBundle\Entity\Entry", inversedBy="annotations")
78 * @ORM\JoinColumn(name="entry_id", referencedColumnName="id")
85 public function __construct(User
$user)
95 public function getId()
103 * @param string $text
107 public function setText($text)
119 public function getText()
128 public function timestamps()
130 if (is_null($this->createdAt
)) {
131 $this->createdAt
= new \
DateTime();
133 $this->updatedAt
= new \
DateTime();
141 public function getCreatedAt()
143 return $this->createdAt
;
151 public function getUpdatedAt()
153 return $this->updatedAt
;
161 public function getQuote()
169 * @param string $quote
173 public function setQuote($quote)
175 $this->quote
= $quote;
185 public function getRanges()
187 return $this->ranges
;
193 * @param array $ranges
197 public function setRanges($ranges)
199 $this->ranges
= $ranges;
211 public function setUser($user)
223 public function getUser()
230 * @SerializedName("user")
232 public function getUserName()
234 return $this->user
->getName();
240 * @param Entry $entry
244 public function setEntry($entry)
246 $this->entry
= $entry;
247 $entry->setAnnotation($this);
257 public function getEntry()
264 * @SerializedName("annotator_schema_version")
266 public function getVersion()