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
7f9284105d
[Form] Moved namespace FieldGuesser to Type\Guesser
2011-03-19 16:46:03 +01:00
Benjamin Eberlei
af60ddf8ad
Moved PhpTheme to FrameworkBundle and renamed to PhpEngineTheme
2011-03-19 15:27:39 +01:00
Benjamin Eberlei
32e1a7c8f9
Merge bschussek/experimental into branch forms.
2011-03-19 15:18:52 +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
Benjamin Eberlei
3e2b8e5f12
Fix some missing use statements and small bugs.
2011-03-19 14:31:25 +01:00
Benjamin Eberlei
bb8c2a9b9d
Rename this to renderer to be able to use it in Php Templating
2011-03-19 11:54:46 +01:00
Benjamin Eberlei
d44e2264ba
Merge branch 'experimental' of git://github.com/bschussek/symfony into forms
2011-03-19 09:36:30 +01:00
Bernhard Schussek
b66b8326a8
[Form] Fixed undefined variable in DefaultRenderer
2011-03-18 17:03:12 +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
1c85daa56b
[Form] Split FieldBuilder into FieldBuilder and FormBuilder to make creation of classes deterministic
2011-03-18 16:34:54 +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
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
700c96e7fa
[Form] Moved FieldFactoryTest to FormFactoryTest and fixed it
2011-03-18 14:37:54 +01:00
Bernhard Schussek
4cb76c0045
[Form] Moved error distribution logic to validation listener
2011-03-18 13:07:06 +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
Benjamin Eberlei
76b0041d1b
[Form] Implemented first PhpTheme attempt
2011-03-17 22:47:19 +01: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
Benjamin Eberlei
3bc825bbd4
Merge branch 'experimental' of git://github.com/bschussek/symfony into forms
2011-03-17 19:05:59 +01:00
Benjamin Eberlei
85b61fe1e2
First attempt of PhpTheme.
2011-03-17 19:05:48 +01:00
Bernhard Schussek
d00f1fa205
[Form] Removed unused method Form::deepArrayUnion()
2011-03-17 15:22:48 +01:00
Bernhard Schussek
8e41cc66fe
[Form] Moved form logic to event listeners
2011-03-17 15:22:10 +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
f2f78890de
[Form] Removed deprecated method preprocessData()
2011-03-17 14:41:26 +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
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
Jeremy Mikola
4e0db56810
[Form] Fix getValidator() to reference the "validator" option instead of property
2011-02-02 11:34:18 +01:00
Fabien Potencier
209dcfefce
[From] fixed phpdoc
2011-02-02 11:34:10 +01:00
Thomas
7b9b90809a
fix variable name
2011-02-02 11:30:30 +01:00
Bernhard Schussek
a28151a8af
[Form] Removed FormFactory and improved the form instantiation process
...
With the form factory there was no reasonable way to implement instantiation of custom form classes. So the implementation was changed to let the classes instantiate themselves. A FormContext instance with default settings has to be passed to the creation method. This context is by default configured in the DI container.
$context = $this->get('form.context');
// or
$context = FormContext::buildDefault();
$form = MyFormClass::create($context, 'author');
If you want to circumvent this process, you can also create a form manually. Remember that the services stored in the default context won't be available then unless you pass them explicitely.
$form = new MyFormClass('author');
2011-02-01 15:27:12 +01:00
Bernhard Schussek
fb1f99137d
[Form] Changed semantics of a "bound" form
...
A form now always has to be bound, independent of whether the request is a POST request or not. The bind() method detects itself whether the request was a post request or not and reads its data accordingly. The "old" bind()/isBound() methods were renamed to submit()/isSubmitted().
$form = new Form('author');
$form->bind($request, $author);
if ($form->isValid()) {
// isValid() implies isSubmitted(), non-submitted forms can
// never be valid
// do something with author now
}
Alternatively, you can only bind global variables, if you don't have a request object.
$form->bindGlobals($author);
Note that the $author object is in both cases optional. You can also pass no object at all and read the data using $form->getData(), but then no validation will occur. You can also prefill the form with an object during instantiation.
$form = new Form('author', array('data' => $author));
$form->bind($request);
// etc.
2011-02-01 15:27:12 +01:00
Bernhard Schussek
e5ed98c324
[Form] Added option 'data' to Field for populating a field with a fixed value
2011-02-01 15:27:12 +01:00
Bernhard Schussek
fdbc064f06
[Form] Removed automatic distribution of the locale in the Form component. This leads to more problems than it solves.
2011-02-01 15:27:12 +01:00
Bernhard Schussek
c468db5c5b
[Form] Merged classes FieldGroup and Form for simplicity
2011-02-01 15:27:12 +01:00
Bernhard Schussek
7680657944
[Form] Form::isPostMaxSizeReached() only triggers for root forms
2011-02-01 15:27:12 +01:00
Bernhard Schussek
4fcb98547c
[Form] Simplified Form::bind(), added convenience methods Form::bindRequest() and Form::bindGlobals()
2011-02-01 15:27:12 +01:00
Bernhard Schussek
57cbd57265
[Form] Fields may now be anonymous, but anonymous fields must not be added to groups. They can only be used as prototypes
2011-02-01 15:27:12 +01:00
Bernhard Schussek
916e599937
[Form] Fixed broken namespace paths
2011-02-01 15:27:12 +01:00
Bernhard Schussek
d152b5e265
[Form] Moved Doctrine2 specific files
2011-02-01 15:27:12 +01:00
Bernhard Schussek
3bf9f7782d
[DoctrineBundle][Form] Implemented EntityFieldFactoryGuesser
2011-02-01 15:27:12 +01:00
Bernhard Schussek
347c069e8d
[DoctrineBundle][Form] Implemented EntityChoiceField
2011-02-01 15:27:12 +01:00
Bernhard Schussek
ebd2ca6cfe
[Form] Moved option 'empty_value' to ChoiceField. An empty value is displayed if the field is not required.
2011-01-28 09:22:06 +01:00
Bernhard Schussek
34865a3533
[Form] Added a field guess for AssertType('\DateTime') constraint
2011-01-28 09:20:58 +01:00
Bernhard Schussek
ce61baf717
[Form] ChoiceField now accepts closures in the 'choices' option
2011-01-28 09:20:41 +01:00
Bernhard Schussek
9e6e95d7e4
[Form] Fixed: required setting in FieldFactory is now properly overridable
2011-01-28 09:20:27 +01:00