Commit Graph

277 Commits

Author SHA1 Message Date
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
eba602ed1b [Form] Removed dependency from renderer plugins on fields. The field instance is now passed to setUp() instead. 2011-03-17 13:37:27 +01:00
Bernhard Schussek
cb283d3783 [Form] Renamed 'key' to 'name'. Removed setKey() totally. 2011-03-17 11:03:10 +01:00
Bernhard Schussek
caa49aa841 [Form] Moved trimming logic to listener 2011-03-17 10:52:23 +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
9f0f127e6a [Form] fixed typo in XSD path 2011-03-09 02:34:51 +01:00
Fabien Potencier
8c423edfef replaced symfony-project.org by symfony.com 2011-03-06 12:40:06 +01:00
Bernhard Schussek
4346097ffd [Form] Added TODOs and a tweak 2011-03-04 16:01:50 +01:00
Bernhard Schussek
bfbc1121ce [Form] Added ArrayAccess to DefaultRenderer 2011-03-02 22:56:20 +01:00
Bernhard Schussek
0f8cd43ac4 [Form] The TwigTheme now accepts several templates 2011-03-02 16:24:22 +01:00
Bernhard Schussek
e53c688a6b [Form] Fixed RepeatedField, improved structure of the Twig templates 2011-03-02 16:00:31 +01:00
Bernhard Schussek
ea49621034 [Form] Fixed CSRF protection 2011-03-02 15:01:04 +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
68013f4db2 Merge remote branch 'symfony/master' into experimental 2011-03-02 12:27:30 +01:00
Bernhard Schussek
8a6246bd06 [Form] Refactored contents of FormFactory into individual FieldConfig classes 2011-03-02 12:20:30 +01:00
Pascal Borreli
f3a0b3fd83 [Form] Fixed Typo 2011-03-01 18:58:08 +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
Fabien Potencier
37178fed01 Merge remote branch 'lewinski/radio-infinite-recursion-fix'
* lewinski/radio-infinite-recursion-fix:
  [Form] Fix infinite recursion in RadioField->getName()
