Commit Graph

431 Commits

Author SHA1 Message Date
Bernhard Schussek
eb50d766da [Form] Fixed variable scope when entering nested form helpers
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' }) }}
2011-05-04 15:40:15 +02:00
Bernhard Schussek
38098604af [Form] Added tests for blocks/templates in the format _<ID>_(widget|row|label|...) 2011-05-04 15:33:51 +02:00
Eriksen Costa
12968f144c [Locale] updated ICU data, changes to note:
- The Indian Rupee sign was updated, few fonts supports it: http://en.wikipedia.org/wiki/Indian_rupee_sign
 - Updated LocaleTypeTest, zh_Hans_MO was removed from ICU
2011-04-28 11:57:55 -03:00
Fabien Potencier
7d024125d3 [Form] fixed unit tests 2011-04-28 08:11:14 +02:00
Pascal Borreli
47948c8d2b [Form] Fixed bug creating empty "1" directory in root 2011-04-28 01:06:38 +00:00
Victor Berchet
d350e01e33 File & UploadedFile tweaks 2011-04-27 09:10:41 +02:00
Eriksen Costa
164ce5210d capitalized 'boolean' 2011-04-27 02:35:10 -03:00
Kris Wallsmith
e726cdd917 changed some skipped tests to incomplete 2011-04-26 07:22:22 -07:00
Bernhard Schussek
675e5ded9e [Form] Changed FormBuilder::build() to FormBuilder::create(). You hvae to pass the resulting builder to FormBuilder::add() manually now
$builder->add(
    $builder->create('child', 'form')
        ->add('foo', 'text')
        ->add('bar', 'text')
);
2011-04-24 12:08:50 +02:00
Ryan Weaver
af8aad9c34 [Form] Throwing exception for invalid "input" type of DateType
Also fixed typo in test of previous commit
2011-04-23 20:36:40 -05:00
Ryan Weaver
66cc555bb1 [Form] Tweak to FileTypeTest to avoid warning 2011-04-23 19:47:14 -05:00
Ryan Weaver
78b2062c5e [Form] Adding an exception for an invalid widget option in DateType 2011-04-23 19:42:40 -05:00
Fabien Potencier
81deedfc1b [Form] fixed unit tests 2011-04-23 22:17:51 +02:00
Bernhard Schussek
6f1bc356a8 [Form] Refactored code from CoreExtension to new ValidatorExtension
CoreExtension is now independent of the Symfony2 validator.
2011-04-22 19:38:21 +02:00
Bernhard Schussek
1ce2db87e2 [Form] Added FormTypeExtensionInterface
With implementations of this interface, existing types can be amended.
The Csrf extension, for example, now contains a class FormTypeCsrfExtension
that adds CSRF capabilities to the "form" type.

To register new type extensions in the DIC, tag them with "form.type_extension"
and the name of the extended type as alias.
2011-04-22 19:24:38 +02:00
Bernhard Schussek
54e66c518f [Form] Reorganized code into "form extensions"
The extension classes are now the only constructor argument of the FormFactory class. They replace the existing "type loader" classes.

    new FormFactory(array(
        new CoreExtension($validator, $storage),
        new CsrfExtension($csrfProvider),
        new DoctrineOrmExtension($em),
    ));

Together with a few upcoming commits this mechanism will make

 * extension of the form framework in bundles and
 * usage of the forms outside of Symfony2

much easier.
2011-04-22 17:41:21 +02:00
Bernhard Schussek
a97366fbcb [Form] Split signature of FormFactory::create() into create() and createNamed()
The data can now be passed to all creation methods:

    $form = $factory->create('form', $data);

By default, a form will receive the name of its type ("form" in above example). If you wish to pass a custom name, use createNamed():

    $form = $factory->createNamed('form', 'myform', $data);
