Skip to content

UniqueEntityValidator error ? #16791

@poolerMF

Description

@poolerMF

hello ... I'm using SYMFONY 2.7.3, my situation:

validation.yml

XYZ/SubjectData:
    constraints:
        - Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity:
            fields: [client, name, regid, taxid, vatid, registerNumber]
            message: client.not_unique
            errorPath: regid
            groups: [create, update]

creating form:

$form = $this->createForm('subject_data_type', $object, ['addClient' => false, 'addValidFrom' => true, 'submitButton' => true, 'validation_groups' => ['create']]);
  1. Iadd bullshit to validation fields (not mapped field) .. for example: "awegresg"
  2. I set form to existed data
  3. validation passed and SQL error occured (not unique entity)

I also see, that in UniqueEntityValidator, lines 89->91:

if ($constraint->ignoreNull && null === $criteria[$fieldName]) {
    return;
}

why return ? why not continue ??

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