Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Validate an array will validate it's values recursively #23032

Closed
@steevanb

Description

@steevanb
Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Symfony version 3.2.9

Hi !

I have this simple code :

$object = new MyObject();
// test #1
$validator->validate(['foo', $object], null, 'validationGroup');
// test #2
$validator->validate([0 => [0 => ['foo', $object]]], null, 'validationGroup');

This will call validationGroup validation on $object, for tests #1 and #2.
I can understand for #1, although it's not what i expect : validators should validate only one level, so it must validate keys and values (type, count, etc), but not call validationGroup on each values.
If i want to validate each value, with validationGroup, i must add Valid validator, like we do on objects.

For #2, i don't understand why group validationGroup is validate for $object ?

Thanks !

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions