]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/AnnotationBundle/Entity/Annotation.php
Displays an error with an annotation with a too long quote
[github/wallabag/wallabag.git] / src / Wallabag / AnnotationBundle / Entity / Annotation.php
index 90ee7c2d7e2200b484ae3c0d0550c15279390b38..c8e4164972643df7e9e637e954fee0fc7edb74b5 100644 (file)
@@ -7,6 +7,8 @@ use JMS\Serializer\Annotation\ExclusionPolicy;
 use JMS\Serializer\Annotation\Exclude;
 use JMS\Serializer\Annotation\VirtualProperty;
 use JMS\Serializer\Annotation\SerializedName;
+use JMS\Serializer\Annotation\Groups;
+use Symfony\Component\Validator\Constraints as Assert;
 use Wallabag\UserBundle\Entity\User;
 use Wallabag\CoreBundle\Entity\Entry;
 
@@ -33,6 +35,8 @@ class Annotation
      * @var string
      *
      * @ORM\Column(name="text", type="text")
+     *
+     * @Groups({"entries_for_user", "export_all"})
      */
     private $text;
 
@@ -53,7 +57,13 @@ class Annotation
     /**
      * @var string
      *
-     * @ORM\Column(name="quote", type="string")
+     * @Assert\Length(
+     *     max = 10000,
+     *     maxMessage = "validator.quote_length_too_high"
+     * )
+     * @ORM\Column(name="quote", type="text")
+     *
+     * @Groups({"entries_for_user", "export_all"})
      */
     private $quote;
 
@@ -61,6 +71,8 @@ class Annotation
      * @var array
      *
      * @ORM\Column(name="ranges", type="array")
+     *
+     * @Groups({"entries_for_user", "export_all"})
      */
     private $ranges;
 
@@ -75,7 +87,7 @@ class Annotation
      * @Exclude
      *
      * @ORM\ManyToOne(targetEntity="Wallabag\CoreBundle\Entity\Entry", inversedBy="annotations")
-     * @ORM\JoinColumn(name="entry_id", referencedColumnName="id")
+     * @ORM\JoinColumn(name="entry_id", referencedColumnName="id", onDelete="cascade")
      */
     private $entry;