private function validateEachObjectIn($collection, $propertyPath, array $groups, ExecutionContextInterface $context)
    {
        foreach ($collection as $key => $value) {
            if (\is_array($value)) {
                // Also traverse nested arrays
                $this->validateEachObjectIn(
                    $value,
                    $propertyPath.'['.$key.']',
                    $groups,
                    $context
                );

                continue;
            }

            // Scalar and null values in the collection are ignored
            if (\is_object($value)) {
                $this->validateObject(
                    $value,
                    $propertyPath.'['.$key.']',
                    $groups,
                    TraversalStrategy::IMPLICIT,
                    $context
                );
            }
        }
    }
private function validateEachObjectIn($collection, $propertyPath, array $groups, ExecutionContextInterface $context)
    {
        foreach ($collection as $key => $value) {
            if (\is_array($value)) {
                // Also traverse nested arrays
                $this->validateEachObjectIn(
                    $value,
                    $propertyPath.'['.$key.']',
                    $groups,
                    $context
                );

                continue;
            }

            // Scalar and null values in the collection are ignored
            if (\is_object($value)) {
                $this->validateObject(
                    $value,
                    $propertyPath.'['.$key.']',
                    $groups,
                    TraversalStrategy::IMPLICIT,
                    $context
                );
            }
        }
    }
private function validateEachObjectIn ( $ collection , $ propertyPath , array $ groups , ExecutionContextInterface $ context ) { foreach ( $ collection as $ key => $ value ) { if ( \ is_array ( $ value ) ) { // Also traverse nested arrays $ this -> validateEachObjectIn ( $ value , $ propertyPath . '[' . $ key . ']' , $ groups , $ context ) ; continue ; } // Scalar and null values in the collection are ignored if ( \ is_object ( $ value ) ) { $ this -> validateObject ( $ value , $ propertyPath . '[' . $ key . ']' , $ groups , TraversalStrategy :: IMPLICIT , $ context ) ; } } }
Validates each object in a collection against the constraints defined
for their classes.

Nested arrays are also iterated.

@param iterable                  $collection   The collection
@param string                    $propertyPath The current property path
@param (string|GroupSequence)[]  $groups       The validated groups
@param ExecutionContextInterface $context      The current execution context
Validates each object in a collection against the constraints defined for their classes .