2011-04-22 10:42:21 +02:00
Ryan Weaver
967a42b797 [Form] Adding a check that the choice_list option on the ChoiceType implements the ChoiceListInterface.
Also removed an unused "use" statement.
2011-04-20 08:52:31 -05:00
Fabien Potencier
33498bffa4 [Form] added a unit test 2011-04-18 19:01:09 +02:00
Bernhard Schussek
b93f5a372a [Form] Renamed ChoiceUtil to FormUtil and gave its methods more general names 2011-04-18 15:07:12 +02:00
Bernhard Schussek
f078554c2a [Form] Removed StripTagsListenerTest 2011-04-18 14:27:18 +02:00
Bernhard Schussek
57722550de [Form] Added test for 'email' type and fixed a few bugs 2011-04-18 13:04:18 +02:00
Fabien Potencier
b71f9d2708 [Form] added a unit tests for previous commit 2011-04-18 08:21:18 +02:00
Bernhard Schussek
be5738564f [Form] Improved regular expression in AbstractType::getName() and added unit tests 2011-04-17 18:01:22 +02:00
Bernhard Schussek
2ea68dfcd2 [Form] Improved test coverage of NumberToLocalizedStringTransformer 2011-04-15 16:25:48 +02:00
Bernhard Schussek
30922d9375 [Form] Fixed: Checkboxes in an expanded choice field never have the 'required' HTML5 attribute. Closes http://trac.symfony-project.org/ticket/9588 2011-04-15 16:10:04 +02:00
Bernhard Schussek
9582221862 [Form] ResizeFormListener::preBind() now handles empty strings. Fixes https://github.com/symfony/symfony/pull/40 2011-04-15 15:43:02 +02:00
Bernhard Schussek
d0c572716a Merge remote branch 'henrikbjorn/form' into henrik_merge 2011-04-15 15:34:29 +02:00
Bernhard Schussek
bc0efff28d [Form][FrameworkBundle] Fixed escaping of choice widgets 2011-04-15 15:27:15 +02:00
Henrik Bjørnskov
e687685f98 [Form] change FormView::setVar,getVar,getVars,hasVar to set,get,all,has
[Form] Fixed {get,set,has}Var references in templating php

[Form] Added getVars to FormView to ease usage in Twig. Also added some phpdoc and cleaned up the get method by adding a default value

[Form] Fix

[Form] Delete file generated by test
2011-04-15 15:25:37 +02:00
Bernhard Schussek
e787d5dc22 [Form] PropertyPath now can handle elements with special characters 2011-04-15 15:25:19 +02:00
Bernhard Schussek
4f1ae660fa [Form] Fixed choice labels in expanded choice fields 2011-04-15 15:04:44 +02:00
Bernhard Schussek
41c6ab0ac7 [Form] Field labels can now be passed in the 'label' option 2011-04-15 15:03:10 +02:00
Bernhard Schussek
3d92549382 [FrameworkBundle] Fixed various escaping problems and added test cases for them 2011-04-15 14:38:46 +02:00
Bernhard Schussek
990bef8afb [Form][FrameworkBundle][TwigBundle] Fixed: CSRF fields are not rendered for nested forms anymore 2011-04-15 14:05:33 +02:00
Bernhard Schussek
8fe21285ba [Form] Renamed Form::getView() to createView() to clearly indicate that each call returns a new object 2011-04-15 13:52:11 +02:00
Bernhard Schussek
276b23a344 [Form] Moved creation logic of FormView to Form class 2011-04-15 13:41:45 +02:00
Bernhard Schussek
44fa9bbeaa [Form] Fixed: CSRF token is regenerated if validation fails to avoid stalled tokens. Closes https://github.com/symfony/symfony/pull/415 2011-04-15 12:50:50 +02:00
Bernhard Schussek
c9c8b5c98e [Form] Improved test coverage of MonthChoiceList and fixed timezone used in it. Fixes https://github.com/symfony/symfony/pull/433
Based on dfb93b1bcebf1f34d3a880d00f36acb2bcca0f08:

[FORM] Fixed DateField Month Choices

