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 2cf50b7801 merged branch Tobion/requirementscheck (PR #5187)
Commits
-------

3363832 extended phpdoc of ConfigurableRequirementsInterface
5f64503 [Routing] added test for disabled requirements check
4225869 [Routing] allow disabling the requirements check on URL generation

Discussion
----------

[Routing] allow disabling the requirements check on URL generation

This adds the possibility to disable the requirements check (`strict_requirements = null`) on URL generation.

To sum up, here the possibilities:
- `strict_requirements = true`: throw exception for mismatching requirements (most useful in development environment).
- `strict_requirements = false`: don't throw exception but return null as URL for mismatching requirements and log it (useful when you cannot control all params because they come from third party libs or something but don't want to have a 404 in production environment. it logs the mismatch so you can review it).
- `strict_requirements = null`: Return the URL with the given parameters without checking the requirements at all. When generating an URL you should either trust your params or you validated them beforehand because otherwise it would break your link anyway (just as with strict_requirements=false). So in production environment you should know that params allways pass the requirements. Thus you could disable the check on each URL generation for performance reasons. If you have 300 links on a page and each URL at least one param you safe 300 unneeded `preg_match` calls. I tested the performance in one of my projects. The rendering time of a single template that contains ~300 links with several params was reduced from avg. 46ms to avg. 42ms. That are 8.7% reduction in the twig layer where the links are created on each request. So this option combines the improved usability of strict_requirements=false with an additional increased performance.

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

by fabpot at 2012-08-30T13:40:38Z

Can you put the comment about all the possibilities you have mentioned here in the phpdoc for future reference? Thanks.

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

by Tobion at 2012-08-30T13:49:25Z

In `ConfigurableRequirementsInterface` or which phpdoc would you like to have it? Because `ConfigurableRequirementsInterface` already has it explained. But I can extend its description if thats what you mean.

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

by fabpot at 2012-08-30T13:50:40Z

The comment in the PR is more explicit and more detailed than the one in the interface. So, yes, basically, it would be great if you can move all the information in the interface phpdoc.

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

by Tobion at 2012-08-30T14:35:59Z

Done.
2012-08-30 16:40:08 +02:00
src/Symfony extended phpdoc of ConfigurableRequirementsInterface 2012-08-30 16:35:30 +02:00
.editorconfig Add EditorConfig File 2012-06-16 14:08:15 +02:00
.gitignore ignore composer.phar 2012-04-20 14:10:06 +01:00
.travis.yml [Locale] don't create a "current" directory anymore, uses only the ICU version as the name of the data directory 2012-08-07 12:17:02 -03:00
autoload.php.dist removed unneeded code 2012-06-30 16:47:41 +02:00
CHANGELOG-2.0.md updated CHANGELOG for 2.0.17 2012-08-28 09:03:49 +02:00
composer.json Update monolog compatibility 2012-08-19 09:57:44 +02:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.0.14 2012-05-17 18:30:22 +02:00
LICENSE Updated LICENSE files copyright 2012-02-22 10:10:37 +01:00
phpunit.xml.dist Set init.default_locale to 'en' in phpunit.xml.dist 2012-05-11 09:33:42 +02:00
README.md added some warnings about known PHP bugs 2012-07-15 12:19:52 +02:00
UPGRADE-2.1.md added note about 404 error pages 2012-08-22 19:38:06 +02:00

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.3 and up.

Be warned that PHP versions before 5.3.8 are known to be buggy and might not work for you:

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.