Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Count constraint 'min'=>1 applied against file field type with 'multiple'=>true is ignored #12547

Copy link
Copy link
Closed
@nurikabe

Description

@nurikabe
Issue body actions

For example:

    $builder = $this->get('form.factory')->createBuilder();
        $form = $builder
            ->add('documents', 'file', array(
                'required' => false,
                'multiple' => true,
                'constraints' => array(
                    new Count(array('min'=>1)),
                )
            ))
            ->add('submit', 'submit')
            ->getForm()
        ;

This validates true even if no file is selected. If min is greater than one, however, the constraint behaves as expected and the form fails with "This collection should contain # elements or more."

Experiencing this in both 2.5.7 as well as 2.6.0-BETA1.

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.