2019-06-23 22:13:06 +02:00
|
|
|
<?php
|
|
|
|
|
|
2024-02-19 01:30:12 +01:00
|
|
|
namespace Wallabag\Entity;
|
2019-06-23 22:13:06 +02:00
|
|
|
|
|
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
|
use Symfony\Bridge\RulerZ\Validator\Constraints as RulerZAssert;
|
|
|
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
2025-04-05 12:55:51 +02:00
|
|
|
use Wallabag\Repository\IgnoreOriginInstanceRuleRepository;
|
2019-06-23 22:13:06 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Ignore Origin rule.
|
|
|
|
|
*/
|
2025-04-05 12:55:51 +02:00
|
|
|
#[ORM\Table(name: '`ignore_origin_instance_rule`')]
|
|
|
|
|
#[ORM\Entity(repositoryClass: IgnoreOriginInstanceRuleRepository::class)]
|
2019-06-23 22:13:06 +02:00
|
|
|
class IgnoreOriginInstanceRule implements IgnoreOriginRuleInterface, RuleInterface
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* @var int
|
|
|
|
|
*/
|
2025-04-05 12:55:51 +02:00
|
|
|
#[ORM\Column(name: 'id', type: 'integer')]
|
|
|
|
|
#[ORM\Id]
|
|
|
|
|
#[ORM\GeneratedValue(strategy: 'AUTO')]
|
2019-06-23 22:13:06 +02:00
|
|
|
private $id;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var string
|
|
|
|
|
*
|
|
|
|
|
* @Assert\NotBlank()
|
|
|
|
|
* @Assert\Length(max=255)
|
|
|
|
|
* @RulerZAssert\ValidRule(
|
2019-08-11 23:51:55 +02:00
|
|
|
* allowed_variables={"host","_all"},
|
2019-06-23 22:13:06 +02:00
|
|
|
* allowed_operators={"=","~"}
|
|
|
|
|
* )
|
|
|
|
|
*/
|
2025-04-05 12:55:51 +02:00
|
|
|
#[ORM\Column(name: 'rule', type: 'string', nullable: false)]
|
2019-06-23 22:13:06 +02:00
|
|
|
private $rule;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get id.
|
|
|
|
|
*
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
public function getId()
|
|
|
|
|
{
|
|
|
|
|
return $this->id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set rule.
|
|
|
|
|
*
|
|
|
|
|
* @return IgnoreOriginRuleInterface
|
|
|
|
|
*/
|
|
|
|
|
public function setRule(string $rule)
|
|
|
|
|
{
|
|
|
|
|
$this->rule = $rule;
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get rule.
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getRule()
|
|
|
|
|
{
|
|
|
|
|
return $this->rule;
|
|
|
|
|
}
|
|
|
|
|
}
|