diff --git a/.travis.yml b/.travis.yml index cb5f0ac5f248a..8a87800c5f3cb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,5 +10,3 @@ before_script: - echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini - sh -c 'if [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;' - COMPOSER_ROOT_VERSION=dev-master composer --prefer-source --dev install - - php src/Symfony/Component/Locale/Resources/data/build-data.php - - export USE_INTL_ICU_DATA_VERSION=1 diff --git a/CHANGELOG-2.2.md b/CHANGELOG-2.2.md index 09f759562470d..2c7a93f0045de 100644 --- a/CHANGELOG-2.2.md +++ b/CHANGELOG-2.2.md @@ -128,7 +128,7 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c * 2.2.1 (2013-04-06) * 751abe1: Doctrine cannot handle bare random non-utf8 strings - * 673fd9b: idAsIndex should be true with a smallint or bigint id field. + * 673fd9b: idAsIndex should be true with a smallint or bigint id field. * 64a1d39: Fixed long multibyte parameter logging in DbalLogger:startQuery * 4cf06c1: Keep the file extension in the temporary copy and test that it exists (closes #7482) * 64ac34d: [Security] fixed wrong interface @@ -150,7 +150,7 @@ To get the diff between two versions, go to https://github.com/symfony/symfony/c * 6575df6: [Security] use current request attributes to generate redirect url? * 7216cb0: [Validator] fix showing wrong max file size for upload errors * c423f16: [2.1][TwigBridge] Fixes Issue #7342 in TwigBridge - * 7d87ecd: [FrameworkBundle] fixed cahe:clear command's warmup + * 7d87ecd: [FrameworkBundle] fixed cache:clear command's warmup * 5ad4bd1: [TwigBridge] now enter/leave scope on Twig_Node_Module * fe4cc24: [TwigBridge] fixed fixed scope & trans_default_domain node visitor * fc47589: [BrowserKit] added ability to ignored malformed set-cookie header diff --git a/CHANGELOG-2.3.md b/CHANGELOG-2.3.md new file mode 100644 index 0000000000000..db170b4f9a068 --- /dev/null +++ b/CHANGELOG-2.3.md @@ -0,0 +1,133 @@ +CHANGELOG for 2.3.x +=================== + +This changelog references the relevant changes (bug and security fixes) done +in 2.3 minor versions. + +To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash +To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1 + +* 2.3.3 (2013-08-07) + + * c35cc5b: added trusted hosts check + * 6d555bc: Fixed metadata serialization + * cd51d82: [Form] fixed wrong call to setTimeZone() (closes #8644) + * 5c359a8: Fix issue with \DateTimeZone::UTC / 'UTC' for PHP 5.4 + * 85330a6: [Form] Fixed patched forms to be valid even if children are not submitted + * cb5e765: [Form] Fixed: If a form is not present in a request, it is not automatically submitted + * 97cbb19: [Form] Removed the "disabled" attribute from the placeholder option in select fields due to problems with the BlackBerry 10 browser + * c138304: [routing] added ability for apache matcher to handle array values + * 1bd45b3: [FrameworkBundle] fixed regression where the command might have the wrong container if the application is reused several times + * b41cf82: [Validator] fixed StaticMethodLoader trying to invoke methods of abstract classes (closes #8589) + * e5fba3c: [Form] fixes empty file-inputs get treated as extra field + * 3553c71: return 0 if there is no valid data + * 50d0727: [DependencyInjection] fixed regression where setting a service to null did not trigger a re-creation of the service when getting it + * dc1fff0: The ignoreAttributes itself should be ignored, too. + * ae7fa11: [Twig] fixed TwigEngine::exists() method when a template contains a syntax error (closes #8546) + * 28e0709: [Validator] fixed ConstraintViolation:: incorrect when nested + * 890934d: handle Optional and Required constraints from XML or YAML sources correctly + * a2eca45: Fixed #8455: PhpExecutableFinder::find() does not always return the correct binary + * 485d53a: [DependencyInjection] Fix Container::camelize to convert beginning and ending chars + * 2317443: [Security] fixed issue where authentication listeners clear unrelated tokens + * 2ebb783: fix issue #8499 modelChoiceList call getPrimaryKey on a non object + * 242b318: [DependencyInjection] Add exception for service name not dumpable in PHP + * d3eb9b7: [Validator] Fixed groups argument misplace for validateValue method from validator class + +* 2.3.2 (2013-07-17) + + * bb59f40: Reverts JSON_NUMERIC_CHECK + * 9c5f8c6: [Yaml] removed wrong comment removal inside a string block + * 2dc1ee0: [HtppKernel] fixed inline fragment renderer + * 06b69b8: fixed inline fragment renderer + * 91bb757: ProgressHelper shows percentage complete. + * 9d1004b: fix handling of a default 'template' as a string + * 82dbaee: [HttpKernel] fixed the inline renderer when passing objects as attributes (closes #7124) + * 8bb4e4d: [DI] Fixed bug requesting non existing service from dumped frozen container + * 6dbd1e1: [WebProfiler] fix content-type parameter + * a830001: Passed the config when building the Configuration in ConfigurableExtension + * c875d0a: [Form] fixed INF usage which does not work on Solaris (closes #8246) + * ab1439e: [Console] Fixed the table rendering with multi-byte strings. + * c0da3ae: [Process] Disable exception on stream_select timeout + * 77f2aa8: [HttpFoundation] fixed issue with session_regenerate_id (closes #7380) + * bcbbb28: Throw exception if value is passed to VALUE_NONE input, long syntax + * 6b71513: fixed date type format pattern regex + * b5ded81: [Security] fixed usage of the salt for the bcrypt encoder (refs #8210) + * 842f3fa: do not re-register commands each time a Console\Application is run + * 0991cd0: [Process] moved env check to the Process class (refs #8227) + * 8764944: fix issue where $_ENV contains array vals + * 4139936: [DomCrawler] Fix handling file:// without a host + * e65723c: fix-progressbar-start + * aa79393: also consider alias in Container::has() + * de289d2: [Form] corrected interface bind() method defined against in deprecation notice + * 0c0a3e9: [Console] fixed regression when calling a command foo:bar if there is another one like foo:bar:baz (closes #8245) + * 849f3ed: [Finder] Fix SplFileInfo::getContents isn't working with ssh2 protocol + * 6d2135b: force the Content-Type to html in the web profiler controllers + +* 2.3.1 (2013-06-11) + + * 25e3abd: fix many-to-many Propel1 ModelChoiceList + * bce6bd2: [DomCrawler] Fixed a fatal error when setting a value in a malformed field name. + * e3561ce: [FrameworkBundle] Fixed OutOfBoundException when session handler_id is null + * 81b122d: [DependencyInjection] Add support for aliases of aliases + regression test + * 445b2e3: [Console] fix status code when Exception::getCode returns something like 0.1 + * bbfde62: Fixed exit code for exceptions with error code 0 + * d8c0ef7: [DependencyInjection] Rename ContainerBuilder::$aliases to avoid conflicting with the parent class + * bb797ee: [DependencyInjection] Remove get*Alias*Service methods from compiled containers + * 379f5e0: [DependencyInjection] Fix aliased access of shared services, fixes #8096 + * afad9c7: instantiate valid commands only + +* 2.3.0 (2013-06-03) + + * e93fc7a: [FrameworkBundle] set the dispatcher in the console application + * 2038329: [Form] [Validator] Fixed post_max_size = 0 bug (Issue #8065) + * 554ab9f: [Console] renamed ConsoleForExceptionEvent into ConsoleExceptionEvent + * fd151fd: [Security] Fixed the check if an interface exists. + * c8e5503: [FrameworkBundle] removed HttpFoundation classes from HttpKernel cache + * 169c0b9: [Finder] Fix iteration fails with non-rewindable streams + * 45b68e0: [Finder] Fix unexpected duplicate sub path related AppendIterator issue + * 13ba4ea: fix logger in regards to DebugLoggerInterface + * 97b38ed: Added type of return value in VoterInterface. + * 79a842a: [Console] Add namespace support back in to list command + * 5321600: Fixed two bugs in HttpCache + * 435012f: [Config] Adding the previous exception message into the FileLoaderLoadException so it's more easily seen + * 5c317b7: [Console] fix and refactor exit code handling + * 1469953: [CssSelector] Fix :nth-last-child() translation + * 2d9027d: [CssSelector] Fix :nth-last-child() translation + * 91b8490: Fix Crawler::children() to not trigger a notice for childless node + +* 2.3.0-RC1 (2013-05-16) + + * 95f356b: remove check for PHP bug #50731 + * 8f54da7: [BrowserKit] should not follow redirects if status code is not 30x + * f41ac06: changed all version deps to accepts all upcoming Symfony versions + * a4e3ebf: [DomCrawler] Fixed the Crawler::html() method for PHP versions earlier than 5.3.6. + * 3beaf52: [Security] Disabled the BCryptPasswordEncoder tests for PHP versions lower than 5.3.7. + +* 2.3.0-BETA2 (2013-05-10) + + * 97bee20: Pass exceptions from the ExceptionListener to Monolog + * be42dbc: [HttpFoundation][File][UploadedFile] Fix guessClientExtension() method + * a5441b2: Fixed parsing of leading blank lines in folded scalars. Closes #7989. + * e8d5d16: Fixed Loader import + * bd0c48c: [Console] moved the IO configuration to its own method + * fdb4b1f: [Console] moved --help support to allow proper behavior with other passed options + * dd0e138: Eased translationNodeVisitor overriding in TranslationExtension + * 853f681: fixed request scope issues (refs #7457) + * 60edc58: Fixed fatal error in normalize/denormalizeObject. + * 78e3710: ProxyManager Bridge + * 41805c0: [Crawler] Add proper validation of node argument of method add + * 7933971: [Form] Added radio button for empty value to expanded single-choice fields + * 0586c7e: made some optimization when parsing YAML files + * 1856df3: [Security] fixed wrong merge (refs #4776) + * 5b7e1e6: added a missing check for the provider key + * f1c2ab7: [DependencyInjection] Add a method map to avoid computing method names from service names + * ea633f5: [HttpKernel] Avoid updating the context if the request did not change + * 997d549: [HttpFoundation] Avoid a few unnecessary str_replace() calls + * f5e7f24: [HttpFoundation] Optimize ServerBag::getHeaders() + * 59b78c7: [Validator] Fixed: $traverse and $deep is passed to the visitor from Validator::validate() + * bcb5400: [Form] Fixed transform()/reverseTransform() to always throw TransformationFailedExceptions + * 7b2ebbf: [Form] Fixed: String validation groups are never interpreted as callbacks + * 0610750: if the repository method returns an array ensure that it's internal poin... + * dcced01: [Form] Improved multi-byte handling of NumberToLocalizedStringTransformer + * 90a20d7: [Translation] Made translation domain defaults in Translator consistent with TranslatorInterface + * 549a308: [Form] Fixed CSRF error messages to be translated and added "csrf_message" option diff --git a/UPGRADE-2.1.md b/UPGRADE-2.1.md index 1f04ffcff6741..ecb2a18af809a 100644 --- a/UPGRADE-2.1.md +++ b/UPGRADE-2.1.md @@ -901,7 +901,7 @@ public function guessPattern($class, $property) { if (/* condition */) { - return new ValueGuess('.{' . $minLength . ',}', Guess::LOW_CONFIDENCE); + return new ValueGuess('.{'.$minLength.',}', Guess::LOW_CONFIDENCE); } } ``` @@ -1189,7 +1189,7 @@ public function isPropertyValid(ExecutionContext $context) { // ... - $propertyPath = $context->getPropertyPath() . '.property'; + $propertyPath = $context->getPropertyPath().'.property'; $context->setPropertyPath($propertyPath); $context->addViolation('Error Message', array(), null); } diff --git a/UPGRADE-2.2.md b/UPGRADE-2.2.md index 524a8f7e1d999..7900a4775bb7f 100644 --- a/UPGRADE-2.2.md +++ b/UPGRADE-2.2.md @@ -21,6 +21,29 @@ Note: The function is the preferred way. +#### Deprecations + + * The `standalone` option is deprecated and will replaced with the `strategy` option in 2.3. + * The values `true`, `false`, `js` for the `standalone` option were deprecated and replaced respectively with the `esi`, `inline`, `hinclude` in 2.3. + + + Before: + + ``` + {% render 'BlogBundle:Post:list' with { 'limit': 2 }, {'standalone': true} %} + {% render 'BlogBundle:Post:list' with { 'limit': 2 }, {'standalone': false} %} + {% render 'BlogBundle:Post:list' with { 'limit': 2 }, {'standalone': 'js'} %} + ``` + + After: + + ``` + {{ render(controller('BlogBundle:Post:list', { 'limit': 2 }), { 'strategy': 'esi'}) }} + {{ render(controller('BlogBundle:Post:list', { 'limit': 2 }), { 'strategy': 'inline'}) }} + {{ render(controller('BlogBundle:Post:list', { 'limit': 2 }), { 'strategy': 'hinclude'}) }} + ``` + + ### HttpFoundation * The MongoDbSessionHandler default field names and timestamp type have changed. @@ -441,7 +464,7 @@ $path .= '.'; } - $context->getGraphWalker()->walkReference($someObject, $group, $path . 'myProperty', false); + $context->getGraphWalker()->walkReference($someObject, $group, $path.'myProperty', false); } } ``` diff --git a/UPGRADE-2.3.md b/UPGRADE-2.3.md new file mode 100644 index 0000000000000..02b36e66f2415 --- /dev/null +++ b/UPGRADE-2.3.md @@ -0,0 +1,279 @@ +UPGRADE FROM 2.2 to 2.3 +======================= + +Form +---- + + * Although this was not officially supported nor documented, it was possible to + set the option "validation_groups" to false, resulting in the group "Default" + being validated. Now, if you set "validation_groups" to false, the validation + of a form will be skipped (except for a few integrity checks on the form). + + If you want to validate a form in group "Default", you should either + explicitly set "validation_groups" to "Default" or alternatively set it to + null. + + Before: + + ``` + // equivalent notations for validating in group "Default" + "validation_groups" => null + "validation_groups" => "Default" + "validation_groups" => false + + // notation for skipping validation + "validation_groups" => array() + ``` + + After: + + ``` + // equivalent notations for validating in group "Default" + "validation_groups" => null + "validation_groups" => "Default" + + // equivalent notations for skipping validation + "validation_groups" => false + "validation_groups" => array() + ``` + * The array type hint from DataMapperInterface was removed. You should adapt + implementations of that interface accordingly. + + Before: + + ``` + use Symfony\Component\Form\DataMapperInterface; + + class MyDataMapper + { + public function mapFormsToData(array $forms, $data) + { + // ... + } + + public function mapDataToForms($data, array $forms) + { + // ... + } + } + ``` + + After: + + ``` + use Symfony\Component\Form\DataMapperInterface; + + class MyDataMapper + { + public function mapFormsToData($forms, $data) + { + // ... + } + + public function mapDataToForms($data, $forms) + { + // ... + } + } + ``` + + Instead of an array, the methods here are now passed a + RecursiveIteratorIterator containing an InheritDataAwareIterator by default, + so you don't need to handle forms inheriting their parent data (former + "virtual forms") in the data mapper anymore. + + Before: + + ``` + use Symfony\Component\Form\Util\VirtualFormAwareIterator; + + public function mapFormsToData(array $forms, $data) + { + $iterator = new \RecursiveIteratorIterator( + new VirtualFormAwareIterator($forms) + ); + + foreach ($iterator as $form) { + // ... + } + } + ``` + + After: + + ``` + public function mapFormsToData($forms, $data) + { + foreach ($forms as $form) { + // ... + } + } + ``` + + * The *_SET_DATA events are now guaranteed to be fired *after* the children + were added by the FormBuilder (unless setData() is called manually). Before, + the *_SET_DATA events were sometimes thrown before adding child forms, + which made it impossible to remove child forms dynamically. + + A consequence of this change is that you need to set the "auto_initialize" + option to `false` for `FormInterface` instances that you pass to + `FormInterface::add()`: + + Before: + + ``` + $form = $factory->create('form'); + $form->add($factory->createNamed('field', 'text')); + ``` + + This code will now throw an exception with the following message: + + Automatic initialization is only supported on root forms. You should set the + "auto_initialize" option to false on the field "field". + + Consequently, you need to set the "auto_initialize" option: + + After (Alternative 1): + + ``` + $form = $factory->create('form'); + $form->add($factory->createNamed('field', 'text', array( + 'auto_initialize' => false, + ))); + ``` + + The problem also disappears if you work with `FormBuilder` instances instead + of `Form` instances: + + After (Alternative 2): + + ``` + $builder = $factory->createBuilder('form'); + $builder->add($factory->createBuilder('field', 'text')); + $form = $builder->getForm(); + ``` + + The best solution is in most cases to let `add()` handle the field creation: + + After (Alternative 3): + + ``` + $form = $factory->create('form'); + $form->add('field', 'text'); + ``` + + After (Alternative 4): + + ``` + $builder = $factory->createBuilder('form'); + $builder->add('field', 'text'); + $form = $builder->getForm(); + ``` + +PropertyAccess +-------------- + + * PropertyAccessor was changed to continue its search for a property or method + even if a non-public match was found. This means that the property "author" + in the following class will now correctly be found: + + ``` + class Article + { + public $author; + + private function getAuthor() + { + // ... + } + } + ``` + + Although this is uncommon, similar cases exist in practice. + + Instead of the PropertyAccessDeniedException that was thrown here, the more + generic NoSuchPropertyException is thrown now if no public property nor + method are found by the PropertyAccessor. PropertyAccessDeniedException was + removed completely. + + Before: + + ``` + use Symfony\Component\PropertyAccess\Exception\PropertyAccessDeniedException; + use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; + + try { + $value = $accessor->getValue($article, 'author'); + } catch (PropertyAccessDeniedException $e) { + // Method/property was found but not public + } catch (NoSuchPropertyException $e) { + // Method/property was not found + } + ``` + + After: + + ``` + use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException; + + try { + $value = $accessor->getValue($article, 'author'); + } catch (NoSuchPropertyException $e) { + // Method/property was not found or not public + } + ``` + +DomCrawler +---------- + + * `Crawler::each()` and `Crawler::reduce()` now return Crawler instances + instead of DomElement instances: + + Before: + + ``` + $data = $crawler->each(function ($node, $i) { + return $node->nodeValue; + }); + ``` + + After: + + ``` + $data = $crawler->each(function ($crawler, $i) { + return $crawler->text(); + }); + ``` + +Console +------- + + * New verbosity levels have been added, therefore if you used to do check + the output verbosity level directly for VERBOSITY_VERBOSE you probably + want to update it to a greater than comparison: + + Before: + + ``` + if (OutputInterface::VERBOSITY_VERBOSE === $output->getVerbosity()) { ... } + ``` + + After: + + ``` + if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { ... } + ``` + +BrowserKit +---------- + + * If you are receiving responses with non-3xx Status Code and Location header + please be aware that you won't be able to use auto-redirects on these kind + of responses. + + If you are correctly passing 3xx Status Code with Location header, you + don't have to worry about the change. + + If you were using responses with Location header and non-3xx Status Code, + you have to update your code to manually create another request to URL + grabbed from the Location header. \ No newline at end of file diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index df10137624312..dd647eaf9ea12 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -3,8 +3,8 @@ UPGRADE FROM 2.x to 3.0 ### ClassLoader - * The `UniversalClassLoader` class has been removed in favor of `ClassLoader`. The only difference is that some method - names are different: + * The `UniversalClassLoader` class has been removed in favor of + `ClassLoader`. The only difference is that some method names are different: * `registerNamespaces()` -> `addPrefixes()` * `registerPrefixes()` -> `addPrefixes()` @@ -18,6 +18,199 @@ UPGRADE FROM 2.x to 3.0 `DebugClassLoader`. The difference is that the constructor now takes a loader to wrap. +### Form + + * The methods `Form::bind()` and `Form::isBound()` were removed. You should + use `Form::submit()` and `Form::isSubmitted()` instead. + + Before: + + ``` + $form->bind(array(...)); + ``` + + After: + + ``` + $form->submit(array(...)); + ``` + + * Passing a `Symfony\Component\HttpFoundation\Request` instance, as was + supported by `FormInterface::bind()`, is not possible with + `FormInterface::submit()` anymore. You should use `FormInterface::handleRequest()` + instead. + + Before: + + ``` + if ('POST' === $request->getMethod()) { + $form->bind($request); + + if ($form->isValid()) { + // ... + } + } + ``` + + After: + + ``` + $form->handleRequest($request); + + if ($form->isValid()) { + // ... + } + ``` + + If you want to test whether the form was submitted separately, you can use + the method `isSubmitted()`: + + ``` + $form->handleRequest($request); + + if ($form->isSubmitted()) { + // ... + + if ($form->isValid()) { + // ... + } + } + ``` + + * The events PRE_BIND, BIND and POST_BIND were renamed to PRE_SUBMIT, SUBMIT + and POST_SUBMIT. + + Before: + + ``` + $builder->addEventListener(FormEvents::PRE_BIND, function (FormEvent $event) { + // ... + }); + ``` + + After: + + ``` + $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) { + // ... + }); + ``` + + * The option "virtual" was renamed to "inherit_data". + + Before: + + ``` + $builder->add('address', 'form', array( + 'virtual' => true, + )); + ``` + + After: + + ``` + $builder->add('address', 'form', array( + 'inherit_data' => true, + )); + ``` + + * The class VirtualFormAwareIterator was renamed to InheritDataAwareIterator. + + Before: + + ``` + use Symfony\Component\Form\Util\VirtualFormAwareIterator; + + $iterator = new VirtualFormAwareIterator($forms); + ``` + + After: + + ``` + use Symfony\Component\Form\Util\InheritDataAwareIterator; + + $iterator = new InheritDataAwareIterator($forms); + ``` + + * The `TypeTestCase` class was moved from the `Symfony\Component\Form\Tests\Extension\Core\Type` namespace to the `Symfony\Component\Form\Test` namespace. + + Before: + + ``` + use Symfony\Component\Form\Tests\Extension\Core\Type\TypeTestCase + + class MyTypeTest extends TypeTestCase + { + // ... + } + ``` + + After: + + ``` + use Symfony\Component\Form\Test\TypeTestCase; + + class MyTypeTest extends TypeTestCase + { + // ... + } + ``` + + * The `FormItegrationTestCase` and `FormPerformanceTestCase` classes were moved form the `Symfony\Component\Form\Tests` namespace to the `Symfony\Component\Form\Test` namespace. + + +### FrameworkBundle + + * The `enctype` method of the `form` helper was removed. You should use the + new method `start` instead. + + Before: + + ``` +
+ ``` + + After: + + ``` + start($form) ?> + ... + end($form) ?> + ``` + + The method and action of the form default to "POST" and the current + document. If you want to change these values, you can set them explicitly in + the controller. + + Alternative 1: + + ``` + $form = $this->createForm('my_form', $formData, array( + 'method' => 'PUT', + 'action' => $this->generateUrl('target_route'), + )); + ``` + + Alternative 2: + + ``` + $form = $this->createFormBuilder($formData) + // ... + ->setMethod('PUT') + ->setAction($this->generateUrl('target_route')) + ->getForm(); + ``` + + It is also possible to override the method and the action in the template: + + ``` + start($form, array('method' => 'GET', 'action' => 'http://example.com')) ?> + ... + end($form) ?> + ``` + ### HttpKernel * The `Symfony\Component\HttpKernel\Log\LoggerInterface` has been removed in @@ -34,9 +227,52 @@ UPGRADE FROM 2.x to 3.0 * `Symfony\Bridge\Monolog\Logger` * `Symfony\Component\HttpKernel\Log\NullLogger` + * The `Symfony\Component\HttpKernel\Kernel::init()` method has been removed. + + * The following classes have been renamed as they have been moved to the + Debug component: + + * `Symfony\Component\HttpKernel\Debug\ErrorHandler` -> `Symfony\Component\Debug\ErrorHandler` + * `Symfony\Component\HttpKernel\Debug\ExceptionHandler` -> `Symfony\Component\Debug\ExceptionHandler` + * `Symfony\Component\HttpKernel\Exception\FatalErrorException` -> `Symfony\Component\Debug\Exception\FatalErrorException` + * `Symfony\Component\HttpKernel\Exception\FlattenException` -> `Symfony\Component\Debug\Exception\FlattenException` + * The `Symfony\Component\HttpKernel\EventListener\ExceptionListener` now passes the Request format as the `_format` argument instead of `format`. +### Locale + + * The Locale component was removed and replaced by the Intl component. + Instead of the methods in `Symfony\Component\Locale\Locale`, you should use + these equivalent methods in `Symfony\Component\Intl\Intl` now: + + * `Locale::getDisplayCountries()` -> `Intl::getRegionBundle()->getCountryNames()` + * `Locale::getCountries()` -> `array_keys(Intl::getRegionBundle()->getCountryNames())` + * `Locale::getDisplayLanguages()` -> `Intl::getLanguageBundle()->getLanguageNames()` + * `Locale::getLanguages()` -> `array_keys(Intl::getLanguageBundle()->getLanguageNames())` + * `Locale::getDisplayLocales()` -> `Intl::getLocaleBundle()->getLocaleNames()` + * `Locale::getLocales()` -> `array_keys(Intl::getLocaleBundle()->getLocaleNames())` + +### PropertyAccess + + * Renamed `PropertyAccess::getPropertyAccessor` to `createPropertyAccessor`. + + Before: + + ``` + use Symfony\Component\PropertyAccess\PropertyAccess; + + $accessor = PropertyAccess::getPropertyAccessor(); + ``` + + After: + + ``` + use Symfony\Component\PropertyAccess\PropertyAccess; + + $accessor = PropertyAccess::createPropertyAccessor(); + ``` + ### Routing * Some route settings have been renamed: @@ -82,10 +318,99 @@ UPGRADE FROM 2.x to 3.0 $route->setSchemes('https'); ``` +### Translator + + * The `Translator::setFallbackLocale()` method has been removed in favor of + `Translator::setFallbackLocales()`. + ### Twig Bridge * The `render` tag is deprecated in favor of the `render` function. + * The `form_enctype` helper was removed. You should use the new `form_start` + function instead. + + Before: + + ``` + + ``` + + After: + + ``` + {{ form_start(form) }} + ... + {{ form_end(form) }} + ``` + + The method and action of the form default to "POST" and the current + document. If you want to change these values, you can set them explicitly in + the controller. + + Alternative 1: + + ``` + $form = $this->createForm('my_form', $formData, array( + 'method' => 'PUT', + 'action' => $this->generateUrl('target_route'), + )); + ``` + + Alternative 2: + + ``` + $form = $this->createFormBuilder($formData) + // ... + ->setMethod('PUT') + ->setAction($this->generateUrl('target_route')) + ->getForm(); + ``` + + It is also possible to override the method and the action in the template: + + ``` + {{ form_start(form, {'method': 'GET', 'action': 'http://example.com'}) }} + ... + {{ form_end(form) }} + ``` + +### Validator + + * The constraints `Optional` and `Required` were moved to the + `Symfony\Component\Validator\Constraints\` namespace. You should adapt + the path wherever you used them. + + Before: + + ``` + use Symfony\Component\Validator\Constraints as Assert; + + /** + * @Assert\Collection({ + * "foo" = @Assert\Collection\Required(), + * "bar" = @Assert\Collection\Optional(), + * }) + */ + private $property; + ``` + + After: + + ``` + use Symfony\Component\Validator\Constraints as Assert; + + /** + * @Assert\Collection({ + * "foo" = @Assert\Required(), + * "bar" = @Assert\Optional(), + * }) + */ + private $property; + ``` + ### Yaml * The ability to pass file names to `Yaml::parse()` has been removed. diff --git a/autoload.php.dist b/autoload.php.dist index 2be61eb189fcf..0bb2bc3a85271 100644 --- a/autoload.php.dist +++ b/autoload.php.dist @@ -10,8 +10,6 @@ $loader = require_once __DIR__.'/vendor/autoload.php'; use Doctrine\Common\Annotations\AnnotationRegistry; -if (!function_exists('intl_get_error_code')) { - require_once __DIR__.'/src/Symfony/Component/Locale/Resources/stubs/functions.php'; -} - AnnotationRegistry::registerLoader(array($loader, 'loadClass')); + +return $loader; diff --git a/composer.json b/composer.json index 24320d448783b..9e2eee3214267 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,7 @@ ], "require": { "php": ">=5.3.3", + "symfony/icu": "~1.0", "doctrine/common": "~2.2", "twig/twig": "~1.11", "psr/log": "~1.0" @@ -28,6 +29,7 @@ "symfony/console": "self.version", "symfony/css-selector": "self.version", "symfony/dependency-injection": "self.version", + "symfony/debug": "self.version", "symfony/doctrine-bridge": "self.version", "symfony/dom-crawler": "self.version", "symfony/event-dispatcher": "self.version", @@ -37,12 +39,14 @@ "symfony/framework-bundle": "self.version", "symfony/http-foundation": "self.version", "symfony/http-kernel": "self.version", + "symfony/intl": "self.version", "symfony/locale": "self.version", "symfony/monolog-bridge": "self.version", "symfony/options-resolver": "self.version", "symfony/process": "self.version", "symfony/propel1-bridge": "self.version", "symfony/property-access": "self.version", + "symfony/proxy-manager-bridge": "self.version", "symfony/routing": "self.version", "symfony/security": "self.version", "symfony/security-bundle": "self.version", @@ -62,19 +66,22 @@ "doctrine/dbal": "~2.2", "doctrine/orm": "~2.2,>=2.2.3", "monolog/monolog": "~1.3", - "propel/propel1": "1.6.*" + "propel/propel1": "1.6.*", + "ircmaxell/password-compat": "1.0.*", + "ocramius/proxy-manager": ">=0.3.1,<0.4-dev" }, "autoload": { "psr-0": { "Symfony\\": "src/" }, "classmap": [ "src/Symfony/Component/HttpFoundation/Resources/stubs", - "src/Symfony/Component/Locale/Resources/stubs" - ] + "src/Symfony/Component/Intl/Resources/stubs" + ], + "files": [ "src/Symfony/Component/Intl/Resources/stubs/functions.php" ] }, "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.3-dev" } } } diff --git a/src/Symfony/Bridge/Doctrine/.gitignore b/src/Symfony/Bridge/Doctrine/.gitignore index 44de97a36a6df..c49a5d8df5c65 100644 --- a/src/Symfony/Bridge/Doctrine/.gitignore +++ b/src/Symfony/Bridge/Doctrine/.gitignore @@ -1,4 +1,3 @@ vendor/ composer.lock phpunit.xml - diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php index 83bb444f34a3a..331a465b2fdba 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php @@ -51,7 +51,10 @@ protected function loadMappingInformation(array $objectManager, ContainerBuilder // automatically register bundle mappings foreach (array_keys($container->getParameter('kernel.bundles')) as $bundle) { if (!isset($objectManager['mappings'][$bundle])) { - $objectManager['mappings'][$bundle] = null; + $objectManager['mappings'][$bundle] = array( + 'mapping' => true, + 'is_bundle' => true, + ); } } } @@ -304,7 +307,7 @@ protected function detectMetadataDriver($dir, ContainerBuilder $container) protected function loadObjectManagerCacheDriver(array $objectManager, ContainerBuilder $container, $cacheName) { $cacheDriver = $objectManager[$cacheName.'_driver']; - $cacheDriverService = $this->getObjectManagerElementName($objectManager['name'] . '_' . $cacheName); + $cacheDriverService = $this->getObjectManagerElementName($objectManager['name'].'_'.$cacheName); switch ($cacheDriver['type']) { case 'service': diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.php index c857ef93c3604..30479c8c01d78 100644 --- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.php +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/DoctrineValidationPass.php @@ -51,21 +51,21 @@ public function process(ContainerBuilder $container) */ private function updateValidatorMappingFiles(ContainerBuilder $container, $mapping, $extension) { - if ( ! $container->hasParameter('validator.mapping.loader.' . $mapping . '_files_loader.mapping_files')) { + if (!$container->hasParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files')) { return; } - $files = $container->getParameter('validator.mapping.loader.' . $mapping . '_files_loader.mapping_files'); - $validationPath = 'Resources/config/validation.' . $this->managerType . '.' . $extension; + $files = $container->getParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files'); + $validationPath = 'Resources/config/validation.'.$this->managerType.'.'.$extension; foreach ($container->getParameter('kernel.bundles') as $bundle) { $reflection = new \ReflectionClass($bundle); - if (is_file($file = dirname($reflection->getFilename()) . '/' . $validationPath)) { + if (is_file($file = dirname($reflection->getFilename()).'/'.$validationPath)) { $files[] = realpath($file); $container->addResource(new FileResource($file)); } } - $container->setParameter('validator.mapping.loader.' . $mapping . '_files_loader.mapping_files', $files); + $container->setParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files', $files); } } diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php new file mode 100644 index 0000000000000..64c187469e1b0 --- /dev/null +++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php @@ -0,0 +1,165 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass; + +use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; + +/** + * Base class for the doctrine bundles to provide a compiler pass class that + * helps to register doctrine mappings. + * + * The compiler pass is meant to register the mappings with the metadata + * chain driver corresponding to one of the object managers. + * + * For concrete implementations that are easy to use, see the + * RegisterXyMappingsPass classes in the DoctrineBundle resp. + * DoctrineMongodbBundle, DoctrineCouchdbBundle and DoctrinePhpcrBundle. + * + * @author David Buchmann