Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages showcasing Symfony with Docker, APIs, queues & async tasks, Webpack, SPAs, etc.


You are browsing the documentation for version 4.2 which is not maintained anymore.

If some of your projects are still using this version, consider upgrading.

Form & Validation

4.2 version

Form & Validation


This bundle provides a DocumentType to be used with the Symfony’s Form component. As DocumentType extends the EntityType provided by Symfony’s Doctrine bridge you can use all options available for the ORM users. The only difference is that DocumentType expects the DocumentManager name or instance passed with the document_manager option instead of em.

Unique constraint

This bundle provides a Unique constraint, which extends the UniqueEntity constraint provided by Symfony’s Doctrine bridge. This constraint allows you to validate the uniqueness of an document field against the database.

The Unique constraint shares the same options as UniqueEntity, which means that the em option should be used if you wish to specify the document manager explicitly instead of having it be inferred from the document class.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.