If you use the MinLength validator with your entities, the ValidatorTypeGuesser gets the value, stored as "minlength". Then, the FormFactory generates a "pattern" attribute out of minlength and maxlength.
Modern browsers such as Chrome use this attribute to validate the form before submitting.
a "pattern" attribute is generated that validates the
* bschussek/form:
[Form] CSRF fields are not included in the children of a FormView anymore if the view is not the root
[Form] FormView::offsetUnset() is now supported. It was possible anyway using getChildren() and setChildren().
[Form] Split the option "modifiable" of the "collection" type into "allow_add" and "allow_delete"
[Form] Added test for last commit by kriswallsmith and improved dealing with original names
[Form] Fixed variable scope when entering nested form helpers
[Form] Added tests for blocks/templates in the format _<ID>_(widget|row|label|...)
[Form] updated listener to check that data is an array
You can now configure your Doctrine metadata in one single file named 'doctrine':
Resources/config/doctrine.orm.dcm.yml
Resources/config/doctirne.orm.dcm.xml
You can still use one file per entity, but the directory has changed (see the UPDATE file)
* Bart00/patch-1:
Change "zou moeten" to "moet", ("zou moeten" implies that the problem is not so severe and was translated from english too literally) Also fixes some typo's
The form component should now guarantee to always pass an UploadedFile object to your model. There you can call getOriginalName() to retrieve the original name of the uploaded file. For security reasons, the real file name is a generated hash value.
Resetting an entity manager has a lot of consequences and the developer should
be aware of that. So, instead of implicitly reset an entity manager when it is
closed, the developer should reset it by hand if he thinks that this is
possible:
$em = $this->get('registry')->getEntityManager();
$em->getConnection()->beginTransaction(); // suspend auto-commit
try {
//... do some work
} catch (Exception $e) {
$em->getConnection()->rollback();
$em->close();
$this->get('registry')->resetEntityManager();
}
// you will get a new one
$em = $this->get('registry')->getEntityManager();
The consequence of this commit is that variables are accessible that have been passed to a surrounding form helper.
Example template:
{% block my_widget_label %}
<label>{{ label }}
{% endblock %}
{% block my_widget_row %}
{# It is not necessary to explicitely pass through the label variable #}
{{ form_label(form) }}
{{ form_widget(form) }}
{% endblock %}
Example usage:
{{ form_row(form.mywidget, { 'label': 'My Widget' }) }}