Skip to content

Form validation functionality disappearing? #19045

@dialogik

Description

@dialogik

Without having made any changes to the validation.yml, I suddenly face the issue that validation simply doesn't take place anymore (throwing a database error when trying to INSERT). I did a little research in recent repo changes. In this process, I cloned my repo into a blank folder, checked out to an older tag, and -- okay --validation was reactivated.

So I did a little more research, trying to determine any relevant diffs in my repo history. In order to walk through the history, I again cloned blankly, checked out to the same tag as the day before, and validation doesn't work!

I was recommended to restart Apache, but neither that, nor a reboot helped. Using the YAML notation (see below), another recommendation was to use annotations instead (with validation: { enable_annotations: true } accordingly). That also fails. No validation done.

I was trying to explicitly use the validation service

$validator = $this->get('validator');
$errors = $validator->validate($article);

if ($form->isSubmitted()) {
    dump($errors);
    die();
}

But errors remain void

IncidentController.php on line 125:
ConstraintViolationList {#640 ▼
  -violations: []
}

Has anyone else faced this issue before?

Sysinfo

  • validation.yml path: src/Acme/MyBundle/Resources/config
  • Symfony v3.1.0
  • XAMPP/PHP 7.0.6
  • Apache/2.4.18 (Win32)

config.yml

framework:
    ...
    validation:      { enabled: true }

validation.yml

Acme\MyBundle\Entity\Article:
    properties:
        name:
            - NotBlank: ~

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions