Commit Graph

1984 Commits

Author SHA1 Message Date
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
Bulat Shakirzyanov
d1cd442361 [FrameworkBundle] added session listener for test environment 2011-01-30 20:13:29 +01:00
Fabien Potencier
b1448ecdc7 [HttpFoundation] fixed typo 2011-01-30 20:13:00 +01:00
Fabien Potencier
b7a0f71b87 [FrameworkBundle] added more file to the class cache when using the PHP templating engine 2011-01-30 14:37:22 +01:00
Fabien Potencier
4e877a84ad [FrameworkBundle] fixed router:apache-dump command 2011-01-30 11:37:38 +01:00
Fabien Potencier
0c439e2c64 updated bootstrap.php 2011-01-30 11:07:12 +01:00
Fabien Potencier
3686edf769 [ClassLoader] made a small optimization 2011-01-30 10:53:57 +01:00
Fabien Potencier
ee3d03ee8a [HttpFoundation] made Request::create() overridable 2011-01-30 10:53:45 +01:00
Jordi Boggiano
571c984625 [Validator] Skip tests that rely on Doctrine being present if its not 2011-01-30 09:18:18 +01:00
Fabien Potencier
e081e5919e reverted changes to the adaptive cache loader cache 2011-01-29 17:58:40 +01:00
Victor Berchet
5e5b6f0cf8 [HttpKernel] made sure that parent bundles are registered before their descendants 2011-01-29 16:38:06 +01:00
Dominique Bongiraud
996c2b0914 [HttpFoundation] Moved licence 2011-01-29 16:12:10 +01:00
Fabien Potencier
55f38e10af [HttpKernel] simplified code 2011-01-29 15:36:57 +01:00
Fabien Potencier
5f11e49d0b [HttpKernel] made exceptions more robust (avoid too deep nested arrays PHP errors) 2011-01-29 15:31:46 +01:00
Fabien Potencier
dacb25f13a updated bootstrap.php 2011-01-29 15:20:21 +01:00
Fabien Potencier
025e142dd4 removed parameter converters as decided during IRC meeting (supported is still provided by FrameworkExtraBundle)
You must remove the configuration element if you had enabled the feature:

         <app:param-converter />
2011-01-29 15:04:28 +01:00
Johannes Schmitt
36e30e21cd [Security] some tests 2011-01-29 14:51:13 +01:00
Fabien Potencier
faf871990e fixed CS 2011-01-29 12:21:55 +01:00
Miha Vrhovnik
6ee13a6b8d Added optional parameter bundleName,
added namespace validation,
fixed dir trailing / handling
2011-01-29 12:18:44 +01:00
Fabien Potencier
8ac1a189bf [HttpKernel] removed unnecessary code 2011-01-29 12:18:16 +01:00
Johannes M. Schmitt
f2a3135bd0 [Security] made a unique name required for each firewall 2011-01-29 10:22:27 +01:00
Lukas Kahwe Smith
2539da5e6a [Security] added AbstractFactory 2011-01-29 10:22:27 +01:00
Johannes M. Schmitt
3ac4994507 [Security] added missing argument to SwitchUserListener 2011-01-29 10:22:27 +01:00
Johannes M. Schmitt
8a879531bd [Security] added key normalization, and removed some conditionals 2011-01-29 10:22:27 +01:00
Johannes M. Schmitt
af696f6a65 [Security] allow custom logout handlers to be configured 2011-01-29 10:22:26 +01:00
Johannes M. Schmitt
e23f39c42f [Security] config refactoring 2011-01-29 10:22:26 +01:00
Victor Berchet
65eb70d3b6 [Kernel] Tweak bundle management 2011-01-29 10:15:25 +01:00