src/Handler/Parameter/ObjectMapperParameterResolverAndExtractor.php
private function isPropertyRequired(\ReflectionProperty $property, array $groups)
    {
        if (!$this->validator) {
            // Can not check...
            return true;
        }

        $metadata = $this->validator->getMetadataFor($property->getDeclaringClass()->getName());

        if (!$metadata instanceof ClassMetadata) {
            return true;
        }

        $propertyMetadata = $metadata->getPropertyMetadata($property->getName());

        if ($propertyMetadata) {
            // @todo: merge all metadata?
            $propertyMetadata = array_pop($propertyMetadata);

            foreach ($groups as $group) {
                $constraints = $propertyMetadata->findConstraints($group);

                foreach ($constraints as $constraint) {
                    if ($constraint instanceof NotBlank) {
                        return true;
                    }
                }
            }
        }

        return false;
    }
private function isPropertyRequired(\ReflectionProperty $property, array $groups)
    {
        if (!$this->validator) {
            // Can not check...
            return true;
        }

        $metadata = $this->validator->getMetadataFor($property->getDeclaringClass()->getName());

        if (!$metadata instanceof ClassMetadata) {
            return true;
        }

        $propertyMetadata = $metadata->getPropertyMetadata($property->getName());

        if ($propertyMetadata) {
            // @todo: merge all metadata?
            $propertyMetadata = array_pop($propertyMetadata);

            foreach ($groups as $group) {
                $constraints = $propertyMetadata->findConstraints($group);

                foreach ($constraints as $constraint) {
                    if ($constraint instanceof NotBlank) {
                        return true;
                    }
                }
            }
        }

        return false;
    }
private function isPropertyRequired ( \ ReflectionProperty $ property , array $ groups ) { if ( ! $ this -> validator ) { // Can not check... return true ; } $ metadata = $ this -> validator -> getMetadataFor ( $ property -> getDeclaringClass ( ) -> getName ( ) ) ; if ( ! $ metadata instanceof ClassMetadata ) { return true ; } $ propertyMetadata = $ metadata -> getPropertyMetadata ( $ property -> getName ( ) ) ; if ( $ propertyMetadata ) { // @todo: merge all metadata? $ propertyMetadata = array_pop ( $ propertyMetadata ) ; foreach ( $ groups as $ group ) { $ constraints = $ propertyMetadata -> findConstraints ( $ group ) ; foreach ( $ constraints as $ constraint ) { if ( $ constraint instanceof NotBlank ) { return true ; } } } } return false ; }
Is required property

@param \ReflectionProperty $property
@param array               $groups

@return bool
Is required property