diff options
Diffstat (limited to 'src/Wallabag/AnnotationBundle/Entity/Annotation.php')
-rw-r--r-- | src/Wallabag/AnnotationBundle/Entity/Annotation.php | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/Wallabag/AnnotationBundle/Entity/Annotation.php b/src/Wallabag/AnnotationBundle/Entity/Annotation.php index 0838f5aa..a180d504 100644 --- a/src/Wallabag/AnnotationBundle/Entity/Annotation.php +++ b/src/Wallabag/AnnotationBundle/Entity/Annotation.php | |||
@@ -3,13 +3,15 @@ | |||
3 | namespace Wallabag\AnnotationBundle\Entity; | 3 | namespace Wallabag\AnnotationBundle\Entity; |
4 | 4 | ||
5 | use Doctrine\ORM\Mapping as ORM; | 5 | use Doctrine\ORM\Mapping as ORM; |
6 | use JMS\Serializer\Annotation\ExclusionPolicy; | ||
7 | use JMS\Serializer\Annotation\Exclude; | 6 | use JMS\Serializer\Annotation\Exclude; |
8 | use JMS\Serializer\Annotation\VirtualProperty; | 7 | use JMS\Serializer\Annotation\ExclusionPolicy; |
9 | use JMS\Serializer\Annotation\SerializedName; | ||
10 | use JMS\Serializer\Annotation\Groups; | 8 | use JMS\Serializer\Annotation\Groups; |
11 | use Wallabag\UserBundle\Entity\User; | 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; | 12 | use Wallabag\CoreBundle\Entity\Entry; |
13 | use Wallabag\CoreBundle\Helper\EntityTimestampsTrait; | ||
14 | use Wallabag\UserBundle\Entity\User; | ||
13 | 15 | ||
14 | /** | 16 | /** |
15 | * Annotation. | 17 | * Annotation. |
@@ -21,6 +23,8 @@ use Wallabag\CoreBundle\Entity\Entry; | |||
21 | */ | 23 | */ |
22 | class Annotation | 24 | class Annotation |
23 | { | 25 | { |
26 | use EntityTimestampsTrait; | ||
27 | |||
24 | /** | 28 | /** |
25 | * @var int | 29 | * @var int |
26 | * | 30 | * |
@@ -56,7 +60,11 @@ class Annotation | |||
56 | /** | 60 | /** |
57 | * @var string | 61 | * @var string |
58 | * | 62 | * |
59 | * @ORM\Column(name="quote", type="string") | 63 | * @Assert\Length( |
64 | * max = 10000, | ||
65 | * maxMessage = "validator.quote_length_too_high" | ||
66 | * ) | ||
67 | * @ORM\Column(name="quote", type="text") | ||
60 | * | 68 | * |
61 | * @Groups({"entries_for_user", "export_all"}) | 69 | * @Groups({"entries_for_user", "export_all"}) |
62 | */ | 70 | */ |
@@ -129,18 +137,6 @@ class Annotation | |||
129 | } | 137 | } |
130 | 138 | ||
131 | /** | 139 | /** |
132 | * @ORM\PrePersist | ||
133 | * @ORM\PreUpdate | ||
134 | */ | ||
135 | public function timestamps() | ||
136 | { | ||
137 | if (is_null($this->createdAt)) { | ||
138 | $this->createdAt = new \DateTime(); | ||
139 | } | ||
140 | $this->updatedAt = new \DateTime(); | ||
141 | } | ||
142 | |||
143 | /** | ||
144 | * Get created. | 140 | * Get created. |
145 | * | 141 | * |
146 | * @return \DateTime | 142 | * @return \DateTime |