3 namespace Wallabag\AnnotationBundle\Entity
;
5 use Doctrine\ORM\Mapping
as ORM
;
6 use JMS\Serializer\Annotation\Exclude
;
7 use JMS\Serializer\Annotation\ExclusionPolicy
;
8 use JMS\Serializer\Annotation\Groups
;
9 use JMS\Serializer\Annotation\SerializedName
;
10 use JMS\Serializer\Annotation\VirtualProperty
;
11 use Symfony\Component\Validator\Constraints
as Assert
;
12 use Wallabag\CoreBundle\Entity\Entry
;
13 use Wallabag\CoreBundle\Helper\EntityTimestampsTrait
;
14 use Wallabag\UserBundle\Entity\User
;
19 * @ORM\Table(name="annotation")
20 * @ORM\Entity(repositoryClass="Wallabag\AnnotationBundle\Repository\AnnotationRepository")
21 * @ORM\HasLifecycleCallbacks()
22 * @ExclusionPolicy("none")
26 use EntityTimestampsTrait
;
31 * @ORM\Column(name="id", type="integer")
33 * @ORM\GeneratedValue(strategy="AUTO")
40 * @ORM\Column(name="text", type="text")
42 * @Groups({"entries_for_user", "export_all"})
49 * @ORM\Column(name="created_at", type="datetime")
56 * @ORM\Column(name="updated_at", type="datetime")
65 * maxMessage = "validator.quote_length_too_high"
67 * @ORM\Column(name="quote", type="text")
69 * @Groups({"entries_for_user", "export_all"})
76 * @ORM\Column(name="ranges", type="array")
78 * @Groups({"entries_for_user", "export_all"})
85 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User")
92 * @ORM\ManyToOne(targetEntity="Wallabag\CoreBundle\Entity\Entry", inversedBy="annotations")
93 * @ORM\JoinColumn(name="entry_id", referencedColumnName="id", onDelete="cascade")
100 public function __construct(User
$user)
110 public function getId()
118 * @param string $text
122 public function setText($text)
134 public function getText()
144 public function getCreatedAt()
146 return $this->createdAt
;
154 public function getUpdatedAt()
156 return $this->updatedAt
;
164 public function getQuote()
172 * @param string $quote
176 public function setQuote($quote)
178 $this->quote
= $quote;
188 public function getRanges()
190 return $this->ranges
;
196 * @param array $ranges
200 public function setRanges($ranges)
202 $this->ranges
= $ranges;
214 public function setUser($user)
226 public function getUser()
233 * @SerializedName("user")
235 public function getUserName()
237 return $this->user
->getName();
243 * @param Entry $entry
247 public function setEntry($entry)
249 $this->entry
= $entry;
250 $entry->setAnnotation($this);
260 public function getEntry()
267 * @SerializedName("annotator_schema_version")
269 public function getVersion()