Commit Graph

130 Commits

Author SHA1 Message Date
Victor Berchet
2a8f2d2bfa [Form] fix and add some phpDoc 2011-05-10 15:33:02 +02:00
Kris Wallsmith
f3b077a0dd [Form] removed a bunch of unused use statements 2011-05-06 14:07:16 -07:00
Pascal Borreli
8c0beea677 [Phpdoc] Cleaning/fixing 2011-04-23 15:18:47 +00: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
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
fa457b1cc4 [Form] Renamed 'filter' listeners to 'on' to match naming conventions across the framework 2011-04-15 10:57:32 +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
Fabien Potencier
49dc836521 [Form] moved the template context creation to the Form class
Moving the template context creation makes sense and allows for simpler code for the end user:

Before:

        return array('post' => $post, 'form' => $this->get('form.factory')->createTemplateContext($form));

After:

        return array('post' => $post, 'form' => $form->getContext());
2011-04-13 09:31:13 +02:00
Fabien Potencier
dfa1da0416 [Form] removed unused use statement and fixed phpdoc 2011-04-07 09:00:01 +02:00
Bernhard Schussek
3482ff73b7 [Form] Fixed empty value in choice fields 2011-04-06 15:59:09 +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
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
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
c864d7fae1 [Form] Improved test coverage of Form class 2011-03-31 15:23:33 +02:00
Bernhard Schussek
1fa004ceb2 [Form] Simplified the interface names of the Renderer subnamespace 2011-03-27 23:39:01 +02:00
Bernhard Schussek
4ec6ba8674 [Form] Fixed: set data is treated as string except if a transformer is set 2011-03-27 23:09:46 +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
b180319371 [Form] Moved creation of empty data to Form to clean up DataMapperInterface 2011-03-27 15:12:35 +02:00
Bernhard Schussek
c786fac303 [Form] Sample fix implementation of renderers 2011-03-26 16:03:34 +01:00
Bernhard Schussek
3c412ffba0 [Form] Moved Form::validateData() to DelegatingValidator::validateFormData() 2011-03-25 01:59:28 +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
15d5259eb8 [Form] Forms now remember the types used during their construction 2011-03-24 16:16:31 +01: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
577e106361 [Form] Implemented custom mapping of data errors to form fields 2011-03-22 01:15:48 +01:00
Bernhard Schussek
c1abf08d9c [Form] Implemented error bubbling 2011-03-21 22:13:02 +01:00
Bernhard Schussek
3985522b9b [Form] Removed obsolete classes Error and DataError 2011-03-21 21:19:31 +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
acaa9c9058 [Form] Fixed signature of Form::addError() 2011-03-20 15:23:36 +01:00
Bernhard Schussek
6c9ff0a2a3 [Form] Improved naming of data conversion methods in Form and made them private 2011-03-20 15:22:37 +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
a1c3d21d0e [Form] Added comment 2011-03-19 19:56:18 +01:00
Bernhard Schussek
e9cb19721a [Form] Optimized code in Form to remove one event listener 2011-03-19 19:53:39 +01:00
Bernhard Schussek
65353bd81e [Form] Fixed failing choice field tests 2011-03-19 18:22:08 +01:00
Bernhard Schussek
43a24fa931 [Form] Renamed events to match terminology in Field 2011-03-19 16:59:23 +01:00
Bernhard Schussek
0259d4da1e [Form] Moved namespace DataValidator to Validator 2011-03-19 16:54:07 +01:00
Bernhard Schussek
d2210a2e79 [Form] Removed unused Form::isCsrfTokenValid() 2011-03-19 15:09:11 +01:00
Bernhard Schussek
3e17b26105 [Form] Moved CSRF protection into separate field 2011-03-19 15:06:54 +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
0b929ee342 [Form] Renamed ValueTransformers to DataTransformers to fit with DataMapper and DataValidator 2011-03-18 16:01:06 +01:00
Bernhard Schussek
f86ecec403 [Form] Extracted data validation logic into DataValidatorInterface 2011-03-18 15:58:22 +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
4cb76c0045 [Form] Moved error distribution logic to validation listener 2011-03-18 13:07:06 +01:00