Skip to content

Validation rules doesn't apply on Collection form type. #12279

@motammem

Description

@motammem

For example we have two entities one Car and one Person, when we modify PersonType like below:

$builder
    ->add('email')
    ->add('cars','collection',array(
        'type' => new CarType(),
        'allow_add' => true,
        'allow_delete' => true,
        'by_reference' => false,
    ))
    ->add('submit','submit')

and have following validation rules for Car entity:

Mtm\AppBundle\Entity\Car:
properties:
  file:
    - File:
      maxSize: 100k
      mimeTypes: [application/pdf, application/x-pdf]
      mimeTypesMessage: Please upload a valid PDF

Validation rules doesn't apply on form, it just makes html5 validation on it, not server side validation.

Any idea how should I do that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions