1+ <?php
2+
3+ namespace Greenter \Validator \Loader \v21 ;
4+
5+ use Greenter \Validator \Metadata \LoaderMetadataInterface ;
6+ use Symfony \Component \Validator \Constraints as Assert ;
7+ use Greenter \Validator \Constraint as MyAssert ;
8+ use Symfony \Component \Validator \Mapping \ClassMetadata ;
9+
10+ class InvoiceLoader implements LoaderMetadataInterface
11+ {
12+ public function load (ClassMetadata $ metadata )
13+ {
14+ $ metadata ->addPropertyConstraints ('tipoOperacion ' , [
15+ new Assert \NotBlank (),
16+ ]);
17+ $ metadata ->addPropertyConstraints ('tipoDoc ' , [
18+ new Assert \NotBlank (),
19+ ]);
20+ $ metadata ->addPropertyConstraints ('serie ' , [
21+ new Assert \NotBlank (),
22+ new Assert \Length (['max ' => 4 ]),
23+ ]);
24+ $ metadata ->addPropertyConstraints ('correlativo ' , [
25+ new Assert \NotBlank (),
26+ new Assert \Length (['max ' => 8 ]),
27+ ]);
28+ $ metadata ->addPropertyConstraints ('fechaEmision ' , [
29+ new Assert \NotBlank (),
30+ new Assert \DateTime (),
31+ ]);
32+ $ metadata ->addPropertyConstraint ('fecVencimiento ' , new Assert \DateTime ());
33+ $ metadata ->addPropertyConstraints ('tipoMoneda ' , [
34+ new Assert \NotBlank (),
35+ new MyAssert \Currency (),
36+ ]);
37+ $ metadata ->addPropertyConstraints ('mtoOperGravadas ' , [
38+ new Assert \Type (['type ' => 'numeric ' ]),
39+ ]);
40+ $ metadata ->addPropertyConstraints ('mtoOperInafectas ' , [
41+ new Assert \Type (['type ' => 'numeric ' ]),
42+ ]);
43+ $ metadata ->addPropertyConstraints ('mtoOperExoneradas ' , [
44+ new Assert \Type (['type ' => 'numeric ' ]),
45+ ]);
46+ $ metadata ->addPropertyConstraints ('mtoOperGratuitas ' , [
47+ new Assert \Type (['type ' => 'numeric ' ]),
48+ ]);
49+ $ metadata ->addPropertyConstraints ('mtoOperExportacion ' , [
50+ new Assert \Type (['type ' => 'numeric ' ]),
51+ ]);
52+ $ metadata ->addPropertyConstraint ('mtoIGV ' , new Assert \Type (['type ' => 'numeric ' ]));
53+ $ metadata ->addPropertyConstraint ('mtoISC ' , new Assert \Type (['type ' => 'numeric ' ]));
54+ $ metadata ->addPropertyConstraint ('mtoBaseIsc ' , new Assert \Type (['type ' => 'numeric ' ]));
55+ $ metadata ->addPropertyConstraint ('mtoOtrosTributos ' , new Assert \Type (['type ' => 'numeric ' ]));
56+ $ metadata ->addPropertyConstraint ('mtoBaseOth ' , new Assert \Type (['type ' => 'numeric ' ]));
57+ $ metadata ->addPropertyConstraint ('mtoDescuentos ' , new Assert \Type (['type ' => 'numeric ' ]));
58+ $ metadata ->addPropertyConstraint ('sumOtrosCargos ' , new Assert \Type (['type ' => 'numeric ' ]));
59+ $ metadata ->addPropertyConstraint ('totalAnticipos ' , new Assert \Type (['type ' => 'numeric ' ]));
60+ $ metadata ->addPropertyConstraints ('totalImpuestos ' , [
61+ new Assert \NotBlank (),
62+ new Assert \Type (['type ' => 'numeric ' ]),
63+ ]);
64+ $ metadata ->addPropertyConstraints ('valorVenta ' , [
65+ new Assert \NotBlank (),
66+ new Assert \Type (['type ' => 'numeric ' ]),
67+ ]);
68+ $ metadata ->addPropertyConstraints ('mtoImpVenta ' , [
69+ new Assert \NotBlank (),
70+ new Assert \Type (['type ' => 'numeric ' ]),
71+ ]);
72+ $ metadata ->addPropertyConstraints ('client ' , [
73+ new Assert \NotBlank (),
74+ new Assert \Valid (),
75+ ]);
76+ $ metadata ->addPropertyConstraints ('company ' , [
77+ new Assert \NotBlank (),
78+ new Assert \Valid (),
79+ ]);
80+ $ metadata ->addPropertyConstraint ('seller ' , new Assert \Valid ());
81+ $ metadata ->addPropertyConstraint ('details ' , new Assert \Valid ());
82+ $ metadata ->addPropertyConstraint ('legends ' , new Assert \Valid ());
83+ $ metadata ->addPropertyConstraint ('guias ' , new Assert \Valid ());
84+ $ metadata ->addPropertyConstraint ('anticipos ' , new Assert \Valid ());
85+ $ metadata ->addPropertyConstraint ('detraccion ' , new Assert \Valid ());
86+ $ metadata ->addPropertyConstraint ('relDocs ' , new Assert \Valid ());
87+ $ metadata ->addPropertyConstraint ('perception ' , new Assert \Valid ());
88+ $ metadata ->addPropertyConstraint ('cargos ' , new Assert \Valid ());
89+ $ metadata ->addPropertyConstraint ('descuentos ' , new Assert \Valid ());
90+ }
91+ }
0 commit comments