Commit Graph

515 Commits

Author SHA1 Message Date
Jordi Boggiano
f5f41696ec [Serializer] Allow for more flexible element names 2011-02-13 17:47:22 +01:00
Jordi Boggiano
8216a6ef3d [Serializer] Added XmlEncoder::setRootNodeName 2011-02-13 17:47:22 +01:00
Johannes M. Schmitt
d4d2d60f7b [DependencyInjection] minor interface change 2011-02-13 10:38:10 +01:00
Christophe Coevoet
cb0fa406aa Added unit tests 2011-02-12 21:56:22 +01:00
Fabian Vogler
9bf845bc51 Test for SimpleXML encode 2011-02-12 21:54:27 +01:00
Johannes Schmitt
19bbafc441 [Security] Refactored security context, moved getUser() implementation to templating 2011-02-12 21:53:04 +01:00
Johannes Schmitt
66fbbd6b17 [Security] removed __toString() from AccountInterface 2011-02-12 21:53:04 +01:00
hhamon
beaaa6d457 [BrowserKit] fix Response::__toString() method to take care of multiple headers, for example when setting more than one cookie. 2011-02-12 21:52:33 +01:00
Kris Wallsmith
36ff9abe67 [Console] fixed new ArgvInput method 2011-02-12 21:51:34 +01:00
Jordi Boggiano
5bf593353f [Routing] Added optional trailing slash support to ApacheMatcherDumper 2011-02-10 23:46:23 +01:00
Jordi Boggiano
2ed0b975f1 [Routing] Added tests for PhpMatcherDumper changes 2011-02-10 23:46:23 +01:00
Fabien Potencier
b91f082be5 Revert "moved Resource to the Config component"
This reverts commit f53080860a.

Revert "[Router] config fixes"

This reverts commit 51beecc6f2.

Revert "moved duplicated files to a new Config component"

This reverts commit a8ec9b27f0.
2011-02-10 16:14:12 +01:00
Fabien Potencier
f53080860a moved Resource to the Config component 2011-02-10 16:07:42 +01:00
Fabien Potencier
a8ec9b27f0 moved duplicated files to a new Config component 2011-02-10 03:43:36 +01:00
Fabien Potencier
e58a84eb09 added a FileLocator to DIC so that we can load resources like @BundleName/Resources/... 2011-02-10 00:44:02 +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
Kris Wallsmith
ef43b22546 [HttpFoundation] fixed test cleanup 2011-02-08 04:14:39 +01:00
pborreli
41bf849a63 [HttpFoundation] Request coverage 2011-02-07 02:49:14 +01:00
Marc Weistroff
bebdcb242d [HttpKernel] Added response cache-control modification if page is composed of ESIs.
Rules are :
- If one of the ESI has validation cache strategy, the whole page will be
forced to validate.
- In none of the ESI has validation, the response will feature a Cache-Control
directive with s-maxage value equals to the smallest TTL of ESIs.
2011-02-07 01:34:14 +01:00
pborreli
7ad4f99153 [HttpFoundation] File/UploadedFile, MimeTest, Exception full coverage 2011-02-06 21:53:36 +01:00
Johannes M. Schmitt
2b256a0804 [DependencyInjection] allow null for scalar nodes 2011-02-06 20:50:03 +01:00
Johannes M. Schmitt
c7ef8d98d6 [DependencyInjection] append new elements for prototype nodes without a key attribute 2011-02-06 20:11:08 +01:00
Johannes Schmitt
0b8fef2347 [Security/DependencyInjection] adds support for merging security configurations
The merging is done in three steps:

    1. Normalization:
    =================
    All passed config arrays will be transformed into the same structure
    regardless of what format they come from.

    2. Merging:
    ===========
    This is the step when the actual merging is performed. Starting at the root
    the configs will be passed along the tree until a node has no children, or
    the merging of sub-paths of the current node has been specifically disabled.

       Left-Side       Right-Side      Merge Result
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       -nothing-       array           Right-Side will be taken.
       scalar          scalar          Right-Side will be taken.
       array           false           Right-Side will be taken if ->canBeUnset()
                                       was called on the array node.
       false           array           Right-Side will be taken.
       array           array           Each value in the array will be passed to
                                       the specific child node, or the prototype
                                       node (whatever is present).

    3. Finalization:
    ================
    The normalized, and merged config will be passed through the config tree to
    perform final validation on the submitted values, and set default values
    where this has been requested.

