File tree Expand file tree Collapse file tree 4 files changed +34
-75
lines changed Expand file tree Collapse file tree 4 files changed +34
-75
lines changed Original file line number Diff line number Diff line change 99
1010use Magento \Framework \Phrase ;
1111use Magento \Framework \Validator \AbstractValidator ;
12+ use Magento \Framework \Validator \ValidatorInterface ;
1213use Opengento \Document \Api \Data \DocumentInterface ;
13- use Opengento \Document \Model \Validator \Code as CodeValidator ;
1414
1515final class Code extends AbstractValidator
1616{
1717 /**
18- * @var CodeValidator
18+ * @var ValidatorInterface
1919 */
20- private $ codeValidator ;
20+ private $ validator ;
2121
2222 public function __construct (
23- CodeValidator $ codeValidator
23+ ValidatorInterface $ validator
2424 ) {
25- $ this ->codeValidator = $ codeValidator ;
25+ $ this ->validator = $ validator ;
2626 }
2727
2828 public function isValid ($ value ): bool
2929 {
3030 $ this ->_clearMessages ();
3131
3232 if ($ value instanceof DocumentInterface) {
33- if (!$ this ->codeValidator ->isValid ($ value ->getCode ())) {
34- $ this ->_addMessages ($ this ->codeValidator ->getMessages ());
33+ if (!$ this ->validator ->isValid ($ value ->getCode ())) {
34+ $ this ->_addMessages ($ this ->validator ->getMessages ());
3535 }
3636 } else {
3737 $ this ->_addMessages ([new Phrase ('The entity must implements "%1". ' , [DocumentInterface::class])]);
Original file line number Diff line number Diff line change 99
1010use Magento \Framework \Phrase ;
1111use Magento \Framework \Validator \AbstractValidator ;
12+ use Magento \Framework \Validator \ValidatorInterface ;
1213use Opengento \Document \Api \Data \DocumentTypeInterface ;
13- use Opengento \Document \Model \Validator \Code as CodeValidator ;
1414
1515final class Code extends AbstractValidator
1616{
1717 /**
18- * @var CodeValidator
18+ * @var ValidatorInterface
1919 */
20- private $ codeValidator ;
20+ private $ validator ;
2121
2222 public function __construct (
23- CodeValidator $ codeValidator
23+ ValidatorInterface $ validator
2424 ) {
25- $ this ->codeValidator = $ codeValidator ;
25+ $ this ->validator = $ validator ;
2626 }
2727
2828 public function isValid ($ value ): bool
2929 {
3030 $ this ->_clearMessages ();
3131
3232 if ($ value instanceof DocumentTypeInterface) {
33- if (!$ this ->codeValidator ->isValid ($ value ->getCode ())) {
34- $ this ->_addMessages ($ this ->codeValidator ->getMessages ());
33+ if (!$ this ->validator ->isValid ($ value ->getCode ())) {
34+ $ this ->_addMessages ($ this ->validator ->getMessages ());
3535 }
3636 } else {
3737 $ this ->_addMessages ([new Phrase ('The entity must implements "%1". ' , [DocumentTypeInterface::class])]);
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2727 </argument >
2828 </arguments >
2929 </type >
30- <virtualType name =" Opengento\Document\Model\Validator\RegexCode" type =" Magento\Framework\Validator\Regex" >
31- <arguments >
32- <argument name =" pattern" xsi : type =" string" >/^[a-z]+[a-z0-9_]+$/</argument >
33- </arguments >
34- </virtualType >
35- <type name =" Opengento\Document\Model\Validator\Code" >
36- <arguments >
37- <argument name =" regex" xsi : type =" object" >Opengento\Document\Model\Validator\RegexCode</argument >
38- </arguments >
39- </type >
4030 <virtualType name =" Opengento\Document\Model\ResourceModel\DocumentType\RelationComposite" type =" Magento\Framework\Model\ResourceModel\Db\VersionControl\RelationComposite" >
4131 <arguments >
4232 <argument name =" relationProcessors" xsi : type =" array" >
4333 <item name =" file" xsi : type =" object" >Opengento\Document\Model\ResourceModel\DocumentType\Relation\File</item >
4434 </argument >
4535 </arguments >
4636 </virtualType >
37+ <virtualType name =" Opengento\Document\Model\DocumentType\Validator\RegexCode" type =" Magento\Framework\Validator\Regex" >
38+ <arguments >
39+ <argument name =" pattern" xsi : type =" string" >/^[a-z]+[a-z0-9_]+$/</argument >
40+ </arguments >
41+ </virtualType >
42+ <type name =" Opengento\Document\Model\DocumentType\Validator\Code" >
43+ <arguments >
44+ <argument name =" validator" xsi : type =" object" >Opengento\Document\Model\DocumentType\Validator\RegexCode</argument >
45+ </arguments >
46+ </type >
4747 <virtualType name =" Opengento\Document\Model\DocumentType\Validator" type =" Opengento\Document\Model\Validator" >
4848 <arguments >
4949 <argument name =" validators" xsi : type =" array" >
6464 </argument >
6565 </arguments >
6666 </virtualType >
67+ <virtualType name =" Opengento\Document\Model\Document\Validator\RegexCode" type =" Magento\Framework\Validator\Regex" >
68+ <arguments >
69+ <argument name =" pattern" xsi : type =" string" >/^[a-z]+[a-z0-9_]+$/</argument >
70+ </arguments >
71+ </virtualType >
72+ <type name =" Opengento\Document\Model\Document\Validator\Code" >
73+ <arguments >
74+ <argument name =" validator" xsi : type =" object" >Opengento\Document\Model\Document\Validator\RegexCode</argument >
75+ </arguments >
76+ </type >
6777 <virtualType name =" Opengento\Document\Model\Document\Validator" type =" Opengento\Document\Model\Validator" >
6878 <arguments >
6979 <argument name =" validators" xsi : type =" array" >
You can’t perform that action at this time.
0 commit comments