Commit Graph

2160 Commits

Author SHA1 Message Date
Bernhard Schussek 50955a3919 [Validator] Fixed PropertyPath to read array indices with special characters 2011-02-03 11:28:51 +01:00
Bernhard Schussek 55a97ec78e [Validator] Made GraphWalker::validateReference() method public 2011-02-03 11:00:03 +01:00
Bernhard Schussek 5ed4d91bb8 [Validator] Implemented Execute constraint 2011-02-03 11:00:03 +01:00
Benjamin Eberlei d8e03ac782 [DoctrineBundle] Add support to setting the Annotations prefix to @orm: for EntityGeneration beginning with Doctrine ORM 2.0.2-DEV. 2011-02-03 05:38:58 +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
Penny Leach 1c3e3f7744 [Form] Removed required="required" from hidden fields to make them HTML5 compliant 2011-02-02 15:51:17 +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
Fabien Potencier a204e0df7f [TwigBundle] added previous exception when possible 2011-02-02 14:41:03 +01:00
Daniel Holmes f217022ad5 [TwigBundle] fixed Twig template throwing InvalidArgumentException rather than returning false 2011-02-02 14:38:43 +01:00
Fabien Potencier 5288381f61 Revert "[Security] Missing Event namespace in SwitchUserListener"
This reverts commit 0169892dcd.
2011-02-02 14:35:29 +01:00
Thomas e6dc155e89 fix validator class metadata warning 2011-02-02 11:37:41 +01:00
Christophe Coevoet de401fd94c [DoctrineBundle] Fixed doctrine:generate:entities help message 2011-02-02 11:34:47 +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
Jeremy Mikola 0169892dcd [Security] Missing Event namespace in SwitchUserListener 2011-02-02 11:32:56 +01:00
Johannes M. Schmitt 2b697423b4 [Security] bug fix in FormAuthenticationEntryPoint 2011-02-02 11:31:28 +01:00
Sebastian Utz 4d5853866a [Security] fixed a Token serialization bug 2011-02-02 11:31:28 +01:00
Johannes M. Schmitt fbc21fedf7 [Security] some bug fixes 2011-02-02 11:31:28 +01:00
Thomas 7b9b90809a fix variable name 2011-02-02 11:30:30 +01:00
Fabien Potencier 1893e4e250 [DoctrineMongoDBBundle] fixed merge problem 2011-02-01 16:51:54 +01:00
Johannes Schmitt b484763a7a [DependencyInjection] added first version of the config normalizer
This is mainly intended for complex configurations to ease the work you
have with normalizing different configuration formats (YAML, XML, and PHP).

First, you have to set-up a config tree:

    $treeBuilder = new TreeBuilder();
    $tree = $treeBuilder
        ->root('security_config', 'array')
            ->node('access_denied_url', 'scalar')->end()
            ->normalize('encoder')
            ->node('encoders', 'array')
                ->key('class')
                ->prototype('array')
                    ->before()->ifString()->then(function($v) { return array('algorithm' => $v); })->end()
                    ->node('algorithm', 'scalar')->end()
                    ->node('encode_as_base64', 'scalar')->end()
                    ->node('iterations', 'scalar')->end()
                ->end()
            ->end()
        ->end()
        ->buildTree()
    ;

This tree and the metadata attached to the different nodes is then used
to intelligently transform the passed config array:

    $normalizedConfig = $tree->normalize($config);
2011-02-01 16:07:04 +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
Lukas Kahwe Smith 46d900682f is_scalar(null) !== true 2011-02-01 13:55:10 +01:00
Fabien Potencier 2889e91c27 [DoctrineMongoDBBundle] fixed unit tests 2011-02-01 13:35:39 +01:00
Victor Berchet cb445b9ca0 [Container] Tweak code 2011-02-01 13:21:10 +01:00
Bulat Shakirzyanov 132e5805b3 [DoctrineMongoDBBundle] fixed annotations ns conflict, switched to @mongodb:Unique annotation 2011-02-01 13:19:37 +01:00
Bernhard Schussek 22c12e2c8f [HttpFoundation] Fixed failing tests introduced in 8dd0c5641a 2011-01-31 15:38:13 +01:00
Fabien Potencier 2c4355460e [HttpKernel] added a StoreInterface 2011-01-31 14:15:12 +01:00
Fabien Potencier 1babf3c7a1 [FrameworkBundle] added a safeguard for infinite loops on some Windows configurations 2011-01-31 08:54:05 +01:00
Fabien Potencier 839cb027a6 [HttpKernel] added a bootstrap file for HTTP cache front controllers 2011-01-31 08:30:32 +01:00
Fabien Potencier b52e28243d [HttpFoundation] added ApacheRequest 2011-01-31 08:28:55 +01:00
Fabien Potencier 8dd0c5641a [HttpFoundation] made small optimizations 2011-01-31 08:26:40 +01:00
Damien Alexandre 56483dc14f The ControlerResolver service as been moved in http_kernel 2011-01-30 20:17:31 +01:00
Victor Berchet f470c5605e [Request] Fix getting mime type 2011-01-30 20:14:40 +01:00