|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace T4web\Mail\Action\Backend\ListAction; |
|
4
|
|
|
|
|
5
|
|
|
use Zend\InputFilter\InputFilter; |
|
6
|
|
|
use Zend\InputFilter\Input; |
|
7
|
|
|
use T4web\Crud\Validator\BaseFilter; |
|
8
|
|
|
|
|
9
|
|
|
class CriteriaValidator extends BaseFilter |
|
10
|
|
|
{ |
|
11
|
|
|
public function __construct() |
|
12
|
|
|
{ |
|
13
|
|
|
$this->inputFilter = new InputFilter(); |
|
14
|
|
|
|
|
15
|
|
|
$id = new Input('id_equalTo'); |
|
16
|
|
|
$id->getValidatorChain() |
|
17
|
|
|
->attachByName('Digits') |
|
18
|
|
|
->attachByName('GreaterThan', ['min' => 0]); |
|
19
|
|
|
$id->setRequired(false); |
|
20
|
|
|
|
|
21
|
|
|
$mailTo = new Input('mailTo_like'); |
|
22
|
|
|
$mailTo->getFilterChain() |
|
23
|
|
|
->attachByName('StringTrim'); |
|
24
|
|
|
$mailTo->getValidatorChain() |
|
25
|
|
|
->attachByName('StringLength', ['min' => 0, 'max' => 50]); |
|
26
|
|
|
$mailTo->setRequired(false); |
|
27
|
|
|
|
|
28
|
|
|
$layoutId = new Input('layoutId_equalTo'); |
|
29
|
|
|
$layoutId->getValidatorChain() |
|
30
|
|
|
->attachByName('Digits') |
|
31
|
|
|
->attachByName('GreaterThan', ['min' => 0, 'max' => 1]); |
|
32
|
|
|
$layoutId->setRequired(false); |
|
33
|
|
|
|
|
34
|
|
|
$templateId = new Input('templateId_equalTo'); |
|
35
|
|
|
$templateId->getValidatorChain() |
|
36
|
|
|
->attachByName('Digits') |
|
37
|
|
|
->attachByName('GreaterThan', ['min' => 0, 'max' => 7]); |
|
38
|
|
|
$templateId->setRequired(false); |
|
39
|
|
|
|
|
40
|
|
|
$limit = new Input('limit'); |
|
41
|
|
|
$limit->getValidatorChain() |
|
42
|
|
|
->attachByName('Digits') |
|
43
|
|
|
->attachByName('GreaterThan', ['min' => 0]); |
|
44
|
|
|
$limit->setRequired(false); |
|
45
|
|
|
|
|
46
|
|
|
$page = new Input('page'); |
|
47
|
|
|
$page->getValidatorChain() |
|
48
|
|
|
->attachByName('Digits') |
|
49
|
|
|
->attachByName('GreaterThan', ['min' => 0]); |
|
50
|
|
|
$page->setRequired(false); |
|
51
|
|
|
|
|
52
|
|
|
$createdDtLessThen = new Input('createdDt_lessThan'); |
|
53
|
|
|
$createdDtLessThen->setRequired(false); |
|
54
|
|
|
|
|
55
|
|
|
$createdDtGreaterThan = new Input('createdDt_greaterThan'); |
|
56
|
|
|
$createdDtGreaterThan->setRequired(false); |
|
57
|
|
|
|
|
58
|
|
|
$this->inputFilter->add($id); |
|
59
|
|
|
$this->inputFilter->add($mailTo); |
|
60
|
|
|
$this->inputFilter->add($layoutId); |
|
61
|
|
|
$this->inputFilter->add($templateId); |
|
62
|
|
|
$this->inputFilter->add($limit); |
|
63
|
|
|
$this->inputFilter->add($page); |
|
64
|
|
|
$this->inputFilter->add($createdDtLessThen); |
|
65
|
|
|
$this->inputFilter->add($createdDtGreaterThan); |
|
66
|
|
|
} |
|
67
|
|
|
} |