This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Fabien Potencier 05842c54b8 merged branch bschussek/issue3354 (PR #3789)
Commits
-------

8329087 [Form] Moved calculation of ChoiceType options to closures
5adec19 [Form] Fixed typos
cb87ccb [Form] Failing test for empty_data option BC break
b733045 [Form] Fixed option support in Form component

Discussion
----------

[Form] Fixed option support in Form component

Bug fix: yes
Feature addition: no
Backwards compatibility break: yes
Symfony2 tests pass: yes
Fixes the following tickets: #3354, #3512, #3685, #3694
Todo: -

![Travis Build Status](https://secure.travis-ci.org/bschussek/symfony.png?branch=issue3354)

This PR also introduces a new helper `DefaultOptions` for solving option graphs. It accepts default options to be defined on various layers of your class hierarchy. These options can then be merged with the options passed by the user. This is called *resolving*.

The important feature of this utility is that it lets you define *lazy options*. Lazy options are specified using closures that are evaluated when resolving and thus have access to the resolved values of other (potentially lazy) options. The class detects cyclic option dependencies and fails with an exception in this case.

For more information, check the inline documentation of the `DefaultOptions` class and the UPGRADE file.

@fabpot: Might this be worth a separate component? (in total the utility consists of five classes with two associated tests)

---------------------------------------------------------------------------

by beberlei at 2012-04-05T08:54:10Z

"The important feature of this utility is that it lets you define lazy options. Lazy options are specified using closures"

What about options that are closures? are those differentiated?

---------------------------------------------------------------------------

by bschussek at 2012-04-05T08:57:35Z

@beberlei Yes. Closures for lazy options receive a Symfony\Component\Form\Options instance as first argument. All other closures are interpreted as normal values.

---------------------------------------------------------------------------

by stof at 2012-04-05T11:09:49Z

I'm wondering if these classes should go in the Config component. My issue with it is that it would add a required dependency to the Config component and that the Config component mixes many different things in it already (the loader part, the resource part, the definition part...)

---------------------------------------------------------------------------

by sstok at 2012-04-06T13:36:36Z

Sharing the Options class would be great, and its more then one class so why not give it its own Component folder?
Filesystem is just one class, and that has its own folder.

Great job on the class bschussek 👏

---------------------------------------------------------------------------

by bschussek at 2012-04-10T12:32:34Z

@fabpot Any input?

---------------------------------------------------------------------------

by bschussek at 2012-04-10T13:54:13Z

@fabpot Apart from the decision about the final location of DefaultOptions et al., could you merge this soon? This would make my work a bit easier since this one is a blocker.

---------------------------------------------------------------------------

by fabpot at 2012-04-10T18:08:18Z

@bschussek: Can you rebase on master? I will merge afterwards. Thanks.
2012-04-11 17:03:28 +02:00
src/Symfony merged branch bschussek/issue3354 (PR #3789) 2012-04-11 17:03:28 +02:00
.gitignore added composer.lock to .gitignore 2012-04-06 22:15:14 -03:00
.travis.yml also test PHP 5.3.2, since this is the official lowest supported PHP version 2011-12-26 01:15:21 +01:00
CHANGELOG-2.0.md updated CHANGELOG for 2.0.12 2012-03-19 00:56:33 +01:00
CHANGELOG-2.1.md [Form] Fixed option support in Form component 2012-04-11 16:37:42 +02:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.0.12 2012-03-19 00:57:27 +01:00
LICENSE Updated LICENSE files copyright 2012-02-22 10:10:37 +01:00
README.md set travis-ci icon to master 2011-11-23 11:36:09 +01:00
UPGRADE-2.1.md merged branch bschussek/issue3354 (PR #3789) 2012-04-11 17:03:28 +02:00
autoload.php.dist Changed the test autoloading to use the new autoloader 2012-04-01 23:50:54 +02:00
check_cs moved component and bridge unit tests to the src/ directory 2012-03-29 08:37:22 +02:00
composer.json fixed typos in composer file 2012-03-15 11:15:25 +01:00
phpunit.xml.dist moved component and bridge unit tests to the src/ directory 2012-03-29 08:37:22 +02:00
vendors.php updated license blocks 2012-03-31 18:00:32 -03:00

README.md

README

Build Status

What is Symfony2?

Symfony2 is a PHP 5.3 full-stack web framework. It is written with speed and flexibility in mind. It allows developers to build better and easy to maintain websites with PHP.

Symfony can be used to develop all kind of websites, from your personal blog to high traffic ones like Dailymotion or Yahoo! Answers.

Requirements

Symfony2 is only supported on PHP 5.3.2 and up.

Installation

The best way to install Symfony2 is to download the Symfony Standard Edition available at http://symfony.com/download.

Documentation

The "Quick Tour" tutorial gives you a first feeling of the framework. If, like us, you think that Symfony2 can help speed up your development and take the quality of your work to the next level, read the official Symfony2 documentation.

Contributing

Symfony2 is an open source, community-driven project. If you'd like to contribute, please read the Contributing Code part of the documentation. If you're submitting a pull request, please follow the guidelines in the Submitting a Patch section.