The month choices were calculated using the current day of the month with
gmmktime rather than the 1st of the month. Additionally, this provides a
UTC timestamp which is passed to the formatter (IntlDateFormatter) which
converts the timestamp using the current timezone. This means that the UTC
timestamp for 1st March was being converted for my timezone (EST) and giving
a date of 28th February, leading to Feb appearing again in the popup form
instead of Mar.
2011-04-15 12:26:07 +02:00
Bernhard Schussek
77bea81ed5 [Form] Improved test coverage of ResizeFormListener. Fixed https://github.com/symfony/symfony/pull/493 2011-04-15 11:06:51 +02:00
Bernhard Schussek
fa457b1cc4 [Form] Renamed 'filter' listeners to 'on' to match naming conventions across the framework 2011-04-15 10:57:32 +02:00
Bernhard Schussek
c6fe6a750d [Form] Added functional test for the 'size' attribute in the select tags of a time field 2011-04-14 15:29:55 +02:00
Bernhard Schussek
e3db366116 [Form] Passing FormFactory to FormBuilder in its constructor 2011-04-14 15:25:30 +02:00
Bernhard Schussek
72b17cd67c [Form] Renamed TemplateContext to FormView 2011-04-14 15:02:51 +02:00
Bernhard Schussek
ca6ae09779 [Form] Removed TemplateContext::create() 2011-04-14 14:42:17 +02:00
Bernhard Schussek
4907c7d81d [Form] Added test coverage for expanded choice fields 2011-04-14 14:18:25 +02:00
Bernhard Schussek
c2dcebf6ea [FrameworkBundle] Added test coverage for FormHelper and fixed various rendering bugs 2011-04-14 13:37:27 +02:00
Bernhard Schussek
ce5f3073bd Fixed test suite and names of accessor methods in TemplateContext 2011-04-14 03:52:52 +02:00
Bernhard Schussek
602846f386 [Form] Added tests for table_layout.html.twig 2011-04-14 03:38:19 +02:00
Bernhard Schussek
96f040cec1 [Form] Added extensive test coverage for div_layout.html.twig 2011-04-14 03:15:56 +02:00
Bernhard Schussek
0b0535d30a [Form] Fixed fatal error in test 2011-04-13 14:01:25 +02:00
Bernhard Schussek
e476231e8a [Form] Removed invalid tests, cleaned up some tests, added test coverage 2011-04-06 15:58:53 +02:00
Bernhard Schussek
72a41f8c94 [Form] Fixed: Booleans can be used as choice keys now 2011-04-02 18:26:28 +02:00
Bernhard Schussek
a5d0b3aea6 [Form] Changed FormBuilder::set(Client|Norm)Transformer to FormBuilder::prepend(Client|Norm)Transformer and FormBuilder::append(Client|Norm)Transformer to facilitate extension of types 2011-04-02 16:39:19 +02:00
Bernhard Schussek
fc59936740 [Form] Fixed: ThemeRenderer::isChoiceSelected() works correctly for boolean choices 2011-04-02 16:00:46 +02:00
Bernhard Schussek
d3b7c4e8c1 [Form] Moved getLabel(), isChoiceSelected() and isChoiceGroup() from ChoiceListInterface to ThemeRenderer 2011-04-02 14:14:18 +02:00
Bernhard Schussek
94f2baa895 [Form] Fixed BooleanToStringTransformer::reverseTransform() to accept NULL values. Fixes ChoiceTypeTest 2011-04-02 13:00:19 +02:00
Bernhard Schussek
37e8e1270c [Form][FrameworkBundle][TwigBundle] Renamed view variable 'disabled' to 'read_only' to match with the according FormInterface methods 2011-04-02 12:18:43 +02:00
Bernhard Schussek
35d9b7f800 [Form] Improved test coverage of Form. The emptyValue closure now receives the Form instance to use form data when constructing new objects 2011-04-02 12:00:19 +02:00
Bernhard Schussek
4f39234741 [Form] bind() is ignored if a form is read-only 2011-04-02 11:39:15 +02:00
Bernhard Schussek
ca20aef379 [Form] Improved test coverage of DelegatingValidator and fixed validation group inheritance 2011-04-02 11:35:58 +02:00
Bernhard Schussek
33b0011f86 [Form] Improved test coverage of Form 2011-04-02 11:22:29 +02:00
Bernhard Schussek
c864d7fae1 [Form] Improved test coverage of Form class 2011-03-31 15:23:33 +02:00
Bernhard Schussek
1ef18360fa [Form] Made name immutable in FormBuilder to avoid synchronization problems with name and property path 2011-03-31 13:48:06 +02:00
Fabien Potencier
59ef0c991c [Form] fixed two unit tests 2011-03-31 07:36:52 +02:00
Fabien Potencier
c7ccb6643b [Form] removed unused constructor argument from Type\FieldType (themeFactory and template) 2011-03-31 07:34:04 +02:00
Bernhard Schussek
1fa004ceb2 [Form] Simplified the interface names of the Renderer subnamespace 2011-03-27 23:39:01 +02:00
Bernhard Schussek
cfaa03eeec [Form] Fixed: empty objects are only created upon binding forms with empty data 2011-03-27 23:07:30 +02:00
Bernhard Schussek
edfae73cd4 [Form] Moved PropertyPath, PropertyPathIterator and VirtualFormAwareIterator to subnamespace Util 2011-03-27 15:37:13 +02:00
Bernhard Schussek
b180319371 [Form] Moved creation of empty data to Form to clean up DataMapperInterface 2011-03-27 15:12:35 +02:00
Bernhard Schussek
6588a47ba7 [Form] Removed FormBuilder::setDataClass(). Use the FieldType option "data_class" instead.
The problem was that "data_class" was used in two places: FormBuilder::build() and PropertyPathMapper.

