X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FAnnotationBundle%2FEntity%2FAnnotation.php;h=c8e4164972643df7e9e637e954fee0fc7edb74b5;hb=2c3e148b0029a094431622feac79fafcd0d43fc8;hp=db9590b076c526aea25a93efc6d617eb00d6ccc3;hpb=4dc872238a61f33c886c423c5812cc578b3b1cdc;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/AnnotationBundle/Entity/Annotation.php b/src/Wallabag/AnnotationBundle/Entity/Annotation.php index db9590b0..c8e41649 100644 --- a/src/Wallabag/AnnotationBundle/Entity/Annotation.php +++ b/src/Wallabag/AnnotationBundle/Entity/Annotation.php @@ -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,14 +87,14 @@ 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; /* * @param User $user */ - public function __construct(\Wallabag\UserBundle\Entity\User $user) + public function __construct(User $user) { $this->user = $user; } @@ -204,7 +216,7 @@ class Annotation /** * Set user. * - * @param string $user + * @param User $user * * @return Annotation */ @@ -218,7 +230,7 @@ class Annotation /** * Get user. * - * @return string + * @return User */ public function getUser() {