| @@ 21-55 (lines=35) @@ | ||
| 18 | * - IN: will match from a list of ContentId |
|
| 19 | * - EQ: will match against one ContentId |
|
| 20 | */ |
|
| 21 | class ContentId extends Criterion |
|
| 22 | { |
|
| 23 | /** |
|
| 24 | * Creates a new ContentId criterion. |
|
| 25 | * |
|
| 26 | * @param int|int[] $value One or more content Id that must be matched. |
|
| 27 | * |
|
| 28 | * @throws \InvalidArgumentException if a non numeric id is given |
|
| 29 | * @throws \InvalidArgumentException if the value type doesn't match the operator |
|
| 30 | */ |
|
| 31 | public function __construct($value) |
|
| 32 | { |
|
| 33 | parent::__construct(null, null, $value); |
|
| 34 | } |
|
| 35 | ||
| 36 | public function getSpecifications() |
|
| 37 | { |
|
| 38 | $types = Specifications::TYPE_INTEGER | Specifications::TYPE_STRING; |
|
| 39 | ||
| 40 | return [ |
|
| 41 | new Specifications(Operator::IN, Specifications::FORMAT_ARRAY, $types), |
|
| 42 | new Specifications(Operator::EQ, Specifications::FORMAT_SINGLE, $types), |
|
| 43 | ]; |
|
| 44 | } |
|
| 45 | ||
| 46 | /** |
|
| 47 | * @deprecated since 7.2, will be removed in 8.0. Use the constructor directly instead. |
|
| 48 | */ |
|
| 49 | public static function createFromQueryBuilder($target, $operator, $value) |
|
| 50 | { |
|
| 51 | @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 7.2 and will be removed in 8.0.', E_USER_DEPRECATED); |
|
| 52 | ||
| 53 | return new self($value); |
|
| 54 | } |
|
| 55 | } |
|
| 56 | ||
| @@ 22-65 (lines=44) @@ | ||
| 19 | * - IN: will match from a list of ContentTypeGroup id |
|
| 20 | * - EQ: will match against one ContentTypeGroup id |
|
| 21 | */ |
|
| 22 | class ContentTypeGroupId extends Criterion |
|
| 23 | { |
|
| 24 | /** |
|
| 25 | * Creates a new ContentTypeGroup criterion. |
|
| 26 | * |
|
| 27 | * Content will be matched if it matches one of the contentTypeGroupId in $value |
|
| 28 | * |
|
| 29 | * @param int|int[] $value One or more contentTypeGroupId that must be matched |
|
| 30 | * |
|
| 31 | * @throws \InvalidArgumentException if the parameters don't match what the criterion expects |
|
| 32 | */ |
|
| 33 | public function __construct($value) |
|
| 34 | { |
|
| 35 | parent::__construct(null, null, $value); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function getSpecifications() |
|
| 39 | { |
|
| 40 | $types = Specifications::TYPE_INTEGER | Specifications::TYPE_STRING; |
|
| 41 | ||
| 42 | return [ |
|
| 43 | new Specifications( |
|
| 44 | Operator::IN, |
|
| 45 | Specifications::FORMAT_ARRAY, |
|
| 46 | $types |
|
| 47 | ), |
|
| 48 | new Specifications( |
|
| 49 | Operator::EQ, |
|
| 50 | Specifications::FORMAT_SINGLE, |
|
| 51 | $types |
|
| 52 | ), |
|
| 53 | ]; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @deprecated since 7.2, will be removed in 8.0. Use the constructor directly instead. |
|
| 58 | */ |
|
| 59 | public static function createFromQueryBuilder($target, $operator, $value) |
|
| 60 | { |
|
| 61 | @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 7.2 and will be removed in 8.0.', E_USER_DEPRECATED); |
|
| 62 | ||
| 63 | return new self($value); |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||
| @@ 21-57 (lines=37) @@ | ||
| 18 | * - IN: will match from a list of ContentTypeId |
|
| 19 | * - EQ: will match against one ContentTypeId |
|
| 20 | */ |
|
| 21 | class ContentTypeId extends Criterion |
|
| 22 | { |
|
| 23 | /** |
|
| 24 | * Creates a new ContentType criterion. |
|
| 25 | * |
|
| 26 | * Content will be matched if it matches one of the contentTypeId in $value |
|
| 27 | * |
|
| 28 | * @param int|int[] $value One or more content type Id that must be matched |
|
| 29 | * |
|
| 30 | * @throws \InvalidArgumentException if a non numeric id is given |
|
| 31 | * @throws \InvalidArgumentException if the value type doesn't match the operator |
|
| 32 | */ |
|
| 33 | public function __construct($value) |
|
| 34 | { |
|
| 35 | parent::__construct(null, null, $value); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function getSpecifications() |
|
| 39 | { |
|
| 40 | $types = Specifications::TYPE_INTEGER | Specifications::TYPE_STRING; |
|
| 41 | ||
| 42 | return [ |
|
| 43 | new Specifications(Operator::IN, Specifications::FORMAT_ARRAY, $types), |
|
| 44 | new Specifications(Operator::EQ, Specifications::FORMAT_SINGLE, $types), |
|
| 45 | ]; |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * @deprecated since 7.2, will be removed in 8.0. Use the constructor directly instead. |
|
| 50 | */ |
|
| 51 | public static function createFromQueryBuilder($target, $operator, $value) |
|
| 52 | { |
|
| 53 | @trigger_error('The ' . __METHOD__ . ' method is deprecated since version 7.2 and will be removed in 8.0.', E_USER_DEPRECATED); |
|
| 54 | ||
| 55 | return new self($value); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||