PropertyPathMapper was already constructed during FormType::buildForm(), so any data class changes made to the FormBuilder wouldn't affect the data class of the PropertyPathMapper anymore and so lead to an inconsistent state.
2011-03-27 14:34:48 +02:00
Bernhard Schussek
364b0f5208 [Form] Fixed: FormBuilder::add() accepts FormTypeInterface instances 2011-03-27 14:05:06 +02:00
Bernhard Schussek
dc38eeffe3 [Form] Changed the default value of the 'property_path' option to NULL. Explicitely set it to '' or false to disable mapping for a field/form 2011-03-27 14:02:24 +02:00
Bernhard Schussek
b21929423e [Form] Completely removed the fields variable in the renderer. The renderer itself supports ArrayAccess and Traversable 2011-03-27 13:48:36 +02:00
Bernhard Schussek
eaff9c641e [Form] Fixed: the default template is only set on the root renderer and reused by children 2011-03-26 19:39:31 +01:00
Bernhard Schussek
a58cfab37d [Form] Removed form.type.loader tag and according compiler pass to simplify configuration. Custom types that are not in the DIC can be instantiated manually and passed wherever a type is desired. 2011-03-26 18:48:55 +01:00
Bernhard Schussek
9ff91dc997 Merge remote branch 'beberlei/FormsCollectionPrototype' into beberlei-merge 2011-03-26 18:39:20 +01:00
Bernhard Schussek
fae319e77a [Form] Renderers are now created explicitely using FormFactory::createRenderer(). This improves performance on requests where a form does not need to be rendered 2011-03-26 16:03:34 +01:00
Bernhard Schussek
8c7a93c90c [Form] Added FormTypeInterface::buildRendererBottomUp() which is called after children are initialized 2011-03-26 16:03:34 +01:00
Bernhard Schussek
c786fac303 [Form] Sample fix implementation of renderers 2011-03-26 16:03:34 +01:00
Benjamin Eberlei
d87651b6a2 [Form] Add option "prototype" defaulting to true. 2011-03-26 14:52:03 +01:00
Benjamin Eberlei
f882a511a0 [Form] Initialize on iterator access. 2011-03-26 12:28:46 +01:00
Benjamin Eberlei
cd1ce86aee [Form] Iterator support for ThemeRenderer 2011-03-26 12:25:47 +01:00
Bernhard Schussek
7585dce8dd [Form] Added options validation to field creation 2011-03-25 15:30:33 +01:00
Bernhard Schussek
6825ea2489 [Form] Improved test coverage of PropertyPathMapper 2011-03-25 11:27:20 +01:00
Bernhard Schussek
e3ac248617 [Form] Errors are mapped to subforms correctly and bubble up again if necessary 2011-03-25 10:53:36 +01:00
Bernhard Schussek
7b412cc762 [Form] Removed FormFactory::addGuessers() and moved guessers to constructor arg instead 2011-03-25 02:26:14 +01:00
Bernhard Schussek
9b1b8cbffa [Form] Replaced various occurences of 'field' by 'form' 2011-03-25 02:12:01 +01:00
Bernhard Schussek
3c412ffba0 [Form] Moved Form::validateData() to DelegatingValidator::validateFormData() 2011-03-25 01:59:28 +01:00
Bernhard Schussek
770d403a52 [Form] Improved error mapping in DelegatingValidator 2011-03-25 00:57:35 +01:00
Bernhard Schussek
4372bd5dc8 [Form] Fixed: Bubbling errors are caught correctly 2011-03-25 00:18:58 +01:00
Bernhard Schussek
262bdcb21d [Form] Fixed validation 2011-03-25 00:16:21 +01:00
Bernhard Schussek
ef334dbc4a Merge remote branch 'beberlei/AttributeSupport' into beberlei-merge 2011-03-24 22:53:39 +01:00
Bernhard Schussek
3f390aa271 [Form] Removed EntityType from DefaultTypeLoader 2011-03-24 22:50:39 +01:00
Benjamin Eberlei
ee96ad0e81 [Form] [DoctrineBridge] Move EntityType and DoctrineTypeLoader into Doctrine Bridge 2011-03-24 22:43:00 +01:00
Benjamin Eberlei
8d6dd2b9af [Form] Add Arbitrary Attribute Support to Form Rendering. 2011-03-24 22:08:08 +01:00
Benjamin Eberlei
6bcc04905c [Form] Introduce ArrayTypeLoader, Remove EntityManager and FormFactory interface from DefaultTypeLoader 2011-03-24 20:00:17 +01:00
Bernhard Schussek
2faa47d03b [Form] Added fallback templates to TwigThemeFactory 2011-03-24 15:11:43 +01:00
Bernhard Schussek
1211d77f49 [Form] Introduced renderer theme factories so that themes can be changed during runtime 2011-03-24 14:27:21 +01:00
Bernhard Schussek
5b41810b6d Revert "[Form] Changed naming of Themes to ThemeEngines. Theme templates are now 'themes'"
This reverts commit 1efd680b68.
2011-03-24 10:55:12 +01:00
Bernhard Schussek
5078a63c74 Revert "[Form] Fixed more naming of themes and theme engines"
This reverts commit 1aa34b7240.
2011-03-24 10:54:47 +01:00
Bernhard Schussek
1aa34b7240 [Form] Fixed more naming of themes and theme engines 2011-03-23 22:51:37 +01:00
Bernhard Schussek
1efd680b68 [Form] Changed naming of Themes to ThemeEngines. Theme templates are now 'themes' 2011-03-23 22:34:58 +01:00
Bernhard Schussek
c01419d856 Merge remote branch 'johnwards/renderer_tests' into renderer-tests-merge 2011-03-23 21:13:36 +01:00
Bernhard Schussek
08a09240f6 [Form] Fixed order of input and output timezone to a more natural one 2011-03-23 17:12:04 +01:00
Bernhard Schussek
a880f8d0d1 [Form] Fixed coding conventions 2011-03-23 16:14:53 +01:00
Bernhard Schussek
9e025440ca Merge remote branch 'johnwards/configuration' into configurable-merge 2011-03-23 16:05:16 +01:00
John Wards
1a014d130e [Form] Tests for Renderer Plugins 2011-03-22 22:19:51 +00:00
John Wards
2e750f7287 [Form] Coding conventions 2011-03-22 21:02:02 +00:00
John Wards
ef8113c50f [Form] Base tests for renderers 2011-03-22 20:51:19 +00:00
Bernhard Schussek
ea0e5bb2d6 [Form] Renamed FieldTypeInterface to FormTypeInterface 2011-03-22 12:36:41 +01:00
Bernhard Schussek
270a98e413 [Form] Added support for types that are not registered in the DIC. These are identified by their FQ class name. 2011-03-22 12:33:15 +01:00
John Wards
5a5fdd0529 Merge remote branch 'bernhard/experimental' into configuration 2011-03-22 07:43:47 +00:00
Bernhard Schussek
33692eae4a [Form] Renamed Form::isTransformationSuccessful() to isSynchronized(). This method now indicates whether the data in the different representations is synchronized. Moved 'invalid' error to DefaultValidator 2011-03-22 02:03:22 +01:00
Bernhard Schussek
16d65f6f16 [Form] Moved previously skipped tests from FormTypeTest to FormTest and fixed them 2011-03-22 01:40:02 +01:00
Bernhard Schussek
577e106361 [Form] Implemented custom mapping of data errors to form fields 2011-03-22 01:15:48 +01:00
John Wards
b4406f254d [Form] Removing Configurable from DataTransformers 2011-03-21 23:01:10 +00:00
John Wards
27267e8007 [Form] Refactoring tests for new DataTransfomer 2011-03-21 21:46:20 +00:00
Bernhard Schussek
87665bc380 [Form] Decoupled FormBuilder from CSRF protection 2011-03-21 22:41:19 +01:00
Bernhard Schussek
c1abf08d9c [Form] Implemented error bubbling 2011-03-21 22:13:02 +01:00
Bernhard Schussek
01a47457d0 [Form] Improved naming of various interfaces. Renamed DefaultRenderer to ThemeRenderer 2011-03-21 20:57:38 +01:00
Bernhard Schussek
321d40b21a [Form] Decoupled FormBuilder from ThemeInterface 2011-03-21 20:46:43 +01:00
Bernhard Schussek
4989e965cd [Form] Moved form type tests into according namespace 2011-03-20 15:45:09 +01:00
Bernhard Schussek
119866e06d [Form] Renamed FormBuilder::getInstance() to getForm() 2011-03-20 15:17:25 +01:00
Bernhard Schussek
2dbb41714a [Form] Merged Field and Form. Merged FieldBuilder and FormBuilder. After the refactoring, the distinction between the two concepts is small enough to merge them 2011-03-20 13:35:19 +01:00
Bernhard Schussek
fc7281bcab [Form] Extracted validation logic of form. Fields can now contain multiple validators 2011-03-20 12:00:19 +01:00
Bernhard Schussek
cb599f417e [Form] Renamed field option 'disabled' to 'read_only'. How to render read-only fields is now the responsibility of the renderer 2011-03-20 10:35:16 +01:00
Bernhard Schussek
295d01745b [Form] Renamed StripTagsFilter to StripTagsListener until we have better conventions 2011-03-20 10:26:38 +01:00
Bernhard Schussek
2c6c89d898 Merge remote branch 'beberlei/forms' into beberlei-merge 2011-03-20 10:15:59 +01:00
Benjamin Eberlei
b43318ee3e [Form] Add tests for untested classes. 2011-03-19 22:03:49 +01:00
Benjamin Eberlei
d62213662e Merge branch 'experimental' of git://github.com/bschussek/symfony into forms 2011-03-19 20:36:56 +01:00
Benjamin Eberlei
864a3ec45f [Form] Add StripTagsFilter EventListener 2011-03-19 20:36:49 +01:00
Bernhard Schussek
6793bcd698 [Form] Removed magic from method signature of add() 2011-03-19 19:20:55 +01:00
Bernhard Schussek
c4b7a77ece Merge remote branch 'beberlei/forms' into beberlei-merge
Conflicts:
	src/Symfony/Component/Form/Type/Loader/DefaultTypeLoader.php
