Test Failed
Push — master ( 05d675...f4e7d7 )
by Giancarlos
04:02
created

SaleDetailValidator::loadValidatorMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 0
cts 15
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 12
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Administrador
5
 * Date: 17/07/2017
6
 * Time: 10:38 AM
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
 * Class SaleDetailValidator
16
 * @package Greenter\Xml\Validator
17
 */
18
trait SaleDetailValidator
19
{
20
    public static function loadValidatorMetadata(ClassMetadata $metadata)
21
    {
22
        $metadata->addPropertyConstraints('codUnidadMedida', [
23
            new Assert\NotBlank(),
24
            new Assert\Length(['max' => 3]),
25
        ]);
26
        $metadata->addPropertyConstraints('desItem', [
27
            new Assert\NotBlank(),
28
            new Assert\Length(['max' => 250]),
29
        ]);
30
        $metadata->addPropertyConstraint('mtoValorUnitario', new Assert\NotBlank());
31
        $metadata->addPropertyConstraint('mtoIgvItem', new Assert\NotBlank());
32
        $metadata->addPropertyConstraint('tipAfeIgv', new Assert\NotBlank());
33
        $metadata->addPropertyConstraint('mtoPrecioUnitario', new Assert\NotBlank());
34
        $metadata->addPropertyConstraint('mtoValorVenta', new Assert\NotBlank());
35
    }
36
}