Commit Graph

435 Commits

Author SHA1 Message Date
Bernhard Schussek
f9e830caa2 [Form] Added hook method preprocessData() to FieldGroup 2010-11-23 06:51:13 +01:00
Bernhard Schussek
e0d6aad5f4 [Form][FrameworkBundle][TwigBundle] Introduced class FieldError to wrap form errors 2010-11-19 07:11:29 +01:00
Bernhard Schussek
681ce7f46a [Form] Fixed: FieldGroup::hasErrors() does not return true if only children have errors 2010-11-19 07:11:17 +01:00
Bernhard Schussek
3127312139 [Form] Added option 'value_transformer' and 'normalization_transformer' to Field class 2010-11-16 07:28:33 +01:00
Jordi Boggiano
0bdb271608 [Form] Added parent calls to all configure() methods of Fields and Transformers
The calls that were on top of the function have also been moved to the bottom for safety (see previous commit)
2010-11-16 07:28:12 +01:00
GordonsLondon
23ac47e011 [Form] Added support for __get and __set in PropertyPath 2010-11-16 07:28:07 +01:00
Jordi Boggiano
a198bbcf43 [Form] throw an exception if session_id() is empty when a csrf token is generated 2010-11-12 17:53:29 +01:00
Bernhard Schussek
f5b451f5b9 [Form] Fixed MoneyToLocalizedStringTransformer and added tests 2010-11-12 17:52:56 +01:00
Bernhard Schussek
96a0bff915 [Form] Made InputField instantiable so that simple input fields can be created on the fly 2010-10-22 08:30:14 +02:00
Bernhard Schussek
72dcee594a [Form] Added validiation of hours, minutes and seconds to TimeField 2010-10-22 08:30:14 +02:00
Bernhard Schussek
6c7fab212b [Form] Added validation of years, months and days to DateField 2010-10-22 08:30:13 +02:00
Bernhard Schussek
e4c21708ca [Form] Separated value transformers from normalization transformers.
Fields can now easier support different data types in their underlying object.
These datatypes can be normalized to a single datatype using a normalization
transformer. The normalized value can then be transformed to the user's
representation with the value transformer (better name required?).
2010-10-22 08:30:13 +02:00
Bernhard Schussek
733290c112 [Form] Implemented UrlField 2010-10-22 08:30:13 +02:00
Bernhard Schussek
eaef939141 [Form] Changed value transformers to be responsible for processing empty values to be able to chain them properly. This change fixes the bug that DateField did not return NULL when submitted without values 2010-10-22 08:30:13 +02:00
Jeremy Mikola
df9ef79953 [Form] readPropertyPath should return null instead of empty array
When reading the last bit of a property path mapped to a missing array index, the method would initialize the value to an empty array.  This makes sense for cases where readPropertyPath would again be called recursively, but not when the value would be immediately returned (null would be preferable in that case).

For example, we have an object with a property called "options" that's an array of arbitrary key/value pairs.  That "options" property (and getOptions()) maps directly to a FieldGroup within the Form for this object.  That FieldGroup contains multiple TextFields for a few expected keys in the array.  As-is, if those keys were not defined, the default data set for those TextFields could end up being "Array" (string representation of an empty array).  If readPropertyPath instead returns null for this case, the default data would be transformed into an empty string.
2010-10-13 08:17:05 +02:00
Bernhard Schussek
b902cb31d7 [Form] PropertyPath camelizes property names when setting values 2010-10-11 12:52:22 +02:00
Bernhard Schussek
a66d883afd [Form] Removed CSRF setters because they have no effect once CSRF protection is enabled. Re-enable CSRF protection with the desired values instead 2010-10-11 12:52:17 +02:00
Bernhard Schussek
e1be4e9689 [Form] Refactored logic to read and set values from Field to PropertyPath 2010-10-11 12:52:10 +02:00
ornicar
06a6b15e22 [Form] Fix FieldGroup::getHiddenFields, add tests for FieldGroup::getHiddenFields and FieldGroup::getVisibleFields 2010-10-09 14:20:06 +02:00
Benjamin Eberlei
f033fc5578 Refactor ValueTransformers to recieve the original value when reverseTransform() is called. This is required for expensive value transformations for example Doctrine Collections or Proxies to allow access to a value that does not trigger expensive operations (such as database calls) anymore. 2010-10-06 14:16:47 +02:00
Fabien Potencier
2525998f6e replaced form field rendering with plain templates
Documentation available here:

http://docs.symfony-reloaded.org/master/guides/form/
2010-10-05 08:34:33 +02:00
Brandon Turner
bda264bb81 [Form] Removed invalid unit test
The bind() method only accepts arrays - passing objects causes an exception
2010-09-27 17:54:43 +02:00
Brandon Turner
953a81372a [Form] fixed typo in unit test 2010-09-25 07:57:58 +02:00
Brandon Turner
c3b89eeedd [Form] fixed failing unit test due 2010-09-25 07:57:57 +02:00
Brandon Turner
a305eb063d [Form] added support for rounding-mode option on NumberFields 2010-09-25 07:57:57 +02:00
Brandon Turner
2052501634 [Form] fixed missing locale setting in unit tests 2010-09-25 07:57:57 +02:00
Jeremy Mikola
57c0ce0ec1 [Form] Remove support for ArrayObject as ChoiceField's choices option
Internally, ChoiceField expects both choices and preferred_choices to be a simple array, so I replaced incomplete bits of code that attempted to not modify a possible ArrayObject and instead added type checks in the configure() method (with unit tests for expected exceptions).
2010-09-10 19:30:59 +02:00
Jeremy Mikola
fb24b291c8 [Form] FieldGroup::addError() can now map errors to fields within nested FieldGroups
Property paths such as fields[group].fields[innerGroup].data were not being resolved correctly, since the second iteration of addError() (based on "group") would attempt to call get('fields') instead of get('innerGroup').  Solution is to remember to bump the propertyPath forward if we're at the fields property
2010-09-09 16:29:38 -04:00
Jeremy Mikola
9be7cbb115 [Form] CollectionField::setData() should remove old fields missing from new data 2010-09-09 16:27:18 -04:00
Jeremy Mikola
9f5469f62d [Form] Test case for binding a collection of field groups with an ArrayObject of objects. 2010-09-09 16:11:31 -04:00
Jeremy Mikola
b3648b219b [Form] Fixed testBindSingleExpanded (was testing multiple, non-expanded) 2010-09-09 16:08:45 -04:00
Jeremy Mikola
e52cf7afe0 [Form] ChoiceField tests for numeric choices 2010-09-09 16:06:55 -04:00
Jeremy Mikola
2b776bf2e8 [Form] ChoiceField test for using ArrayObject as choices option 2010-09-09 16:03:44 -04:00
Fabien Potencier
a141c98917 [HttpFoundation] moved File Component into the HttpFoundation one 2010-09-09 17:01:48 +02:00
Fabien Potencier
bf82cf42dd renamed Symfony\Components to Symfony\Component 2010-08-20 23:09:55 +02:00