2011-03-19 19:01:57 +01:00
Benjamin Eberlei
39c2d3f166 [Form] Add PhpTheme that relies on no Template Engine, generalize tests to use for PhpTheme and PhpEngineTheme. Fixed some bugs 2011-03-19 17:47:18 +01:00
Bernhard Schussek
43a24fa931 [Form] Renamed events to match terminology in Field 2011-03-19 16:59:23 +01:00
Bernhard Schussek
7f9284105d [Form] Moved namespace FieldGuesser to Type\Guesser 2011-03-19 16:46:03 +01:00
Bernhard Schussek
6bc79a1a12 [Form] Renamed different kinds of data transformers within a field for better clarity 2011-03-18 16:59:34 +01:00
Bernhard Schussek
2a1e394352 [Form] Renamed field configs to types. Everywhere else, we are referring to the name of the type as 'type' now (was 'identifier') 2011-03-18 16:20:00 +01:00
Bernhard Schussek
0b929ee342 [Form] Renamed ValueTransformers to DataTransformers to fit with DataMapper and DataValidator 2011-03-18 16:01:06 +01:00
Bernhard Schussek
97d0183d84 [Form] Moved properties propertyPath, modifyByReference, validationGroups and virtual to generic attributes because they are specific to the used data validator/mapper implementations 2011-03-18 15:26:02 +01:00
Bernhard Schussek
700c96e7fa [Form] Moved FieldFactoryTest to FormFactoryTest and fixed it 2011-03-18 14:37:54 +01:00
Bernhard Schussek
9caaf0f3a3 [Form] Introduced FieldBuilder for field/form creation and made Field/Form mostly immutable 2011-03-18 12:50:26 +01:00
Bernhard Schussek
3f70f89339 Merge remote branch 'symfony/master' into experimental
Conflicts:
	src/Symfony/Bundle/FrameworkBundle/Debug/TraceableEventDispatcher.php
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
	src/Symfony/Component/HttpFoundation/File/UploadedFile.php