2011-02-27 22:35:57 +01:00
Fabien Potencier
cdf6851eb3 fixed merge 2011-02-27 21:16:13 +01:00
Christophe Coevoet
92bfbf575c Fixed CS 2011-02-27 20:56:29 +01:00
Pascal Borreli
03f91ff1e0 [Form] Removed useless else 2011-02-27 18:36:37 +01:00
Pascal Borreli
ddd6d93f9f [Form] Fixed typo 2011-02-26 20:02:06 +01:00
Bernhard Schussek
adbf2cb2bf [Form] Added ArrayAccess interface to DefaultRenderer 2011-02-25 01:11:53 +01:00
Bernhard Schussek
c6e9fd97b6 [Form] Fixed various bugs 2011-02-25 00:09:10 +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
87b417889c [Form] Fixed DateTimeFieldTest 2011-02-24 16:34:29 +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
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
5a2404a1d6 [Form] Removed deprecated fields 2011-02-23 21:23:14 +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
78b26c2cc5 [Form] Renamed type 'raw' to 'array' in date and time field 2011-02-23 21:05:33 +01:00
Bernhard Schussek
c8275c5b27 [Form] Refactored PercentField to FormFactory 2011-02-23 15:26:01 +01:00
Bernhard Schussek
68bb3ff606 [Form] Used ValuePlugin to pass displayed data to template. The order of added renderer plugins and set renderer variables is now respected 2011-02-23 14:11:18 +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
ce432e939d [Form] Changed notion of 'parameter' to 'var' in the renderer. Merged vars and attributes into single array 2011-02-23 14:11:18 +01:00
Bernhard Schussek
2b8ca25d01 [Form] Refactored NumberField, IntegerField, HiddenField and MoneyField to FormFactory 2011-02-23 14:11:18 +01:00
Bernhard Schussek
af8a093b00 [Form] Refactored CountryField, LanguageField, LocaleField and BirthdayField to FormFactory 2011-02-23 14:11:18 +01:00
Bernhard Schussek
9394ffdea1 [Form] Started to refactor TimeField to FormFactory::getTimeField(). Validation logic is still missing. 2011-02-23 14:11:18 +01:00
Bernhard Schussek
975b8ebe9b [Form] Started to refactor DateField to FormFactory::getDateField(). Validation logic is still missing. 2011-02-23 14:11:18 +01:00
Bernhard Schussek
b148a2a7ed [Form] Refactored ChoiceField to FormFactory::getChoiceField() 2011-02-23 14:11:18 +01:00
Bernhard Schussek
6edff6b8a9 [Form] Moved submission logic of ChoiceField to preprocessor 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
61ea51d858 [Form] Added first version of FormFactory, ValuePlugin and ParentNamePlugin 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
861ff957e7 [Form] Refactored DateField pattern, fixed maxlength in TextField 2011-02-23 14:11:17 +01:00
Bernhard Schussek
ed68fd66a9 [Form] Improved the renderer implementation, added concepts of plugins and themes 2011-02-23 14:11:17 +01:00
Bernhard Schussek
6cc0a58edc [Form] Refactored casting logic from IntegerField to IntegerToLocalizedStringTransformer 2011-02-23 14:11:17 +01:00
Bernhard Schussek
27e1e5251c [Form] Experimentally refactored Twig rendering support to Form component 2011-02-23 14:11:17 +01:00
Bernhard Schussek
ea1ae46c17 [Form] Added CallbackTransformer for dynamic value transformation 2011-02-23 14:11:17 +01:00
Bernhard Schussek
5eb5cc5743 [Form] Refactored date and time field choices into ChoiceList classes 2011-02-23 14:11:17 +01:00
Bernhard Schussek
f39d8b62f2 [Form] Refactored EntityChoiceField::processData() into individual class 2011-02-23 14:11:17 +01:00
Bernhard Schussek
12c131fc24 [Form] Refactored transformation logic of the choice fields into standalone value transformers 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
Matthew Lewinski
4f54aacfc7 [Form] Fix infinite recursion in RadioField->getName() 2011-02-22 20:38:29 -06:00
Fabien Potencier
f54cedfe5e added LICENSE files for the subtree repositories 2011-02-22 18:58:15 +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
f589304fe3 [Form] Added clearer error message for CSRF errors 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
Jordi Boggiano
6a7d6843ae [Form] Removed unnecessary code 2011-02-09 15:49:05 +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
59bf50bf41 [Form] Disabled by reference handling for arrays 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
Lukas Kahwe Smith
dd71501f54 some fixes by just "blindly" trying to make phpStorm code analysis happier 2011-02-04 19:30: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
eb918ac86d [Form] Fixed prototype option in CollectionField 2011-02-02 17:52:58 +01:00
Bernhard Schussek
7c9c7af863 [Form] Fixed arrays not to be passed to the validator 2011-02-02 17:32:24 +01:00
Bernhard Schussek
5e3fab214e [Form] The form is now validated seperatedly from its data. The form is validated in group "Default", the data in the group set in option "validation_groups" 2011-02-02 15:25:05 +01:00
Bernhard Schussek
c923af2879 [Form] Adapted constructor of CollectionField to match the constructors of the other fields. The field prototype is now optional. 2011-02-02 14:46:33 +01:00
Bernhard Schussek
265cdd148f [Form] Removed unused property from Field 2011-02-02 14:46:33 +01:00
Bernhard Schussek
4f0283a508 [Form] Removed Form::isBound(). Form::bind() is only a shortcut method now, use Form::isSubmitted() if you want to find out whether a form was submitted. 2011-02-02 14:46:33 +01:00
Bernhard Schussek
628a4d1fd8 [Form] Refactored validation logic into validate() method. Removed bindGlobals() to reduce API clutter 2011-02-02 14:46:33 +01:00
Thomas
e6dc155e89 fix validator class metadata warning 2011-02-02 11:37:41 +01:00