You can influence this process in various ways, here is a list with some examples.
All of these methods must be called on the node on which they should be applied.

  * isRequired(): Node must be present in at least one config file.
  * requiresAtLeastOneElement(): PrototypeNode must have at least one element.
  * treatNullLike($value): Replaces null with $value during normalization.
  * treatTrueLike($value): Same as above just for true
  * treatFalseLike($value): Same as above just for false
  * defaultValue($value): Sets a default value for this node (only for scalars)
  * addDefaultsIfNotSet(): Whether to add default values of an array which has not
                           been defined in any configuration file.
  * disallowNewKeysInSubsequentConfigs(): All keys for this array must be defined
                                          in one configuration file, subsequent
                                          configurations may only overwrite these.
  * fixXmlConfig($key, $plural = null): Transforms XML config into same structure
                                        as YAML, and PHP configurations.
  * useAttributeAsKey($name): Defines which XML attribute to use as array key.
  * cannotBeOverwritten(): Declares a certain sub-path as non-overwritable. All
                           configuration for this path must be defined in the same
                           configuration file.
  * cannotBeEmpty(): If value is set, it must be non-empty.
  * canBeUnset(): If array values should be unset if false is specified.

Architecture:
=============
The configuration consists basically out of two different sets of classes.

  1. Builder classes: These classes provide the fluent interface and
                      are used to construct the config tree.

  2. Node classes: These classes contain the actual logic for normalization,
                   merging, and finalizing configurations.

After you have added all the metadata to your builders, the call to
->buildTree() will convert this metadata to actual node classes. Most of the
time, you will not have to interact with the config nodes directly, but will
delegate this to the Processor class which will call the respective methods
on the config node classes.
2011-02-06 20:11:08 +01:00
ornicar
c5fb96b86b [HttpKernel] Add more unit tests for Kernel 2011-02-06 20:05:49 +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
ornicar
9ba2943aff [HttpKernel] Add unit tests for Kernel. Also slightly modify Kernel to make it more testable. 2011-02-06 16:17:35 +01:00
John Kary
c251a36935 [HttpFoundation] Add tests for Cookie 2011-02-06 16:16:05 +01:00
ornicar
bd97471954 [HttpKernel] Add test coverage for cache warming 2011-02-05 23:54:09 +01:00
pborreli
f56a6efbf5 [HttpFoundation] File/File full coverage 2011-02-05 23:24:00 +01:00
Fabien Potencier
e5403490e7 removed the need to define getNamespace() and getPath() in bundles 2011-02-05 22:40:30 +01:00
Jeremy Mikola
743f25a287 [DependencyInjection] Create explicit factoryClass property for Definitions
Previously, the Definition class was used both for type inference and factory construction (if factoryService was absent). This is fine for cases where classes create instances of themselves (e.g. getInstance() or create()), but leads to ambiguity when we have a separate factory class.
2011-02-05 20:39:42 +01:00
ornicar
575b75a9df [DependencyInjection] Fix fixture class loaded twice during dumper tests 2011-02-05 20:27:47 +01:00
Fabien Potencier
199e6bf893 [BrowserKit] removed annotation in a unit test to fix coverage 2011-02-05 16:02:59 +01:00
Martijn Evers
1e3dc1479c [Testing][HttpKernel] Added possibility to functional test raw body data 2011-02-04 13:07:13 +01:00
Victor Berchet
3ed47114d6 [Bundle] Make getPath() less error prone by allowing both backward and forward slashes 2011-02-04 12:12:19 +01:00
Bernhard Schussek
2276b98fc1 [Form] Fixed: ChoiceFields never validated 2011-02-04 11:30:49 +01:00
Daniel Holmes
f4282eea98 [Routing] added support for non-standard port numbers in absolute urls 2011-02-04 00:25:25 +01:00
Fabien Potencier
b6f400a2bc [DependencyInjection] made an optimization on dumped DIC
When dumping a Container, and if it is frozen, we use a plain
PHP array for parameters instead of a ParameterBag.
2011-02-04 00:17:51 +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
1a34743990 [Validator] Fixed: Collections annotated with @Valid may contain scalar values. These values are ignored by the GraphWalker 2011-02-03 13:21:37 +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
5ed4d91bb8 [Validator] Implemented Execute constraint 2011-02-03 11:00:03 +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