2011-03-18 10:39:40 +01:00
Kris Wallsmith
0a229947a6 [Form] updated tests for changes in HttpFoundation 2011-03-17 16:09:12 -07:00
Bernhard Schussek
a51321c264 [Form] Moved validation logic to ValidationListener 2011-03-17 21:47:12 +01:00
Bernhard Schussek
0799662361 [Form] Extracted data mapping logic from Form into ObjectMapperListener 2011-03-17 21:23:59 +01:00
Bernhard Schussek
7a63b840f3 [Form] Renamed submit() to bind() 2011-03-17 14:55:26 +01:00
Bernhard Schussek
5bfd02bcd0 [Form] Renamed bind() to bindRequest(). It is now semantically the same as in symfony1 again 2011-03-17 14:51:22 +01:00
Bernhard Schussek
ffa5bd264a [Form] Moved logic of Field::isMultipart() to rendering layer 2011-03-17 14:40:34 +01:00
Bernhard Schussek
50ce0d53a0 [Form] Removed FieldInterface::getDisplayedData(). Use getTransformedData() instead 2011-03-17 14:28:59 +01:00
Bernhard Schussek
f0d841ef8c [Form] Fixed DateTimeToArrayTransformer when transforming empty values and the option 'fields' is set 2011-03-17 14:27:10 +01:00
Bernhard Schussek
cb283d3783 [Form] Renamed 'key' to 'name'. Removed setKey() totally. 2011-03-17 11:03:10 +01:00
Bernhard Schussek
e85aab2dc1 [Form] Changed form to use the new EventDispatcher implementation 2011-03-16 18:20:13 +01:00
Bernhard Schussek
fb8efaba67 [Form] Fixed a couple of failing tests 2011-03-16 16:13:06 +01:00
Bernhard Schussek
0bf566310c Merge branch 'event-manager' into experimental
Conflicts:
	src/Symfony/Component/Form/BirthdayField.php
	src/Symfony/Component/Form/CheckboxField.php
	src/Symfony/Component/Form/ChoiceField.php
	src/Symfony/Component/Form/ChoiceList/TimeZoneChoiceList.php
	src/Symfony/Component/Form/CollectionField.php
	src/Symfony/Component/Form/DateField.php
	src/Symfony/Component/Form/DateTimeField.php
	src/Symfony/Component/Form/EntityChoiceField.php
	src/Symfony/Component/Form/Events.php
	src/Symfony/Component/Form/FieldFactory/FieldFactory.php
	src/Symfony/Component/Form/FieldFactory/FieldFactoryInterface.php
	src/Symfony/Component/Form/FileField.php
	src/Symfony/Component/Form/Filters.php
	src/Symfony/Component/Form/FormContext.php
	src/Symfony/Component/Form/FormContextInterface.php
	src/Symfony/Component/Form/FormFactoryInterface.php
	src/Symfony/Component/Form/HybridField.php
	src/Symfony/Component/Form/IntegerField.php
	src/Symfony/Component/Form/LanguageField.php
	src/Symfony/Component/Form/LocaleField.php
	src/Symfony/Component/Form/MoneyField.php
	src/Symfony/Component/Form/NumberField.php
	src/Symfony/Component/Form/PasswordField.php
	src/Symfony/Component/Form/PercentField.php
	src/Symfony/Component/Form/RepeatedField.php
	src/Symfony/Component/Form/TextField.php
	src/Symfony/Component/Form/TimeField.php
	src/Symfony/Component/Form/ToggleField.php
	src/Symfony/Component/Form/UrlField.php
	src/Symfony/Component/HttpFoundation/File/UploadedFile.php
	tests/Symfony/Tests/Component/Form/FileFieldTest.php
	tests/Symfony/Tests/Component/Form/FormContextTest.php
	tests/Symfony/Tests/Component/Form/HiddenFieldTest.php
