|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Created by PhpStorm. |
|
4
|
|
|
* User: Administrador |
|
5
|
|
|
* Date: 04/10/2017 |
|
6
|
|
|
* Time: 12:35 PM |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace Greenter\Xml\Validator; |
|
10
|
|
|
|
|
11
|
|
|
use Symfony\Component\Validator\Mapping\ClassMetadata; |
|
12
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Trait SummaryDetailV2Validator |
|
16
|
|
|
* @package Greenter\Xml\Validator |
|
17
|
|
|
*/ |
|
18
|
|
|
trait SummaryDetailV2Validator |
|
19
|
|
|
{ |
|
20
|
10 |
|
public static function loadValidatorMetadata(ClassMetadata $metadata) |
|
21
|
|
|
{ |
|
22
|
10 |
|
$metadata->addPropertyConstraints('tipoDoc', [ |
|
23
|
10 |
|
new Assert\NotBlank(), |
|
24
|
10 |
|
new Assert\Length([ |
|
25
|
10 |
|
'min' => 2, |
|
26
|
10 |
|
'max' => 2, |
|
27
|
10 |
|
]), |
|
28
|
10 |
|
]); |
|
29
|
10 |
|
$metadata->addPropertyConstraints('serieNro', [ |
|
30
|
10 |
|
new Assert\NotBlank(), |
|
31
|
10 |
|
new Assert\Length(['max' => 13]), |
|
32
|
10 |
|
]); |
|
33
|
10 |
|
$metadata->addPropertyConstraints('clienteTipo', [ |
|
34
|
10 |
|
new Assert\NotBlank(), |
|
35
|
10 |
|
new Assert\Length(['max' => 1]), |
|
36
|
10 |
|
]); |
|
37
|
10 |
|
$metadata->addPropertyConstraints('clienteNro', [ |
|
38
|
10 |
|
new Assert\NotBlank(), |
|
39
|
10 |
|
new Assert\Length(['max' => 20]), |
|
40
|
10 |
|
]); |
|
41
|
10 |
|
$metadata->addPropertyConstraints('estado', [ |
|
42
|
10 |
|
new Assert\NotBlank(), |
|
43
|
10 |
|
new Assert\Length(['max' => 1]), |
|
44
|
10 |
|
]); |
|
45
|
10 |
|
$metadata->addPropertyConstraint('docReferencia', new Assert\Valid()); |
|
46
|
10 |
|
$metadata->addPropertyConstraint('total', new Assert\NotBlank()); |
|
47
|
10 |
|
$metadata->addPropertyConstraint('mtoOperGravadas', new Assert\NotBlank()); |
|
48
|
10 |
|
$metadata->addPropertyConstraint('mtoOperInafectas', new Assert\NotBlank()); |
|
49
|
10 |
|
$metadata->addPropertyConstraint('mtoOperExoneradas', new Assert\NotBlank()); |
|
50
|
10 |
|
$metadata->addPropertyConstraint('mtoIGV', new Assert\NotBlank()); |
|
51
|
|
|
} |
|
52
|
|
|
} |