src/Jms/YamlValidatorConverter.php
private function loadValidatorElement(array &$property, ElementItem $element)
    {
        /* @var $element Element */
        $type = $element->getType();

        $attrs = [];
        $arrayized = strpos($property['type'], 'array<') === 0;

        if ($arrayized) {
            if ($itemOfArray = $this->isArrayNestedElement($type)) {
                $attrs = [
                    'min' => min($element->getMin(), $itemOfArray->getMin()),
                    'max' => $itemOfArray->getMax()
                ];
            }  elseif ($itemOfArray = $this->isArrayType($type)) {
                $attrs = [
                    'min' => min($element->getMin(), $itemOfArray->getMin()),
                    'max' => $itemOfArray->getMax()
                ];
            } elseif ($this->isArrayElement($element)) {
//                $attrs = [
//                    'min' => $element->getMin(),
//                    'max' => $element->getMax()
//                ];
            }
        }

        if (isset($attrs['min']) && $attrs['min'] === 0) {
            unset($attrs['min']);
        }
        if (isset($attrs['max']) && $attrs['max'] === -1) {
            unset($attrs['max']);
        }

        $rules = $this->loadValidatorType($property, $type, $arrayized );


        if ($element->getMin() > 0) {
            $property['validation'][] = [
                'NotNull' => null
            ];
        }

        if ($arrayized && count($attrs) > 0) {
            $property['validation'][] = [
                 'Count' => $attrs
            ];
        }
        if ($arrayized && count($rules) > 0) {
//            $rules[] = ['Valid' => null];
            $property['validation'][] = [
                'All' => ['constraints' => $rules]
            ];
        } elseif ($type instanceof ComplexType) {
            $property['validation'][] = [
                'Valid' => null
            ];
        }
    }
private function loadValidatorElement(array &$property, ElementItem $element)
    {
        /* @var $element Element */
        $type = $element->getType();

        $attrs = [];
        $arrayized = strpos($property['type'], 'array<') === 0;

        if ($arrayized) {
            if ($itemOfArray = $this->isArrayNestedElement($type)) {
                $attrs = [
                    'min' => min($element->getMin(), $itemOfArray->getMin()),
                    'max' => $itemOfArray->getMax()
                ];
            }  elseif ($itemOfArray = $this->isArrayType($type)) {
                $attrs = [
                    'min' => min($element->getMin(), $itemOfArray->getMin()),
                    'max' => $itemOfArray->getMax()
                ];
            } elseif ($this->isArrayElement($element)) {
//                $attrs = [
//                    'min' => $element->getMin(),
//                    'max' => $element->getMax()
//                ];
            }
        }

        if (isset($attrs['min']) && $attrs['min'] === 0) {
            unset($attrs['min']);
        }
        if (isset($attrs['max']) && $attrs['max'] === -1) {
            unset($attrs['max']);
        }

        $rules = $this->loadValidatorType($property, $type, $arrayized );


        if ($element->getMin() > 0) {
            $property['validation'][] = [
                'NotNull' => null
            ];
        }

        if ($arrayized && count($attrs) > 0) {
            $property['validation'][] = [
                 'Count' => $attrs
            ];
        }
        if ($arrayized && count($rules) > 0) {
//            $rules[] = ['Valid' => null];
            $property['validation'][] = [
                'All' => ['constraints' => $rules]
            ];
        } elseif ($type instanceof ComplexType) {
            $property['validation'][] = [
                'Valid' => null
            ];
        }
    }
private function loadValidatorElement ( array & $ property , ElementItem $ element ) { /* @var $element Element */ $ type = $ element -> getType ( ) ; $ attrs = [ ] ; $ arrayized = strpos ( $ property [ 'type' ] , 'array<' ) === 0 ; if ( $ arrayized ) { if ( $ itemOfArray = $ this -> isArrayNestedElement ( $ type ) ) { $ attrs = [ 'min' => min ( $ element -> getMin ( ) , $ itemOfArray -> getMin ( ) ) , 'max' => $ itemOfArray -> getMax ( ) ] ; } elseif ( $ itemOfArray = $ this -> isArrayType ( $ type ) ) { $ attrs = [ 'min' => min ( $ element -> getMin ( ) , $ itemOfArray -> getMin ( ) ) , 'max' => $ itemOfArray -> getMax ( ) ] ; } elseif ( $ this -> isArrayElement ( $ element ) ) { //                $attrs = [ //                    'min' => $element->getMin(), //                    'max' => $element->getMax() //                ]; } } if ( isset ( $ attrs [ 'min' ] ) && $ attrs [ 'min' ] === 0 ) { unset ( $ attrs [ 'min' ] ) ; } if ( isset ( $ attrs [ 'max' ] ) && $ attrs [ 'max' ] === - 1 ) { unset ( $ attrs [ 'max' ] ) ; } $ rules = $ this -> loadValidatorType ( $ property , $ type , $ arrayized ) ; if ( $ element -> getMin ( ) > 0 ) { $ property [ 'validation' ] [ ] = [ 'NotNull' => null ] ; } if ( $ arrayized && count ( $ attrs ) > 0 ) { $ property [ 'validation' ] [ ] = [ 'Count' => $ attrs ] ; } if ( $ arrayized && count ( $ rules ) > 0 ) { //            $rules[] = ['Valid' => null]; $ property [ 'validation' ] [ ] = [ 'All' => [ 'constraints' => $ rules ] ] ; } elseif ( $ type instanceof ComplexType ) { $ property [ 'validation' ] [ ] = [ 'Valid' => null ] ; } }
Load and convert XSD' restrictions to Symfony Validation Constraints
from a schema element including required rule

@param array $property
@param ElementItem $element
@param boolean $arrayize
Load and convert XSD restrictions to Symfony Validation Constraints from a schema element including required rule