2011-03-13 21:04:24 +01:00
Jordi Boggiano
991b1ed225 [HttpFoundation] UploadedFile::getOriginalName is now overriding getName 2011-03-09 17:26:08 +01:00
Jordi Boggiano
88cfc4c011 [Form] Add exception for missing enctype attribute 2011-03-09 17:23:21 +01:00
Fabien Potencier
8c423edfef replaced symfony-project.org by symfony.com 2011-03-06 12:40:06 +01:00
Bernhard Schussek
5705f74bd0 [Form] Refactored FieldFactory and moved new implementation into the DIC. FormTest fails now. 2011-03-02 14:58:19 +01:00
Bernhard Schussek
8a6246bd06 [Form] Refactored contents of FormFactory into individual FieldConfig classes 2011-03-02 12:20:30 +01:00
Bernhard Schussek
9eff64dd54 [Form] Added EventListener implementation and moved CollectionField to factory 2011-03-01 15:18:55 +01:00
Bernhard Schussek
528ef55da6 [Form] Implemented generic data filter hooks
You can now modify set or bound data by adding a filter for either of the following events:

* Filters::filterBoundDataFromClient
* Filters::filterBoundData
* Filters::filterSetData
2011-03-01 14:19:28 +01:00
Bernhard Schussek
c1edf116f2 [Form] Removed notion of "hidden" fields
Instead, hidden fields now override the "row" template to not include a label or errors.

The "rest" (former "hidden") helper has been adapted to output any fields that were not
rendered manually. It should usually be called at the end of a form.
2011-02-28 17:01:11 +01:00
Bernhard Schussek
02d2121dcd [Form] Improved rendering
Fields are not available in the templates anymore. Instead, all required information can be
accessed through view variables.

Example usage of helpers and variables in a form theme:

// use the label helper
{{ this.label('my label') }}

// use the label variable
{{ this.vars.label }}
{{ label }}

Example usage of helpers and variables in a normal template:

// use the label helper
{{ field.label('my label') }}

// use the label variable
{{ field.vars.label }}
2011-02-28 16:50:23 +01:00
Bernhard Schussek
e334c4734e [Form] Registered FormFactory in the DIC 2011-02-24 21:27:44 +01:00
Bernhard Schussek
f2c1976da6 [Form] Refactored FileField to FormFactory and fixed file upload mechanism 2011-02-24 20:47:48 +01:00
Bernhard Schussek
848ec01f02 [Form] Refactored RepeatedField to FormFactory 2011-02-24 16:54:34 +01:00
Bernhard Schussek
0f8a413221 [Form] Fixed EntityChoiceFieldTest 2011-02-24 16:26:57 +01:00
Bernhard Schussek
acc5c76f77 [Form] Fixed failing DateFieldTest and TimeFieldTest 2011-02-24 16:19:59 +01:00
Bernhard Schussek
e3e8c29875 Merge branch 'bugfix' into experimental
Conflicts:
	src/Symfony/Component/Form/EntityChoiceField.php
	src/Symfony/Component/Form/Field.php
	src/Symfony/Component/Form/HybridField.php
	tests/Symfony/Tests/Component/Form/FieldTest.php
	tests/Symfony/Tests/Component/Form/FormTest.php
