X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FEntity%2FTaggingRule.php;h=7bed7a69139d5e82a5d6986349814cfeddcc1d09;hb=c675bd11c66e60a1976dfd66484448dcc9d80f0f;hp=6d03a34da7b3257548533377caaca4d493fc522d;hpb=ac9fec610a6485b39c856d9cb7d263ce8c5f1223;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Entity/TaggingRule.php b/src/Wallabag/CoreBundle/Entity/TaggingRule.php index 6d03a34d..7bed7a69 100644 --- a/src/Wallabag/CoreBundle/Entity/TaggingRule.php +++ b/src/Wallabag/CoreBundle/Entity/TaggingRule.php @@ -3,16 +3,21 @@ namespace Wallabag\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use JMS\Serializer\Annotation\Exclude; +use JMS\Serializer\Annotation\Groups; +use JMS\Serializer\Annotation\XmlRoot; +use Symfony\Bridge\RulerZ\Validator\Constraints as RulerZAssert; use Symfony\Component\Validator\Constraints as Assert; /** - * Config. + * Tagging rule. * + * @XmlRoot("tagging_rule") * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\TaggingRuleRepository") - * @ORM\Table + * @ORM\Table(name="`tagging_rule`") * @ORM\Entity */ -class TaggingRule +class TaggingRule implements RuleInterface { /** * @var int @@ -27,7 +32,14 @@ class TaggingRule * @var string * * @Assert\NotBlank() + * @Assert\Length(max=255) + * @RulerZAssert\ValidRule( + * allowed_variables={"title", "url", "isArchived", "isStared", "content", "language", "mimetype", "readingTime", "domainName"}, + * allowed_operators={">", "<", ">=", "<=", "=", "is", "!=", "and", "not", "or", "matches", "notmatches"} + * ) * @ORM\Column(name="rule", type="string", nullable=false) + * + * @Groups({"export_tagging_rule"}) */ private $rule; @@ -36,10 +48,14 @@ class TaggingRule * * @Assert\NotBlank() * @ORM\Column(name="tags", type="simple_array", nullable=false) + * + * @Groups({"export_tagging_rule"}) */ private $tags = []; /** + * @Exclude + * * @ORM\ManyToOne(targetEntity="Wallabag\CoreBundle\Entity\Config", inversedBy="taggingRules") */ private $config; @@ -81,7 +97,7 @@ class TaggingRule /** * Set tags. * - * @param array $tags + * @param array $tags * * @return TaggingRule */ @@ -105,8 +121,6 @@ class TaggingRule /** * Set config. * - * @param Config $config - * * @return TaggingRule */ public function setConfig(Config $config)