2011-02-24 13:17:53 +01:00
Bernhard Schussek
87e6cbf8f0 [Form] Fixed: PropertyPath always requires arrays or objects. Forms now always store arrays or objects as transformed data, even when they were bound empty 2011-02-24 12:22:00 +01:00
Bernhard Schussek
0e75891f25 [Form] Fixed DateTimeToLocalizedStringTransformerTest 2011-02-24 10:05:35 +01:00
Bernhard Schussek
8e2d0bae90 [Form] Ported DateTimeField to FormFactory 2011-02-23 23:34:25 +01:00
Bernhard Schussek
b5671c1be0 [Form] Implemented ArrayToPartsTransformer and ValueToDuplicatesTransformer 2011-02-23 22:30:15 +01:00
Bernhard Schussek
ac5440f8d4 [Form] DateTimeToArrayTransformer does not accept partially filled arrays anymore. Replaces DateField::isPartiallyFilled() and TimeField::isPartiallyFilled() 2011-02-23 21:17:20 +01:00
Bernhard Schussek
a40e2dd77b [Form] Deleted obsolete Field classes, ported some more to FormFactory and fixed lots of failing tests 2011-02-23 14:11:18 +01:00
Bernhard Schussek
7492873186 [Form] Fixed a couple of unit tests, refactored PasswordField to FormFactory 2011-02-23 14:11:18 +01:00
Bernhard Schussek
fee0885256 [Form] Moved options from Field and Form to FormFactory. Tests fail now 2011-02-23 14:11:18 +01:00
Bernhard Schussek
7a48c0a5c5 [Form] Refactored logic from ChoiceField into ChoicePlugin and SelectMultipleNamePlugin 2011-02-23 14:11:18 +01:00
Bernhard Schussek
f7dc71ef59 [Form] Refactored id and name generation to renderer plugins 2011-02-23 14:11:17 +01:00
Bernhard Schussek
813ec54fa1 [Form] Refactored parts of the choice fields into ChoiceList instances 2011-02-23 14:11:17 +01:00
Bernhard Schussek
9569262635 [Form] Fixed date handling classes to use server timezone by default 2011-02-16 23:05:22 +01:00
Bernhard Schussek
0a260b96fb [Form] Fixed error handling in DateTimeToArrayTransformer 2011-02-16 23:05:22 +01:00
Bernhard Schussek
df011ed1ef [Form] Fixed isXXXWithinRange() methods in TimeField and DateField to ignore empty dropdowns 2011-02-16 23:05:22 +01:00
Bernhard Schussek
14c3518c6e [Form] Fixed: If a DateField or TimeField is displayed with select boxes, either all or no select box must have a value selected 2011-02-16 23:05:22 +01:00
Bernhard Schussek
40acc6ac79 [Form] Fixed ChoiceField::isChoiceSelected() to differentiate between zero and empty 2011-02-16 23:05:21 +01:00
Bernhard Schussek
1593d6f75d [Form] Added method FieldInterface::isEmpty() 2011-02-16 23:05:21 +01:00
Bernhard Schussek
7dbc09ed8b [Form] Fixed reference handling in forms. Sometimes data wasn't written into the domain object, resulting in failed validation. 2011-02-15 21:39:32 +01:00
Bernhard Schussek
f51dafca3f [Form] Fixed: "data_constructor" option is used even if "data_class" option is not set 2011-02-08 04:14:56 +01:00
Bernhard Schussek
5b95805340 [Form] Added option "data_constructor" to Form. When a Form is initialized with NULL, an object is automatically created using this constructor. If no constructor is given but the option "data_class" is set, an object of that class is created with the default constructor instead. 2011-02-08 04:14:56 +01:00
Bernhard Schussek
09a50c3c55 [Form] Fixed: "by_reference" option is ignored if reading from/writing to an array 2011-02-08 04:14:55 +01:00
Bernhard Schussek
74d0ac82f7 [Form] Cleaned up ValueTransformerInterface
This commit removes CollectionToStringTransformer. Transformers should never change the state of the outside world, otherwise hard-to-track bugs might creap in.

This functionality needs to be implemented as a custom FieldType (see EntityChoiceField).
2011-02-06 19:46:29 +01:00
Bernhard Schussek
bd3e6c6b49 [Form] Fixed: Form::bind() throws an exception if form is anonymous 2011-02-06 19:46:28 +01:00
Bernhard Schussek
6ff4120784 [Form] Added Form option "by_reference" so that objects received from parent forms are modified by reference when this option is true (the default)
The implication is that set<Reference>() in the object of the parent form will not be called (and thus not has to be implemented/public).

If you want to suppress this behaviour, manually set "by_reference" to false.
2011-02-06 19:46:28 +01:00
Bernhard Schussek
2276b98fc1 [Form] Fixed: ChoiceFields never validated 2011-02-04 11:30:49 +01:00
Bernhard Schussek
a725415440 [Form] Fixed RepeatedField not to trigger NotNull/NotBlank errors if any of the fields was filled in 2011-02-03 13:28:29 +01:00
Bernhard Schussek
39c148197f [Form] Fixed form validation
Separated validation of data and form had serious drawbacks. When a form had nested form whose data was not connected to the data of the root form, this data would not be validated.

The new implementation validates the whole object graph at once. Class Form has a new method validateData(), that manually passes the data to the GraphWalker of the Validator and overrides the Default group with the groups set in the form.
2011-02-03 13:21:44 +01:00
Bernhard Schussek
50955a3919 [Validator] Fixed PropertyPath to read array indices with special characters 2011-02-03 11:28:51 +01:00
Bernhard Schussek
7c9c7af863 [Form] Fixed arrays not to be passed to the validator 2011-02-02 17:32:24 +01:00