From f8edb9fee1268d914e7015546be8dabbfec855e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C5=82odzimierz=20Gajda?= Date: Thu, 5 Jul 2012 06:55:46 +0200 Subject: [PATCH 0001/2078] [Component][Finder] path(), notPath() methods --- components/finder.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/components/finder.rst b/components/finder.rst index 2d6e7fd7fcb..9a93e9633d4 100644 --- a/components/finder.rst +++ b/components/finder.rst @@ -175,6 +175,34 @@ The ``notContains()`` method excludes files containing given pattern:: $finder->files()->notContains('dolor sit amet'); +Path +~~~~ + +.. versionadded:: 2.2 + Methods ``path()`` and ``notPath()`` have been + introduced in version 2.2. + +Restrict files and directories by path with the +:method:`Symfony\\Component\\Finder\\Finder::path` method:: + + $finder->path('some/special/dir'); + +On all platforms slash (i.e. ``/``) should be used as a separator. + +The ``path()`` method accepts strings or regexes:: + + $finder->path('foo/bar'); + $finder->path('/^foo\/bar/'); + +Strings are converted into regexes by escaping slashes and adding delimiters: + + dirname ===> /dirname/ + a/b/c ===> /a\/b\/c/ + +The ``notPath()`` method excludes files by path:: + + $finder->notPath('other/dir'); + File Size ~~~~~~~~~ From 7c39d38f01008d2abe9aacf162806d5fce6b5bb0 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Thu, 4 Oct 2012 11:15:37 +0300 Subject: [PATCH 0002/2078] Update book/forms.rst Fix typo (missing ";") in source code sample for dynamic validation groups --- book/forms.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/forms.rst b/book/forms.rst index 20e121ccf7e..21266a9cff2 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -439,7 +439,7 @@ You can also define whole logic inline by using a Closure:: 'validation_groups' => function(FormInterface $form) { $data = $form->getData(); if (Entity\Client::TYPE_PERSON == $data->getType()) { - return array('person') + return array('person'); } else { return array('company'); } From 2524356cfdccd03f4dff15fa1b1866d3e73e0caa Mon Sep 17 00:00:00 2001 From: Johannes Date: Sat, 6 Oct 2012 17:19:47 +0300 Subject: [PATCH 0003/2078] added some doc about optional sections refs symfony/symfony#5688 --- components/config/definition.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/components/config/definition.rst b/components/config/definition.rst index 00b2737ab4e..b7b33b90f52 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -212,6 +212,29 @@ has a certain value: ->end() ; +Optional Sections +----------------- +If you have entire sections which are optional and can be enabled/disabled, +you can take advantage of the shortcut ``canBeEnabled``, or ``canBeDisabled``:: + + $arrayNode + ->canBeEnabled() + ; + + // is equivalent to + + $arrayNode + ->treatFalseLike(array('enabled' => false)) + ->treatTrueLike(array('enabled' => true)) + ->treatNullLike(array('enabled' => true)) + ->children() + ->booleanNode('enabled') + ->defaultFalse() + ; + +``canBeDisabled`` looks about the same with the difference that the section +would be enabled by default. + Merging options --------------- From d0c822186a7c03f3ecdeee262852484cb8e7f208 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 29 Sep 2012 17:40:47 -0500 Subject: [PATCH 0004/2078] [component][console] Initial documentation to support symfony/symfony#3501 --- components/console/introduction.rst | 71 +++++++++++++++++++++++++ images/components/console/progress.png | Bin 0 -> 3365 bytes 2 files changed, 71 insertions(+) create mode 100644 images/components/console/progress.png diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 5638067a572..3eac7b8bfe0 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -251,6 +251,77 @@ if you needed to know the name of something, you might do the following:: $dialog = $this->getHelperSet()->get('dialog'); $name = $dialog->ask($output, 'Please enter the name of the widget', 'foo'); +Displaying a Progress Bar +------------------------- + +.. versionadded:: 2.2 + The ``progress`` helper was added in Symfony 2.2. + +When executing longer-running commands, it may be helpful to to show progress +information, which updates as your command runs: + +.. image:: /images/components/console/progress.png + +To display progress details, use the :class:`Symfony\\Component\\Console\\Helper\\ProgressHelper`, +pass it a total number of units, and advance the progress as your command executes:: + + $progress = $app->getHelperSet()->get('progress'); + + $progress->start($output, 50); + $i = 0; + while ($i++ < 50) { + // do some work + + // advance the progress bar 1 unit + $progress->advance(); + } + + $progress->finish(); + +The appearance of the progress output can be customized as well, with a number +of different levels of verbosity. Each of these displays different possible +items - like percentage completion, a moving progress bar, or current/total +information (e.g. 10/50):: + + $progress->setFormat(ProgressHelper::QUIET); + $progress->setFormat(ProgressHelper::NORMAL); + $progress->setFormat(ProgressHelper::VERBOSE); + $progress->setFormat(ProgressHelper::FORMAT_QUIET_NOMAX); + // the default value + $progress->setFormat(ProgressHelper::FORMAT_NORMAL_NOMAX); + $progress->setFormat(ProgressHelper::FORMAT_VERBOSE_NOMAX); + +You can also control the different characters and the width used for the +progress bar:: + + // the finished part of the bar + $progress->setBarCharacter('='); + // the unfinished part of the bar + $progress->setEmptyBarCharacter(' '); + $progress->setProgressChar('|'); + $progress->setBarWidth(50); + +To see other available options, check the API documentation for +:class:`Symfony\\Component\\Console\\Helper\\ProgressHelper`. + +.. caution:: + + For performance reasons, be careful to not set the total number of steps + to a high number. For example, if you're iterating over a large number + of items, consider a smaller "step" number that updates on only some + iterations:: + + $progress->start($output, 500); + $i = 0; + while ($i++ < 50000) { + // do some work + + // advance every 100 iterations + if ($i % 100 == 0) { + $progress->advance(); + } + } + Testing Commands ---------------- diff --git a/images/components/console/progress.png b/images/components/console/progress.png new file mode 100644 index 0000000000000000000000000000000000000000..c126bff52521efea5a6c88bbb42cda127de824df GIT binary patch literal 3365 zcmV+=4chXFP)EX>4Tx0C?J+Q+HUC_ZB|i_hk=OLfG)Jmu!ImA|tE_$Pihg5Rw34gb)%y#f69p zRumNxoJdu~g4GI0orvO~D7a@qiilc^Ra`jkAKa(4eR}Wh?fcjJyyu+f{LXpL4}cL8 zCXwc%Y5+M>g*-agACFH+#L2yY0u@N$1RxOR%fe>`#Q*^C19^CUbg)1C0k3ZW0swH; zE+i7i;s1lWP$pLZAdvvzA`<5d0gzGv$SzdK6adH=0I*ZDWC{S3003-xd_p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@{DVSvkYQF)~6rF_f}&Xp^*SlIsquQ;@#W9&Ig-46jpk5W}hC^8J$@j)G`z^gQhAr}ZhTkprQ+ z+~tp!D`RJGyLO;%vyxXowwlD{vt`#Og$?@oM&xvrCZixV%bbrFS}pk*p<1gTjoAlB zV1Et`{ffVE0{ZWkJ{qRygNf16^RO@WM$0%Y`61D20n7Vw(s+#nw`EV`tAE1`8;-e# zl-?mxvFZn!jm8V`#>6eIyB!txVYROueC-D3KgCpvzFVTAp<4aRs$1a^lXr;Z;00000000000Gz--2r6SQISnW~00000NkvXXu0mjfP-%IL literal 0 HcmV?d00001 From bf1a6b3d5d3c9883a2232b59ac36c489592ddc62 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 6 Oct 2012 22:11:11 -0500 Subject: [PATCH 0005/2078] [#1765] Making a few tweaks to the console progress update thanks to @lyrixx, @stof and @WouterJ --- components/console/introduction.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 3eac7b8bfe0..617baf97145 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -257,7 +257,7 @@ Displaying a Progress Bar .. versionadded:: 2.2 The ``progress`` helper was added in Symfony 2.2. -When executing longer-running commands, it may be helpful to to show progress +When executing longer-running commands, it may be helpful to show progress information, which updates as your command runs: .. image:: /images/components/console/progress.png @@ -283,9 +283,9 @@ of different levels of verbosity. Each of these displays different possible items - like percentage completion, a moving progress bar, or current/total information (e.g. 10/50):: - $progress->setFormat(ProgressHelper::QUIET); - $progress->setFormat(ProgressHelper::NORMAL); - $progress->setFormat(ProgressHelper::VERBOSE); + $progress->setFormat(ProgressHelper::FORMAT_QUIET); + $progress->setFormat(ProgressHelper::FORMAT_NORMAL); + $progress->setFormat(ProgressHelper::FORMAT_VERBOSE); $progress->setFormat(ProgressHelper::FORMAT_QUIET_NOMAX); // the default value $progress->setFormat(ProgressHelper::FORMAT_NORMAL_NOMAX); @@ -314,7 +314,7 @@ To see other available options, check the API documentation for $progress->start($output, 500); $i = 0; while ($i++ < 50000) { - // do some work + // ... do some work // advance every 100 iterations if ($i % 100 == 0) { From bd9ea955392c81c5d6b433d48d768a283ef07749 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 6 Oct 2012 22:29:59 -0500 Subject: [PATCH 0006/2078] This is the second-half of a fix for a bad merge (merged master into 2.1). This was fixed by reverting that merge on 2.1, merging 2.1 into master (as normal), then reverting the revert to restore the changes on master. Revert "This reverts an improper merge - master was merged into 2.1 by mistake." This reverts commit 3300ab3586b76cef9a65558f942abd7a1e856165. --- book/installation.rst | 4 +- book/testing.rst | 12 +++-- cookbook/testing/profiling.rst | 10 ++-- quick_tour/the_big_picture.rst | 4 +- reference/constraints.rst | 4 +- reference/constraints/Luhn.rst | 87 +++++++++++++++++++++++++++++++ reference/constraints/map.rst.inc | 5 ++ 7 files changed, 115 insertions(+), 11 deletions(-) create mode 100644 reference/constraints/Luhn.rst diff --git a/book/installation.rst b/book/installation.rst index 59eaafd2872..e3733e2bff1 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -60,11 +60,11 @@ Distribution: .. code-block:: bash - php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.1.x-dev + php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony dev-master .. tip:: - For an exact version, replace `2.1.x-dev` with the latest Symfony version + For an exact version, replace `dev-master` with the latest Symfony version (e.g. 2.1.1). For details, see the `Symfony Installation Page`_ This command may take several minutes to run as Composer download the Standard diff --git a/book/testing.rst b/book/testing.rst index 17fbb4cf45e..680902853c0 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -415,13 +415,19 @@ HTTP layer. For a list of services available in your application, use the Accessing the Profiler Data ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -On each request, the Symfony profiler collects and stores a lot of data about -the internal handling of that request. For example, the profiler could be -used to verify that a given page executes less than a certain number of database +On each request, you can enable the Symfony profiler to collect data about the +internal handling of that request. For example, the profiler could be used to +verify that a given page executes less than a certain number of database queries when loading. To get the Profiler for the last request, do the following:: + // enable the profiler for the very next request + $client->enableProfiler(); + + $crawler = $client->request('GET', '/profiler'); + + // get the profile $profile = $client->getProfile(); For specific details on using the profiler inside a test, see the diff --git a/cookbook/testing/profiling.rst b/cookbook/testing/profiling.rst index 8a8055bf278..ee92790c760 100644 --- a/cookbook/testing/profiling.rst +++ b/cookbook/testing/profiling.rst @@ -11,15 +11,19 @@ various things and enforce some metrics. The Symfony2 :ref:`Profiler ` gathers a lot of data for each request. Use this data to check the number of database calls, the time -spent in the framework, ... But before writing assertions, always check that -the profiler is indeed available (it is enabled by default in the ``test`` -environment):: +spent in the framework, ... But before writing assertions, enable the profiler +and check that the profiler is indeed available (it is enabled by default in +the ``test`` environment):: class HelloControllerTest extends WebTestCase { public function testIndex() { $client = static::createClient(); + + // Enable the profiler for the next request (it does nothing if the profiler is not available) + $client->enableProfiler(); + $crawler = $client->request('GET', '/hello/Fabien'); // ... write some assertions about the Response diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index 9438a75c286..fdd131ad432 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -59,12 +59,12 @@ have a ``Symfony/`` directory that looks like this: .. code-block:: bash - $ composer.phar create-project symfony/framework-standard-edition path/to/install 2.1.x-dev + $ composer.phar create-project symfony/framework-standard-edition path/to/install dev-master # remove the Git history $ rm -rf .git - For an exact version, replace `2.1.x-dev` with the latest Symfony version + For an exact version, replace `dev-master` with the latest Symfony version (e.g. 2.1.1). For details, see the `Symfony Installation Page`_ .. tip:: diff --git a/reference/constraints.rst b/reference/constraints.rst index b0ac0823113..3598b812458 100644 --- a/reference/constraints.rst +++ b/reference/constraints.rst @@ -40,6 +40,8 @@ Validation Constraints Reference constraints/File constraints/Image + constraints/Luhn + constraints/Callback constraints/All constraints/UserPassword @@ -47,7 +49,7 @@ Validation Constraints Reference The Validator is designed to validate objects against *constraints*. In real life, a constraint could be: "The cake must not be burned". In -Symfony2, constraints are similar: They are assertions that a condition is +Symfony2, constraints are similar: They are assertions that a condition is true. Supported Constraints diff --git a/reference/constraints/Luhn.rst b/reference/constraints/Luhn.rst new file mode 100644 index 00000000000..f854fb8f7cb --- /dev/null +++ b/reference/constraints/Luhn.rst @@ -0,0 +1,87 @@ +Luhn +====== + +This constraint is used to ensure that a credit card number passes the `Luhn algorithm`_. +It is useful as a first step to validating a credit card: before communicating with a +payment gateway. + ++----------------+-----------------------------------------------------------------------+ +| Applies to | :ref:`property or method` | ++----------------+-----------------------------------------------------------------------+ +| Options | - `message`_ | ++----------------+-----------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Luhn` | ++----------------+-----------------------------------------------------------------------+ +| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\LuhnValidator` | ++----------------+-----------------------------------------------------------------------+ + +Basic Usage +----------- + +To use the Luhn validator, simply apply it to a property on an object that +will contain a credit card number. + +.. configuration-block:: + + .. code-block:: yaml + + # src/Acme/SubscriptionBundle/Resources/config/validation.yml + Acme\SubscriptionBundle\Entity\Transaction: + properties: + cardNumber: + - Luhn: + message: Please check your credit card number. + + .. code-block:: xml + + + + + + + + + + + .. code-block:: php-annotations + + // src/Acme/SubscriptionBundle/Entity/Transaction.php + use Symfony\Component\Validator\Constraints as Assert; + + class Transaction + { + /** + * @Assert\Luhn(message = "Please check your credit card number.") + */ + protected $cardNumber; + } + + .. code-block:: php + + // src/Acme/SubscriptionBundle/Entity/Transaction.php + use Symfony\Component\Validator\Mapping\ClassMetadata; + use Symfony\Component\Validator\Constraints\Luhn; + + class Transaction + { + protected $cardNumber; + + public static function loadValidatorMetadata(ClassMetadata $metadata) + { + $metadata->addPropertyConstraint('luhn', new Luhn(array( + 'message' => 'Please check your credit card number', + ))); + } + } + +Available Options +----------------- + +message +~~~~~~~ + +**type**: ``string`` **default**: ``Invalid card number`` + +The default message supplied when the value does not pass the Luhn check. + +.. _`Luhn algorithm`: http://en.wikipedia.org/wiki/Luhn_algorithm \ No newline at end of file diff --git a/reference/constraints/map.rst.inc b/reference/constraints/map.rst.inc index b9ea2184ca3..3bcc9ad3a3a 100644 --- a/reference/constraints/map.rst.inc +++ b/reference/constraints/map.rst.inc @@ -54,6 +54,11 @@ File Constraints * :doc:`File ` * :doc:`Image ` +Financial Constraints +~~~~~~~~~~~~~~~~~~~~~ + +* :doc:`Luhn ` + Other Constraints ~~~~~~~~~~~~~~~~~ From 72dc96aca44edfbdda25d6db9e332c7b652a708e Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 7 Oct 2012 21:07:43 -0500 Subject: [PATCH 0007/2078] [#1788] Adding some :method: syntax, versionadded and other small tweaks to new optional Config additions --- components/config/definition.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index 035a424107d..cc2a610ef08 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -214,8 +214,14 @@ has a certain value: Optional Sections ----------------- + +.. versionadded:: 2.1 + The ``canBeEnabled`` and ``canBeDisabled`` methods are new in Symfony 2.2 + If you have entire sections which are optional and can be enabled/disabled, -you can take advantage of the shortcut ``canBeEnabled``, or ``canBeDisabled``:: +you can take advantage of the shortcut +:method:`Symfony\\Component\\Config\\Definition\\Builder\\ArrayNodeDefinition::canBeEnabled` and +:method:`Symfony\\Component\\Config\\Definition\\Builder\\ArrayNodeDefinition::canBeDisabled` methods:: $arrayNode ->canBeEnabled() @@ -232,7 +238,7 @@ you can take advantage of the shortcut ``canBeEnabled``, or ``canBeDisabled``:: ->defaultFalse() ; -``canBeDisabled`` looks about the same with the difference that the section +The ``canBeDisabled`` method looks about the same except that the section would be enabled by default. Merging options From 5fe1212df34842bedfe3c0bb200fa0125427725d Mon Sep 17 00:00:00 2001 From: Sebastiaan Stok Date: Wed, 3 Oct 2012 11:17:56 +0200 Subject: [PATCH 0008/2078] [Security] added new documentation about the PBKDF2 password encoder --- book/security.rst | 3 +++ reference/configuration/security.rst | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/book/security.rst b/book/security.rst index 3fb2b2ba27f..bec824c52b8 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1200,6 +1200,9 @@ it as base64. In other words, the password has been greatly obfuscated so that the hashed password can't be decoded (i.e. you can't determine the password from the hashed password). +.. versionadded:: 2.2 + As of Symfony 2.2 you can also use the PBKDF2 password encoder. + If you have some sort of registration form for users, you'll need to be able to determine the hashed password so that you can set it on your user. No matter what algorithm you configure for your user object, the hashed password diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index e98da61f58f..d3bcc9c7f7d 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -55,6 +55,13 @@ Each part will be explained in the next section. encode_as_base64: true iterations: 5000 + # PBKDF2 encoder + Acme\Your\Class\Name: + algorithm: pbkdf2 + hash_algorithm: sha512 + encode_as_base64: true + iterations: 1000 + # Example options/values for what a custom encoder might look like Acme\Your\Class\Name: algorithm: ~ @@ -189,6 +196,17 @@ Each part will be explained in the next section. ROLE_ADMIN: [ROLE_ORGANIZER, ROLE_USER] ROLE_SUPERADMIN: [ROLE_ADMIN] +.. caution:: + PBKDF2 encoder uses the PBKDF2 (Password-Based Key Derivation Function 2). + + Providing a high level of Cryptographic security, + as recommended by the National Institute of Standards and Technology (NIST). + + But also warrants a warning, using PBKDF2 (with a high number of iterations) slows down the process. + PBKDF2 should be used with caution and care. + + A good configuration lies around at least 1000 iterations and sha512 for the hash algorithm. + .. _reference-security-firewall-form-login: Form Login Configuration From b9f7412796ee7e019143567416c584bc0f925f1e Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 17 Oct 2012 16:55:30 -0500 Subject: [PATCH 0009/2078] [#1779] Tweaks to PBKDF2 reference docs - mostly wording and moving it a bit lower --- reference/configuration/security.rst | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index d3bcc9c7f7d..86e7670d078 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -56,6 +56,7 @@ Each part will be explained in the next section. iterations: 5000 # PBKDF2 encoder + # see the note about PBKDF2 below for details on security and speed Acme\Your\Class\Name: algorithm: pbkdf2 hash_algorithm: sha512 @@ -196,17 +197,6 @@ Each part will be explained in the next section. ROLE_ADMIN: [ROLE_ORGANIZER, ROLE_USER] ROLE_SUPERADMIN: [ROLE_ADMIN] -.. caution:: - PBKDF2 encoder uses the PBKDF2 (Password-Based Key Derivation Function 2). - - Providing a high level of Cryptographic security, - as recommended by the National Institute of Standards and Technology (NIST). - - But also warrants a warning, using PBKDF2 (with a high number of iterations) slows down the process. - PBKDF2 should be used with caution and care. - - A good configuration lies around at least 1000 iterations and sha512 for the hash algorithm. - .. _reference-security-firewall-form-login: Form Login Configuration @@ -261,3 +251,18 @@ Redirecting after Login * ``default_target_path`` (type: ``string``, default: ``/``) * ``target_path_parameter`` (type: ``string``, default: ``_target_path``) * ``use_referer`` (type: ``Boolean``, default: ``false``) + +Using the PBKDF2 encoder: security and speed +-------------------------------------------- + +The `PBKDF2`_ encoder provides a high level of Cryptographic security, as +recommended by the National Institute of Standards and Technology (NIST). + +But using PBKDF2 also warrants a warning: using it (with a high number +of iterations) slows down the process. Thus, PBKDF2 should be used with +caution and care. + +A good configuration lies around at least 1000 iterations and sha512 +for the hash algorithm. + +.. _`PBKDF2`: http://en.wikipedia.org/wiki/PBKDF2 \ No newline at end of file From c01bc536ef3c35be9f0a28c5d1d4573c695ecaa6 Mon Sep 17 00:00:00 2001 From: Javier Lopez Date: Thu, 18 Oct 2012 21:23:09 +0200 Subject: [PATCH 0010/2078] Update reference/configuration/framework.rst This PR is related to this one https://github.com/symfony/symfony/pull/5347. --- reference/configuration/framework.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index ce6216bb916..7ad7bd53968 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -26,6 +26,8 @@ Configuration * field_name * `session`_ * `lifetime`_ +* `serializer`_ + * enabled * `templating`_ * `assets_base_urls`_ * `assets_version`_ @@ -112,6 +114,23 @@ lifetime This determines the lifetime of the session - in seconds. By default it will use ``0``, which means the cookie is valid for the length of the browser session. +serializer +~~~~~~~~~~ + +enabled +....... + +**type**: ``boolean`` **default**: ``false`` + +Whether to enable or not the serializer service in the service container. If enabled, +the serializer will be loaded along with two encoders (:class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder` +and :class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder) +and one normalizer (:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`). + +You can add more normalizers and/or encoders by tagging them as `serializer.encoder` and +`serializer.normalizer`. It's also possible to set the priority of the tag in order to decide the +matching order. + templating ~~~~~~~~~~ @@ -319,6 +338,10 @@ Full Default Configuration # DEPRECATED! Please use: cookie_httponly httponly: ~ + # serializer configuration + serializer: + enabled: false + # templating configuration templating: assets_version: ~ From 460406edf272e61a1826279d23d391b64d6f1355 Mon Sep 17 00:00:00 2001 From: Javier Lopez Date: Sun, 21 Oct 2012 19:34:05 +0200 Subject: [PATCH 0011/2078] Update reference/dic_tags.rst Adding tags to the tag list reference --- reference/dic_tags.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index fa7ea84e043..27d681653f1 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -42,6 +42,10 @@ the AsseticBundle has several tags that aren't listed here. +-----------------------------------+---------------------------------------------------------------------------+ | `security.listener.factory`_ | Necessary when creating a custom authentication system | +-----------------------------------+---------------------------------------------------------------------------+ +| `serializer.encoder`_ | Register a new encoder in the Serializer service | ++-----------------------------------+---------------------------------------------------------------------------+ +| `serializer.normalizer`_ | Register a new normalizer in the Serializer service | ++-----------------------------------+---------------------------------------------------------------------------+ | `swiftmailer.plugin`_ | Register a custom SwiftMailer Plugin | +-----------------------------------+---------------------------------------------------------------------------+ | `templating.helper`_ | Make your service available in PHP templates | @@ -558,6 +562,24 @@ is used behind the scenes to determine if the user should have access. The For more information, read the cookbook article: :doc:`/cookbook/security/voters`. +serializer.encoder +------------------ + +**Purpose**: Register a new encoder in the Serializer service + +You have to enable the Serializer service in order to use this tag. The class to +be tagged should extend the :class:`Symfony\\Component\\Serializer\\Encoder\\EncoderInterface` +and :class:`Symfony\\Component\\Serializer\\Encoder\\DecoderInterface` + +serializer.normalizer +--------------------- + +**Purpose**: Register a new normalizer in the Serializer service + +You have to enable the Serializer service in order to use this tag. The class to +be tagged should extend the :class:`Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface` +and :class:`Symfony\\Component\\Serializer\\Normalizer\\DenormalizerInterface` + swiftmailer.plugin ------------------ From f723940a8309221e016b852699ec6d2ff423db5d Mon Sep 17 00:00:00 2001 From: Javier Lopez Date: Sun, 21 Oct 2012 19:38:12 +0200 Subject: [PATCH 0012/2078] Update reference/configuration/framework.rst Changing backticks --- reference/configuration/framework.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 7ad7bd53968..e5c122aeecc 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -127,8 +127,8 @@ the serializer will be loaded along with two encoders (:class:`Symfony\\Componen and :class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder) and one normalizer (:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`). -You can add more normalizers and/or encoders by tagging them as `serializer.encoder` and -`serializer.normalizer`. It's also possible to set the priority of the tag in order to decide the +You can add more normalizers and/or encoders by tagging them as ``serializer.encoder`` and +``serializer.normalizer``. It's also possible to set the priority of the tag in order to decide the matching order. templating From 46fe35f2024303419283ecbe38f7808d3b24891e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 26 Oct 2012 12:10:22 +0200 Subject: [PATCH 0013/2078] added the CMF in the main Symfony docs --- index.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/index.rst b/index.rst index ea1cbfe29fb..f0c9137b94a 100644 --- a/index.rst +++ b/index.rst @@ -72,6 +72,17 @@ The Symfony Standard Edition comes with some bundles. Learn more about them: .. include:: /bundles/map.rst.inc +CMF +--- + +The Symfony CMFproject makes it easier for developers to add CMS functionality +to applications built with the Symfony2 PHP framework. + +.. toctree:: + :hidden: + + cmf/index + Contributing ------------ From d8a2ca8a205e38d70338d739ce1108ce6d53b37a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 27 Oct 2012 16:24:10 +0200 Subject: [PATCH 0014/2078] added a note about the new incremental methods of the Process class --- components/process.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/components/process.rst b/components/process.rst index 361235a2356..4057287acd6 100644 --- a/components/process.rst +++ b/components/process.rst @@ -37,6 +37,16 @@ The :method:`Symfony\\Component\\Process\\Process::run` method takes care of the subtle differences between the different platforms when executing the command. +.. versionadded:: 2.2 + The ``getIncrementalOutput()`` and ``getIncrementalErrorOutput()`` methods + were added in Symfony 2.2. + +The ``getOutput()`` method always return the whole content of the standard +output of the command and ``getErrorOutput()`` the content of the error +output. Alternatively, the ``getIncrementalOutput()`` and +``getIncrementalErrorOutput()`` methods returns the new outputs since the last +call. + When executing a long running command (like rsync-ing files to a remote server), you can give feedback to the end user in real-time by passing an anonymous function to the From d84c6fc6771eb87e3f999ed7e64d19d898fc1331 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 28 Oct 2012 07:59:12 +0100 Subject: [PATCH 0015/2078] added docs on the new security utilities from Symfony 2.2 --- book/security.rst | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/book/security.rst b/book/security.rst index bec824c52b8..57743ec4c3b 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1787,6 +1787,61 @@ cookie will be ever created by Symfony2): If you use a form login, Symfony2 will create a cookie even if you set ``stateless`` to ``true``. +Utilities +--------- + +.. versionadded:: 2.2 + The ``StringUtils`` and ```SecureRandom`` classes were added in Symfony 2.2 + +The Symfony Security Component comes a collection of nice utilities related to +security. These utilities are used by Symfony, but you should also use them if +you want to solve the problem they address. + +Comparing Strings +~~~~~~~~~~~~~~~~~ + +The time it takes to compare two strings depends on their differences. This +can be used by an attacker when the two strings represent a password for +instance; it is known as a `Timing attack`_. + +Internally, when comparing two passwords, Symfony uses a constant-time +algorithm; you can use the same strategy in your own code thanks to the +:class:`Symfony\\Component\\Security\\Core\\Util\\StringUtils` class:: + + use Symfony\Component\Security\Core\Util\StringUtils; + + // is password1 equals to password2? + $bool = StringUtils::equals($password1, $password2); + +Generating a secure Random Number +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Whenever you need to generate a secure random number, you are highly +encouraged to use the Symfony +:class:`Symfony\\Component\\Security\\Core\\Util\\SecureRandom` class:: + + use Symfony\Component\Security\Core\Util\SecureRandom; + + $generator = new SecureRandom(); + $random = $generator->nextBytes(10); + +The +:method:`Symfony\\Component\\Security\\Core\\Util\\SecureRandom::nextBytes` +methods returns a random string composed of the number of characters passed as +an argument (10 in the above example). + +The SecureRandom class works better when OpenSSL is installed but when it's +not available, it falls back to an internal algorithm, which needs a seed file +to work correctly. Just pass a file name to enable it:: + + $generator = new SecureRandom('/some/path/to/store/the/seed.txt'); + $random = $generator->nextBytes(10); + +.. note:: + + You can also access a secure random instance directly from the Symfony + dependency injection container; its name is ``security.secure_random``. + Final Words ----------- @@ -1820,3 +1875,4 @@ Learn more from the Cookbook .. _`FOSUserBundle`: https://github.com/FriendsOfSymfony/FOSUserBundle .. _`implement the \Serializable interface`: http://php.net/manual/en/class.serializable.php .. _`functions-online.com`: http://www.functions-online.com/sha1.html +.. _`Timing attack`: http://en.wikipedia.org/wiki/Timing_attack \ No newline at end of file From 676dff12e30b366c2953c0386bf8628f5c6644b4 Mon Sep 17 00:00:00 2001 From: Jeanmonod David Date: Thu, 20 Sep 2012 07:15:52 +0200 Subject: [PATCH 0016/2078] Documentation of the new numerical type handling --- components/config/definition.rst | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index cc2a610ef08..6999a0f7809 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -74,7 +74,7 @@ Variable nodes A tree contains node definitions which can be laid out in a semantic way. This means, using indentation and the fluent notation, it is possible to -reflect the real structure of the configuration values:: +reflect the real structure of the configuration values: $rootNode ->children() @@ -100,11 +100,39 @@ node definition. Node type are available for: * scalar * boolean * array +* enum (new in 2.1) +* integer (new in 2.2) +* float (new in 2.2) * variable (no validation) and are created with ``node($name, $type)`` or their associated shortcut ``xxxxNode($name)`` method. +Numeric node constraints +~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 2.2 + + The numeric (float and integer) nodes are new in 2.2 + +Numeric node (float and integer) provide two extra constraints min() and max() allowing to validate the value: + +.. code-block:: php + + $rootNode + ->children() + ->integerNode('positive_value') + ->min(0) + ->end() + ->floatNode('big_value') + ->max(5E45) + ->end() + ->integerNode('value_inside_a_range') + ->min(-50)->max(50) + ->end() + ->end() + ; + Array nodes ~~~~~~~~~~~ From e95632caa3622c16a6501b5e5b2e98710a0d6b4c Mon Sep 17 00:00:00 2001 From: Jeanmonod David Date: Thu, 20 Sep 2012 23:55:54 +0200 Subject: [PATCH 0017/2078] Syntax fixes --- components/config/definition.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index 6999a0f7809..a38dca3d262 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -74,7 +74,7 @@ Variable nodes A tree contains node definitions which can be laid out in a semantic way. This means, using indentation and the fluent notation, it is possible to -reflect the real structure of the configuration values: +reflect the real structure of the configuration values:: $rootNode ->children() @@ -106,7 +106,7 @@ node definition. Node type are available for: * variable (no validation) and are created with ``node($name, $type)`` or their associated shortcut -``xxxxNode($name)`` method. + ``xxxxNode($name)`` method. Numeric node constraints ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -115,7 +115,8 @@ Numeric node constraints The numeric (float and integer) nodes are new in 2.2 -Numeric node (float and integer) provide two extra constraints min() and max() allowing to validate the value: +Numeric node (float and integer) provide two extra constraints min() and + max() allowing to validate the value: .. code-block:: php From 350251f2101072f52d2451ef8692342077aa5d89 Mon Sep 17 00:00:00 2001 From: Leevi Graham Date: Mon, 29 Oct 2012 20:50:06 +1100 Subject: [PATCH 0018/2078] Added failure_path param --- cookbook/security/form_login.rst | 3 +++ reference/configuration/security.rst | 1 + 2 files changed, 4 insertions(+) diff --git a/cookbook/security/form_login.rst b/cookbook/security/form_login.rst index dcae87bddc7..9687666175f 100644 --- a/cookbook/security/form_login.rst +++ b/cookbook/security/form_login.rst @@ -42,6 +42,7 @@ Form Login Configuration Reference # login failure redirecting options (read further below) failure_path: null failure_forward: false + failure_target_path: _failure_path # field names for the username and password fields username_parameter: _username @@ -66,6 +67,7 @@ Form Login Configuration Reference use_referer="false" failure_path="null" failure_forward="false" + failure_target_path="_failure_path" username_parameter="_username" password_parameter="_password" csrf_parameter="_csrf_token" @@ -90,6 +92,7 @@ Form Login Configuration Reference 'use_referer' => false, 'failure_path' => null, 'failure_forward' => false, + 'failure_target_path' => _failure_path, 'username_parameter' => '_username', 'password_parameter' => '_password', 'csrf_parameter' => '_csrf_token', diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index 86e7670d078..f04c064be72 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -120,6 +120,7 @@ Each part will be explained in the next section. use_referer: false failure_path: /foo failure_forward: false + failure_path_parameter: _failure_path failure_handler: some.service.id success_handler: some.service.id username_parameter: _username From 70ca20c337f1b90f09415312fef03b7c126ee435 Mon Sep 17 00:00:00 2001 From: Javier Lopez Date: Mon, 29 Oct 2012 20:05:33 +0000 Subject: [PATCH 0019/2078] Update reference/configuration/framework.rst The GetSetMethodNormalizer is not loaded by default --- reference/configuration/framework.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index e5c122aeecc..aede5c5867a 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -124,8 +124,9 @@ enabled Whether to enable or not the serializer service in the service container. If enabled, the serializer will be loaded along with two encoders (:class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder` -and :class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder) -and one normalizer (:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`). +and :class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`) +but none normalizer. The :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer` is broken by design +so you are required to load it under your responsability. You can do creating a new service and tagging it appropiately. You can add more normalizers and/or encoders by tagging them as ``serializer.encoder`` and ``serializer.normalizer``. It's also possible to set the priority of the tag in order to decide the From d0ebf2f1ec717a9accd3aa824e72490c5ff095b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Simon?= Date: Tue, 30 Oct 2012 09:49:51 +0100 Subject: [PATCH 0020/2078] Added a note about request accept-* headers parsing. --- components/http_foundation/introduction.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 374d7ee7cea..1aaed68f0c7 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -215,6 +215,23 @@ the method tells you if the request contains a Session which was started in one of the previous requests. +Accessing `Accept-*` Headers Data +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you need to access parsed data from `Accept`, `Accept-Language`, +`Accept-Charset` or `Accept-Encoding`, you can use +:class:`Symfony\\Component\\HttpFoundation\\AcceptHeader` utility class:: + + $accept = AcceptHeader::fromString($request->headers->get('Accept')); + if ($accept->has('text/html') { + $item = $accept->get('html'); + $charset = $item->getAttribute('charset', 'utf-8'); + $quality = $item->getQuality(); + } + + // accepts items are sorted by descending quality + $accepts = AcceptHeader::fromString($request->headers->get('Accept'))->all(); + Accessing other Data ~~~~~~~~~~~~~~~~~~~~ From 7c7b981b546dcb71a1662faab32308ea3c984186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Simon?= Date: Tue, 30 Oct 2012 18:00:18 +0100 Subject: [PATCH 0021/2078] Added information about accept-* headers request methods. --- components/http_foundation/introduction.rst | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 1aaed68f0c7..b27909a6529 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -218,8 +218,20 @@ the previous requests. Accessing `Accept-*` Headers Data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If you need to access parsed data from `Accept`, `Accept-Language`, -`Accept-Charset` or `Accept-Encoding`, you can use +You can easily access basic data extracted from ``Accept-*`` headers +by using following methods: + +* :method:`Symfony\\Component\\HttpFoundation\\Request::getAcceptableContentTypes`: + Returns the list of accepted content types ordered by descending quality; + +* :method:`Symfony\\Component\\HttpFoundation\\Request::getLanguages`: + Returns the list of accepted languages ordered by descending quality; + +* :method:`Symfony\\Component\\HttpFoundation\\Request::getCharsets`: + Returns the list of accepted languages ordered by descending quality; + +If you need to egt full access to parsed data from ``Accept``, ``Accept-Language``, +``Accept-Charset`` or ``Accept-Encoding``, you can use :class:`Symfony\\Component\\HttpFoundation\\AcceptHeader` utility class:: $accept = AcceptHeader::fromString($request->headers->get('Accept')); From dd2049aeb8b43165ecb36c8fcfd4b9e8bbb89307 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 31 Oct 2012 10:08:50 -0500 Subject: [PATCH 0022/2078] [#1527] Tweaks to new Finder::path and Finder::notPath docs --- components/finder.rst | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/components/finder.rst b/components/finder.rst index e0fffe4bc43..fe106d7f044 100644 --- a/components/finder.rst +++ b/components/finder.rst @@ -181,27 +181,29 @@ Path ~~~~ .. versionadded:: 2.2 - Methods ``path()`` and ``notPath()`` have been - introduced in version 2.2. + The ``path()`` and ``notPath()`` methods were added in version 2.2. Restrict files and directories by path with the :method:`Symfony\\Component\\Finder\\Finder::path` method:: $finder->path('some/special/dir'); -On all platforms slash (i.e. ``/``) should be used as a separator. +On all platforms slash (i.e. ``/``) should be used as the directory separator. -The ``path()`` method accepts strings or regexes:: +The ``path()`` method accepts a string or a regular expression:: $finder->path('foo/bar'); $finder->path('/^foo\/bar/'); -Strings are converted into regexes by escaping slashes and adding delimiters: +Internally, strings are converted into regular expressions by escaping slashes +and adding delimiters: + +.. code-block:: text dirname ===> /dirname/ a/b/c ===> /a\/b\/c/ -The ``notPath()`` method excludes files by path:: +The :method:`Symfony\\Component\\Finder\\Finder::notPath` method excludes files by path:: $finder->notPath('other/dir'); From 694ce5cd98e4010c07c43ac7951f21a6e183aac5 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 31 Oct 2012 10:33:58 -0500 Subject: [PATCH 0023/2078] [#1732] Minor tweaks to numeric node new docs --- components/config/definition.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index a38dca3d262..85dfecb3967 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -106,19 +106,18 @@ node definition. Node type are available for: * variable (no validation) and are created with ``node($name, $type)`` or their associated shortcut - ``xxxxNode($name)`` method. +``xxxxNode($name)`` method. Numeric node constraints ~~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 2.2 - The numeric (float and integer) nodes are new in 2.2 -Numeric node (float and integer) provide two extra constraints min() and - max() allowing to validate the value: - -.. code-block:: php +Numeric nodes (float and integer) provide two extra constraints - +:method:`Symfony\\Component\\Config\\Definition\\Builder::min` and +:method:`Symfony\\Component\\Config\\Definition\\Builder::max` - +allowing to validate the value:: $rootNode ->children() From 4081cbcbc59673989f3e1fa5c13e04fbc0252053 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 31 Oct 2012 22:29:39 -0500 Subject: [PATCH 0024/2078] [#1853] Minor format and :method: tweaks --- components/process.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/process.rst b/components/process.rst index 10a69292b9e..10f18004e98 100644 --- a/components/process.rst +++ b/components/process.rst @@ -38,14 +38,13 @@ of the subtle differences between the different platforms when executing the command. .. versionadded:: 2.2 - The ``getIncrementalOutput()`` and ``getIncrementalErrorOutput()`` methods - were added in Symfony 2.2. + The ``getIncrementalOutput()`` and ``getIncrementalErrorOutput()`` methods were added in Symfony 2.2. The ``getOutput()`` method always return the whole content of the standard output of the command and ``getErrorOutput()`` the content of the error -output. Alternatively, the ``getIncrementalOutput()`` and -``getIncrementalErrorOutput()`` methods returns the new outputs since the last -call. +output. Alternatively, the :method:`Symfony\\Component\\Process\\Process::getIncrementalOutput` +and :method:`Symfony\\Component\\Process\\Process::getIncrementalErrorOutput` +methods returns the new outputs since the last call. When executing a long running command (like rsync-ing files to a remote server), you can give feedback to the end user in real-time by passing an From 54ffe6fb5103185bdc47ec279f6f365caf52a267 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 31 Oct 2012 22:35:09 -0500 Subject: [PATCH 0025/2078] [#1858] Very minor tweaks --- book/security.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/security.rst b/book/security.rst index 57743ec4c3b..7c52f40ce36 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1793,9 +1793,9 @@ Utilities .. versionadded:: 2.2 The ``StringUtils`` and ```SecureRandom`` classes were added in Symfony 2.2 -The Symfony Security Component comes a collection of nice utilities related to -security. These utilities are used by Symfony, but you should also use them if -you want to solve the problem they address. +The Symfony Security Component comes with a collection of nice utilities related +to security. These utilities are used by Symfony, but you should also use +them if you want to solve the problem they address. Comparing Strings ~~~~~~~~~~~~~~~~~ From d304649aaaf7e9790dc2b29cb631a5787801772d Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 16 Oct 2012 02:11:31 +0200 Subject: [PATCH 0026/2078] Add documentation about hidden response method in Console helper --- components/console/introduction.rst | 74 ++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 256b12d91af..4c4efb5056e 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -287,6 +287,76 @@ if you needed to know the name of something, you might do the following:: 'foo' ); +.. versionadded:: 2.2 + The ``askHiddenResponse`` method was added in Symfony 2.2. + +You can also ask question and hide the response. This is particularly +convenient for passwords:: + + $dialog = $this->getHelperSet()->get('dialog'); + $password = $dialog->askHiddenResponse( + $output, + 'What is the database password ?', + false + ); + +.. caution:: + + When you ask an hidden response, Symfony will use either a binary, change + stty mode or use another trick to hide the response. If none is available, + it will fallback on the classic question unless you pass `false` as the + third argument like in the example above. In this case, a RuntimeException + would be thrown. + +Ask and validate response +------------------------- + +You can easily ask question and validate response with built-in methods:: + + $dialog = $this->getHelperSet()->get('dialog'); + + $validator = function ($value) { + if (trim($value) === '') { + throw new \Exception('The value can not be empty'); + } + } + + $password = $dialog->askAndValidate( + $output, + 'Please enter the name of the widget', + $validator, + 20, + 'foo' + ); + +The validation callback can be any callable PHP function, the fourth argument is +the maximum number of attempts, set it to `false` for unlimited attempts. The +fifth argument is the default value. + +.. versionadded:: 2.2 + The ``askHiddenResponse`` method was added in Symfony 2.2. + +You can also ask and validate hidden response:: + + $dialog = $this->getHelperSet()->get('dialog'); + + $validator = function ($value) { + if (trim($value) === '') { + throw new \Exception('The password can not be empty'); + } + } + + $password = $dialog->askHiddenResponseAndValidate( + $output, + 'Please enter the name of the widget', + $validator, + 20, + false + ); + +If you want to fallback on classic question in case hidden response can not be +provided, pass true as fifth argument. + Displaying a Progress Bar ------------------------- @@ -310,7 +380,7 @@ pass it a total number of units, and advance the progress as your command execut // advance the progress bar 1 unit $progress->advance(); - } + } $progress->finish(); @@ -346,7 +416,7 @@ To see other available options, check the API documentation for to a high number. For example, if you're iterating over a large number of items, consider a smaller "step" number that updates on only some iterations:: - + $progress->start($output, 500); $i = 0; while ($i++ < 50000) { From 0b25facaa1acf201639470d4cb1fcb0c9699926a Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 16 Oct 2012 11:00:09 +0200 Subject: [PATCH 0027/2078] Fix CS --- components/console/introduction.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 4c4efb5056e..c6bde934c1e 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -304,7 +304,7 @@ convenient for passwords:: When you ask an hidden response, Symfony will use either a binary, change stty mode or use another trick to hide the response. If none is available, - it will fallback on the classic question unless you pass `false` as the + it will fallback on the classic question unless you pass ``false`` as the third argument like in the example above. In this case, a RuntimeException would be thrown. @@ -316,7 +316,7 @@ You can easily ask question and validate response with built-in methods:: $dialog = $this->getHelperSet()->get('dialog'); $validator = function ($value) { - if (trim($value) === '') { + if (trim($value) == '') { throw new \Exception('The value can not be empty'); } } @@ -330,18 +330,18 @@ You can easily ask question and validate response with built-in methods:: ); The validation callback can be any callable PHP function, the fourth argument is -the maximum number of attempts, set it to `false` for unlimited attempts. The +the maximum number of attempts, set it to ``false`` for unlimited attempts. The fifth argument is the default value. .. versionadded:: 2.2 - The ``askHiddenResponse`` method was added in Symfony 2.2. + The ``askHiddenResponseAndValidate`` method was added in Symfony 2.2. You can also ask and validate hidden response:: $dialog = $this->getHelperSet()->get('dialog'); $validator = function ($value) { - if (trim($value) === '') { + if (trim($value) == '') { throw new \Exception('The password can not be empty'); } } From 3503f988aaebf49242414b7041cffee761204cec Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Mon, 12 Nov 2012 10:38:33 +0100 Subject: [PATCH 0028/2078] add router.request_context.base_url to cookbook entry --- cookbook/console/generating_urls.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cookbook/console/generating_urls.rst b/cookbook/console/generating_urls.rst index 1e3ef5ee0dc..486a809fae1 100644 --- a/cookbook/console/generating_urls.rst +++ b/cookbook/console/generating_urls.rst @@ -21,8 +21,11 @@ Configuring the Request Context globally To configure the Request Context - which is used by the URL Generator - you can redefine the parameters it uses as default values to change the default host -(localhost) and scheme (http). Note that this does not impact URLs generated -via normal web requests, since those will override the defaults. +(localhost) and scheme (http). Starting with Symfony 2.2 you can also configure +the base path if Symfony is not running in the root directory. + +Note that this does not impact URLs generated via normal web requests, since those +will override the defaults. .. configuration-block:: @@ -32,6 +35,7 @@ via normal web requests, since those will override the defaults. parameters: router.request_context.host: example.org router.request_context.scheme: https + router.request_context.base_url: my/path .. code-block:: xml @@ -44,6 +48,7 @@ via normal web requests, since those will override the defaults. example.org https + my/path @@ -52,6 +57,7 @@ via normal web requests, since those will override the defaults. // app/config/config_test.php $container->setParameter('router.request_context.host', 'example.org'); $container->setParameter('router.request_context.scheme', 'https'); + $container->setParameter('router.request_context.base_url', 'my/path'); Configuring the Request Context per Command ------------------------------------------- @@ -69,6 +75,7 @@ service and override its settings:: $context = $this->getContainer()->get('router')->getContext(); $context->setHost('example.com'); $context->setScheme('https'); + $context->setBaseUrl('my/path'); // ... your code here } From 7069e85f9dba50db0a616ebfcbcfaab637379b93 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Tue, 13 Nov 2012 09:02:45 +0100 Subject: [PATCH 0029/2078] add versionadded notes --- cookbook/console/generating_urls.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cookbook/console/generating_urls.rst b/cookbook/console/generating_urls.rst index 486a809fae1..a441ab8c89b 100644 --- a/cookbook/console/generating_urls.rst +++ b/cookbook/console/generating_urls.rst @@ -19,6 +19,14 @@ and per Command. Configuring the Request Context globally ---------------------------------------- +.. versionadded: 2.1 + + The host and scheme parameters are available since Symfony 2.1 + +.. versionadded: 2.2 + + The base_url parameter is available since Symfony 2.2 + To configure the Request Context - which is used by the URL Generator - you can redefine the parameters it uses as default values to change the default host (localhost) and scheme (http). Starting with Symfony 2.2 you can also configure From 9d73c61efea77492eac75d2eb2ee79b86d675428 Mon Sep 17 00:00:00 2001 From: Arnaud Le Blanc Date: Mon, 5 Nov 2012 12:05:07 +0100 Subject: [PATCH 0030/2078] [Routing] added hostname pattern --- book/routing.rst | 160 +++++++++++++++++++++++++++++++++++++++++ components/routing.rst | 25 +++++-- 2 files changed, 179 insertions(+), 6 deletions(-) diff --git a/book/routing.rst b/book/routing.rst index 358945aef96..fbe941993e5 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -692,6 +692,124 @@ form via the same URL, while using distinct controllers for the two actions. Like the other requirements, the ``_method`` requirement is parsed as a regular expression. To match ``GET`` *or* ``POST`` requests, you can use ``GET|POST``. +Adding a Hostname Pattern +~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 2.2 + Hostname matching support was added in Symfony 2.2 + +You can also match on the HTTP *hostname* of the incoming request: + +.. configuration-block:: + + .. code-block:: yaml + + mobile_homepage: + pattern: / + hostname_pattern: m.example.com + defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } + + homepage: + pattern: / + defaults: { _controller: AcmeDemoBundle:Main:homepage } + + .. code-block:: xml + + + + + + + AcmeDemoBundle:Main:mobileHomepage + + + + AcmeDemoBundle:Main:homepage + + + + .. code-block:: php + + use Symfony\Component\Routing\RouteCollection; + use Symfony\Component\Routing\Route; + + $collection = new RouteCollection(); + $collection->add('mobile_homepage', new Route('/', array( + '_controller' => 'AcmeDemoBundle:Main:mobileHomepage', + ), array(), array(), 'm.example.com')); + + $collection->add('homepage', new Route('/', array( + '_controller' => 'AcmeDemoBundle:Main:homepage', + ))); + + return $collection; + +Both routes match the same pattern ``/``, however the first one will match +only if the hostname is ``m.example.com``. + +Placeholders and Requirements in Hostname Patterns +-------------------------------------------------- + +Placeholders can be used in hostname patterns as well as in patterns, and +requirements also apply to them. + +In the following example we avoid hardcoding the domain name by using a +placeholder and a requirement. ``%domain%`` in requirements is replaced +by the value of the ``domain`` dependency injection container parameter. + +.. configuration-block:: + + .. code-block:: yaml + + mobile_homepage: + pattern: / + hostname_pattern: m.{domain} + defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } + requirements: + domain: %domain% + + homepage: + pattern: / + defaults: { _controller: AcmeDemoBundle:Main:homepage } + + .. code-block:: xml + + + + + + + AcmeDemoBundle:Main:mobileHomepage + %domain% + + + + AcmeDemoBundle:Main:homepage + + + + .. code-block:: php + + use Symfony\Component\Routing\RouteCollection; + use Symfony\Component\Routing\Route; + + $collection = new RouteCollection(); + $collection->add('mobile_homepage', new Route('/', array( + '_controller' => 'AcmeDemoBundle:Main:mobileHomepage', + ), array( + 'domain' => '%domain%', + ), array(), 'm.{domain}')); + + $collection->add('homepage', new Route('/', array( + '_controller' => 'AcmeDemoBundle:Main:homepage', + ))); + + return $collection; + .. index:: single: Routing; Advanced example single: Routing; _format parameter @@ -1014,6 +1132,48 @@ instead of simply ``/hello/{name}``: The string ``/admin`` will now be prepended to the pattern of each route loaded from the new routing resource. +Adding a Hostname Pattern to Imported Routes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 2.2 + Hostname matching support was added in Symfony 2.2 + +You can set a hostname pattern on imported routes: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/routing.yml + acme_hello: + resource: "@AcmeHelloBundle/Resources/config/routing.yml" + hostname_pattern: "hello.example.com" + + .. code-block:: xml + + + + + + + + + + .. code-block:: php + + // app/config/routing.php + use Symfony\Component\Routing\RouteCollection; + + $collection = new RouteCollection(); + $collection->addCollection($loader->import("@AcmeHelloBundle/Resources/config/routing.php"), '', array(), array(), array(), 'hello.example.com'); + + return $collection; + +The hostname pattern ``hello.example.com`` will be set on each route +loaded from the new routing resource. + .. tip:: You can also define routes using annotations. See the diff --git a/components/routing.rst b/components/routing.rst index ebf14766f4f..b40bbc0057e 100644 --- a/components/routing.rst +++ b/components/routing.rst @@ -70,7 +70,7 @@ which holds the name of the matched route. Defining routes ~~~~~~~~~~~~~~~ -A full route definition can contain up to four parts: +A full route definition can contain up to five parts: 1. The URL pattern route. This is matched against the URL passed to the `RequestContext`, and can contain named wildcard placeholders (e.g. ``{placeholders}``) @@ -85,13 +85,21 @@ placeholders as regular expressions. 4. An array of options. These contain internal settings for the route and are the least commonly needed. +5. A hostname pattern. This is matched against the hostname passed to the +`RequestContext`, and can contain named wildcard placeholders (e.g. +``{placeholders}``) to match dynamic parts in the hostname. + +.. versionadded:: 2.2 + The hostname pattern was added in Symfony 2.2 + Take the following route, which combines several of these ideas:: $route = new Route( '/archive/{month}', // path array('controller' => 'showArchive'), // default values - array('month' => '[0-9]{4}-[0-9]{2}'), // requirements - array() // options + array('month' => '[0-9]{4}-[0-9]{2}', 'subdomain' => 'www|m'), // requirements + array(), // options + '{subdomain}.example.com' // hostname ); // ... @@ -100,6 +108,7 @@ Take the following route, which combines several of these ideas:: // array( // 'controller' => 'showArchive', // 'month' => '2012-01', + // 'subdomain' => 'www', // '_route' => ... // ) @@ -142,7 +151,8 @@ Using Prefixes You can add routes or other instances of :class:`Symfony\\Component\\Routing\\RouteCollection` to *another* collection. This way you can build a tree of routes. Additionally you can define a prefix, -default requirements and default options to all routes of a subtree:: +default requirements, default options, and hostname pattern to all routes +of a subtree:: $rootCollection = new RouteCollection(); @@ -152,8 +162,11 @@ default requirements and default options to all routes of a subtree:: $rootCollection->addCollection( $subCollection, - '/prefix', - array('_scheme' => 'https') + '/prefix', // prefix + array('_scheme' => 'https'), // defaults + array(), // requirements + array(), // options + 'admin.example.com', // hostname ); Set the Request Parameters From 4a08ca2c1fcf18192125bf6862f08a0d82a483c2 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 16 Nov 2012 06:32:10 -0600 Subject: [PATCH 0031/2078] [#1822] Minor tweaks to new component "hidden" response docs --- components/console/introduction.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index c6bde934c1e..bf0027df640 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -296,16 +296,16 @@ convenient for passwords:: $dialog = $this->getHelperSet()->get('dialog'); $password = $dialog->askHiddenResponse( $output, - 'What is the database password ?', + 'What is the database password?', false ); .. caution:: - When you ask an hidden response, Symfony will use either a binary, change + When you ask for a hidden response, Symfony will use either a binary, change stty mode or use another trick to hide the response. If none is available, - it will fallback on the classic question unless you pass ``false`` as the - third argument like in the example above. In this case, a RuntimeException + it will fallback and allow the response to be visible unless you pass ``false`` + as the third argument like in the example above. In this case, a RuntimeException would be thrown. Ask and validate response @@ -336,7 +336,7 @@ fifth argument is the default value. .. versionadded:: 2.2 The ``askHiddenResponseAndValidate`` method was added in Symfony 2.2. -You can also ask and validate hidden response:: +You can also ask and validate a hidden response:: $dialog = $this->getHelperSet()->get('dialog'); @@ -354,8 +354,8 @@ You can also ask and validate hidden response:: false ); -If you want to fallback on classic question in case hidden response can not be -provided, pass true as fifth argument. +If you want to allow the response to be visible if it cannot be hidden for +some reason, pass true as the fifth argument. Displaying a Progress Bar ------------------------- From 99a239cdff72cd88510c8ee85d587031eb592bed Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 16 Nov 2012 07:00:41 -0600 Subject: [PATCH 0032/2078] [#1868] Tweaks to new AcceptHeader docs --- components/http_foundation/introduction.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 47a77e6c401..f3720d6a3fa 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -218,21 +218,23 @@ Accessing `Accept-*` Headers Data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can easily access basic data extracted from ``Accept-*`` headers -by using following methods: +by using the following methods: * :method:`Symfony\\Component\\HttpFoundation\\Request::getAcceptableContentTypes`: - Returns the list of accepted content types ordered by descending quality; + returns the list of accepted content types ordered by descending quality; * :method:`Symfony\\Component\\HttpFoundation\\Request::getLanguages`: - Returns the list of accepted languages ordered by descending quality; + returns the list of accepted languages ordered by descending quality; * :method:`Symfony\\Component\\HttpFoundation\\Request::getCharsets`: - Returns the list of accepted languages ordered by descending quality; + returns the list of accepted languages ordered by descending quality; -If you need to egt full access to parsed data from ``Accept``, ``Accept-Language``, +If you need to get full access to parsed data from ``Accept``, ``Accept-Language``, ``Accept-Charset`` or ``Accept-Encoding``, you can use :class:`Symfony\\Component\\HttpFoundation\\AcceptHeader` utility class:: + use Symfony\Component\HttpFoundation\AcceptHeader; + $accept = AcceptHeader::fromString($request->headers->get('Accept')); if ($accept->has('text/html') { $item = $accept->get('html'); From 5bc503dcb11de383184c4c28c85b694008b54e6e Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 16 Nov 2012 07:03:29 -0600 Subject: [PATCH 0033/2078] [#1868] Adding a versionadded for the new AcceptHeader class --- components/http_foundation/introduction.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index f3720d6a3fa..1831c480f96 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -229,6 +229,9 @@ by using the following methods: * :method:`Symfony\\Component\\HttpFoundation\\Request::getCharsets`: returns the list of accepted languages ordered by descending quality; +.. versionadded:: 2.2 + The :class:`Symfony\\Component\\HttpFoundation\\AcceptHeader` class is new in Symfony 2.2. + If you need to get full access to parsed data from ``Accept``, ``Accept-Language``, ``Accept-Charset`` or ``Accept-Encoding``, you can use :class:`Symfony\\Component\\HttpFoundation\\AcceptHeader` utility class:: From 1d2aefa24c0e0bd368fb073dc449929b7b48e393 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 22 Nov 2012 14:20:33 -0500 Subject: [PATCH 0034/2078] [#1894] Refactoring the hostname routing stuff into a component "cookbook" article with inter-links --- book/routing.rst | 163 ++---------------------- components/map.rst.inc | 1 + components/routing/hostname_pattern.rst | 163 ++++++++++++++++++++++++ components/routing/index.rst | 1 + components/routing/introduction.rst | 5 +- 5 files changed, 178 insertions(+), 155 deletions(-) create mode 100644 components/routing/hostname_pattern.rst diff --git a/book/routing.rst b/book/routing.rst index 27f4d1f372c..d3cdbf6fda0 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -703,117 +703,9 @@ Adding a Hostname Pattern .. versionadded:: 2.2 Hostname matching support was added in Symfony 2.2 -You can also match on the HTTP *hostname* of the incoming request: - -.. configuration-block:: - - .. code-block:: yaml - - mobile_homepage: - pattern: / - hostname_pattern: m.example.com - defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } - - homepage: - pattern: / - defaults: { _controller: AcmeDemoBundle:Main:homepage } - - .. code-block:: xml - - - - - - - AcmeDemoBundle:Main:mobileHomepage - - - - AcmeDemoBundle:Main:homepage - - - - .. code-block:: php - - use Symfony\Component\Routing\RouteCollection; - use Symfony\Component\Routing\Route; - - $collection = new RouteCollection(); - $collection->add('mobile_homepage', new Route('/', array( - '_controller' => 'AcmeDemoBundle:Main:mobileHomepage', - ), array(), array(), 'm.example.com')); - - $collection->add('homepage', new Route('/', array( - '_controller' => 'AcmeDemoBundle:Main:homepage', - ))); - - return $collection; - -Both routes match the same pattern ``/``, however the first one will match -only if the hostname is ``m.example.com``. - -Placeholders and Requirements in Hostname Patterns --------------------------------------------------- - -Placeholders can be used in hostname patterns as well as in patterns, and -requirements also apply to them. - -In the following example we avoid hardcoding the domain name by using a -placeholder and a requirement. ``%domain%`` in requirements is replaced -by the value of the ``domain`` dependency injection container parameter. - -.. configuration-block:: - - .. code-block:: yaml - - mobile_homepage: - pattern: / - hostname_pattern: m.{domain} - defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } - requirements: - domain: %domain% - - homepage: - pattern: / - defaults: { _controller: AcmeDemoBundle:Main:homepage } - - .. code-block:: xml - - - - - - - AcmeDemoBundle:Main:mobileHomepage - %domain% - - - - AcmeDemoBundle:Main:homepage - - - - .. code-block:: php - - use Symfony\Component\Routing\RouteCollection; - use Symfony\Component\Routing\Route; - - $collection = new RouteCollection(); - $collection->add('mobile_homepage', new Route('/', array( - '_controller' => 'AcmeDemoBundle:Main:mobileHomepage', - ), array( - 'domain' => '%domain%', - ), array(), 'm.{domain}')); - - $collection->add('homepage', new Route('/', array( - '_controller' => 'AcmeDemoBundle:Main:homepage', - ))); - - return $collection; +You can also match on the HTTP *hostname* of the incoming request. For more +information, see :doc:`/components/routing/hostname_pattern` in the Routing +component documentation. .. index:: single: Routing; Advanced example @@ -1137,53 +1029,20 @@ instead of simply ``/hello/{name}``: The string ``/admin`` will now be prepended to the pattern of each route loaded from the new routing resource. +.. tip:: + + You can also define routes using annotations. See the + :doc:`FrameworkExtraBundle documentation` + to see how. + Adding a Hostname Pattern to Imported Routes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 2.2 Hostname matching support was added in Symfony 2.2 -You can set a hostname pattern on imported routes: - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/routing.yml - acme_hello: - resource: "@AcmeHelloBundle/Resources/config/routing.yml" - hostname_pattern: "hello.example.com" - - .. code-block:: xml - - - - - - - - - - .. code-block:: php - - // app/config/routing.php - use Symfony\Component\Routing\RouteCollection; - - $collection = new RouteCollection(); - $collection->addCollection($loader->import("@AcmeHelloBundle/Resources/config/routing.php"), '', array(), array(), array(), 'hello.example.com'); - - return $collection; - -The hostname pattern ``hello.example.com`` will be set on each route -loaded from the new routing resource. - -.. tip:: - - You can also define routes using annotations. See the - :doc:`FrameworkExtraBundle documentation` - to see how. +You can set a hostname pattern on imported routes. For more information, +see :ref:`component-routing-hostname-imported`. .. index:: single: Routing; Debugging diff --git a/components/map.rst.inc b/components/map.rst.inc index 810ef075d07..fd95dab56c3 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -67,6 +67,7 @@ * :doc:`/components/routing/index` * :doc:`/components/routing/introduction` + * :doc:`/components/routing/hostname_pattern` * **Serializer** diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst new file mode 100644 index 00000000000..d632545adfb --- /dev/null +++ b/components/routing/hostname_pattern.rst @@ -0,0 +1,163 @@ +.. index:: + single: Routing; Matching on Hostname + +How to match a route based on the Hostname +========================================== + +.. versionadded:: 2.2 + Hostname matching support was added in Symfony 2.2 + +You can also match on the HTTP *hostname* of the incoming request. + +.. configuration-block:: + + .. code-block:: yaml + + mobile_homepage: + pattern: / + hostname_pattern: m.example.com + defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } + + homepage: + pattern: / + defaults: { _controller: AcmeDemoBundle:Main:homepage } + + .. code-block:: xml + + + + + + + AcmeDemoBundle:Main:mobileHomepage + + + + AcmeDemoBundle:Main:homepage + + + + .. code-block:: php + + use Symfony\Component\Routing\RouteCollection; + use Symfony\Component\Routing\Route; + + $collection = new RouteCollection(); + $collection->add('mobile_homepage', new Route('/', array( + '_controller' => 'AcmeDemoBundle:Main:mobileHomepage', + ), array(), array(), 'm.example.com')); + + $collection->add('homepage', new Route('/', array( + '_controller' => 'AcmeDemoBundle:Main:homepage', + ))); + + return $collection; + +Both routes match the same pattern ``/``, however the first one will match +only if the hostname is ``m.example.com``. + +Placeholders and Requirements in Hostname Patterns +-------------------------------------------------- + +If you're using the :doc:`DependencyInjection Component` +(or the full Symfony2 Framework), then you can use +:ref:`service container parameters` as +variables anywhere in your routes. + +You can avoid hardcoding the domain name by using a placeholder and a requirement. +The ``%domain%`` in requirements is replaced by the value of the ``domain`` +dependency injection container parameter. + +.. configuration-block:: + + .. code-block:: yaml + + mobile_homepage: + pattern: / + hostname_pattern: m.{domain} + defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } + requirements: + domain: %domain% + + homepage: + pattern: / + defaults: { _controller: AcmeDemoBundle:Main:homepage } + + .. code-block:: xml + + + + + + + AcmeDemoBundle:Main:mobileHomepage + %domain% + + + + AcmeDemoBundle:Main:homepage + + + + .. code-block:: php + + use Symfony\Component\Routing\RouteCollection; + use Symfony\Component\Routing\Route; + + $collection = new RouteCollection(); + $collection->add('mobile_homepage', new Route('/', array( + '_controller' => 'AcmeDemoBundle:Main:mobileHomepage', + ), array( + 'domain' => '%domain%', + ), array(), 'm.{domain}')); + + $collection->add('homepage', new Route('/', array( + '_controller' => 'AcmeDemoBundle:Main:homepage', + ))); + + return $collection; + +.. _component-routing-hostname-imported: + +Adding a Hostname Pattern to Imported Routes +-------------------------------------------- + +You can set a hostname pattern on imported routes: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/routing.yml + acme_hello: + resource: "@AcmeHelloBundle/Resources/config/routing.yml" + hostname_pattern: "hello.example.com" + + .. code-block:: xml + + + + + + + + + + .. code-block:: php + + // app/config/routing.php + use Symfony\Component\Routing\RouteCollection; + + $collection = new RouteCollection(); + $collection->addCollection($loader->import("@AcmeHelloBundle/Resources/config/routing.php"), '', array(), array(), array(), 'hello.example.com'); + + return $collection; + +The hostname pattern ``hello.example.com`` will be set on each route +loaded from the new routing resource. diff --git a/components/routing/index.rst b/components/routing/index.rst index 33610e31730..b7f4d40386b 100644 --- a/components/routing/index.rst +++ b/components/routing/index.rst @@ -5,3 +5,4 @@ Routing :maxdepth: 2 introduction + hostname_pattern diff --git a/components/routing/introduction.rst b/components/routing/introduction.rst index b40bbc0057e..e4c7ae4b76f 100644 --- a/components/routing/introduction.rst +++ b/components/routing/introduction.rst @@ -85,9 +85,8 @@ placeholders as regular expressions. 4. An array of options. These contain internal settings for the route and are the least commonly needed. -5. A hostname pattern. This is matched against the hostname passed to the -`RequestContext`, and can contain named wildcard placeholders (e.g. -``{placeholders}``) to match dynamic parts in the hostname. +5. A hostname pattern. This is matched against the hostname of the request. +See :doc:`/components/routing/hostname_pattern` for more details. .. versionadded:: 2.2 The hostname pattern was added in Symfony 2.2 From a96b2ea95e48ab11f28680298cd96cf76d8f6512 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 22 Nov 2012 17:04:45 -0500 Subject: [PATCH 0035/2078] Tweak per @WouterJ in sha: 1d2aefa24c0e0bd368fb073dc449929b7b48e393 --- components/routing/hostname_pattern.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst index d632545adfb..f41f2db5414 100644 --- a/components/routing/hostname_pattern.rst +++ b/components/routing/hostname_pattern.rst @@ -28,7 +28,9 @@ You can also match on the HTTP *hostname* of the incoming request. + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd" + > AcmeDemoBundle:Main:mobileHomepage From 3937bbb1a66cd08e3aca568a570016760f568c80 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 23 Nov 2012 11:20:56 -0500 Subject: [PATCH 0036/2078] [#1916] Minor formatting tweaks --- cookbook/console/generating_urls.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cookbook/console/generating_urls.rst b/cookbook/console/generating_urls.rst index df6136f82cc..6147d170232 100644 --- a/cookbook/console/generating_urls.rst +++ b/cookbook/console/generating_urls.rst @@ -23,8 +23,7 @@ Configuring the Request Context globally The ``host`` and ``scheme`` parameters are available since Symfony 2.1 .. versionadded: 2.2 - - The base_url parameter is available since Symfony 2.2 + The ``base_url`` parameter is available since Symfony 2.2 To configure the Request Context - which is used by the URL Generator - you can redefine the parameters it uses as default values to change the default host From 65aa6a7f5604a11cb4bd0fe853b0c63427d8ac4e Mon Sep 17 00:00:00 2001 From: Armen Mkrtchyan Date: Sat, 24 Nov 2012 11:54:26 +0100 Subject: [PATCH 0037/2078] fixed issue:1943 a typo --- quick_tour/the_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quick_tour/the_controller.rst b/quick_tour/the_controller.rst index c11c5473140..7eb4c61b33b 100755 --- a/quick_tour/the_controller.rst +++ b/quick_tour/the_controller.rst @@ -131,7 +131,7 @@ from any controller:: $foo = $session->get('foo'); // use a default value if the key doesn't exist - $filters = $session->get('filters', array()); + $filters = $session->set('filters', array()); You can also store small messages that will only be available for the very next request:: From 18aaa2b31bb3586677c33e55e735c39b8967bf31 Mon Sep 17 00:00:00 2001 From: Armen Mkrtchyan Date: Sat, 24 Nov 2012 17:09:34 +0100 Subject: [PATCH 0038/2078] added Stopwatch component documentation --- components/index.rst | 1 + components/map.rst.inc | 4 ++ components/stopwatch.rst | 87 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 components/stopwatch.rst diff --git a/components/index.rst b/components/index.rst index f0951107357..cb137b584fb 100644 --- a/components/index.rst +++ b/components/index.rst @@ -19,6 +19,7 @@ The Components process routing/index serializer + stopwatch templating yaml diff --git a/components/map.rst.inc b/components/map.rst.inc index 03d3fd810f8..335154530c5 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -75,6 +75,10 @@ * :doc:`/components/serializer` +* **Stopwatch** + + * :doc:`/components/stopwatch` + * **Templating** * :doc:`/components/templating` diff --git a/components/stopwatch.rst b/components/stopwatch.rst new file mode 100644 index 00000000000..f4d2febef37 --- /dev/null +++ b/components/stopwatch.rst @@ -0,0 +1,87 @@ +.. index:: + single: Stopwatch + single: Components; Stopwatch + +The Stopwatch Component +======================= + + Stopwatch component provides a way to profile code. + +Installation +------------ + +You can install the component in two different ways: + +* Use the official Git repository (https://github.com/symfony/Stopwatch); +* :doc:`Install it via Composer` (``symfony/stopwatch`` on `Packagist`_). + +Usage +----- + +The Stopwatch component provides an easy and consistent way to measure execution time of certain parts of code, so that you don't constantly have to parse microtime by yourself. The basic usage is as simple as this:: + + use Symfony\Component\Stopwatch\Stopwatch; + + $stopwatch = new Stopwatch(); + // Start event named 'eventName' + $stopwatch->start('eventName'); + // some code goes here + $event = $stopwatch->stop('eventName'); + +You also can provide a category name to an event:: + + $stopwatch->start('eventName', 'categoryName'); + +You can consider categories as a way of tagging events. The Symfony Profiler tool uses categories to nicely colorcode different events. + +Periods +------- + +As we all know from the real world, all stopwatches come with two buttons. One for starting and stopping the stopwatch, another to measure the lap time. And that's exactly what lap method does. :: + + $stopwatch = new Stopwatch(); + // Start event named 'foo' + $stopwatch->start('foo'); + // some code goes here + $stopwatch->lap('foo'); + // some code goes here + $stopwatch->lap('foo'); + // some other code goes here + $event = $stopwatch->stop('foo'); + +Lap information is stored in periods within the event. To get lap information aka periods call :: + + $event->getPeriods(); + +Besides getting periods, we can get other useful information from the event object. E.g:: + + $event->getCategory(); // Returns the category the evenent was started in + $event->getOrigin(); // Returns the start time of the Event in milliseconds + $event->ensureStopped(); // Stops all non already stopped periods + $event->getStartTime(); // Returns the start of the very first period + $event->getEndTime(); // Returns the end time of the very last period + $event->getDuration(); // Gets the duration (including all periods) of the event + $event->getMemory(); // Gets the max memory usage of all periods + + +Sections +-------- + +Sections are a way to logically split the timeline into groups. You can see how Symfony uses sections to nicely visualize framework lifecycle in the Symfony Profiler tool. Here is a basic usage of sections.:: + + $stopwatch = new Stopwatch(); + + $stopwatch->openSection(); + $stopwatch->start('parisng_config_file', 'filesystem_operations'); + $stopwatch->stopSection('routing'); + + $events = $stopwatch->getSectionEvents('section'); + + +You can reopen a closed section by calling the openSection method and specifying an id of the section to be reopened. e.g.:: + + $stopwatch->openSection('routing'); + $stopwatch->start('building_config_tree'); + $stopwatch->stopSection('routing'); + +.. _Packagist: https://packagist.org/packages/symfony/stopwatch From 59a325807ffa646ff19dfbf2ac63d1cae493c890 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 25 Nov 2012 19:58:11 -0500 Subject: [PATCH 0039/2078] [#1959] Adding line breaks after the 72nd character - no other changes --- components/stopwatch.rst | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/components/stopwatch.rst b/components/stopwatch.rst index f4d2febef37..c89c99fc4cb 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -18,7 +18,9 @@ You can install the component in two different ways: Usage ----- -The Stopwatch component provides an easy and consistent way to measure execution time of certain parts of code, so that you don't constantly have to parse microtime by yourself. The basic usage is as simple as this:: +The Stopwatch component provides an easy and consistent way to measure execution +time of certain parts of code, so that you don't constantly have to parse +microtime by yourself. The basic usage is as simple as this:: use Symfony\Component\Stopwatch\Stopwatch; @@ -32,12 +34,15 @@ You also can provide a category name to an event:: $stopwatch->start('eventName', 'categoryName'); -You can consider categories as a way of tagging events. The Symfony Profiler tool uses categories to nicely colorcode different events. +You can consider categories as a way of tagging events. The Symfony Profiler +tool uses categories to nicely colorcode different events. Periods ------- -As we all know from the real world, all stopwatches come with two buttons. One for starting and stopping the stopwatch, another to measure the lap time. And that's exactly what lap method does. :: +As we all know from the real world, all stopwatches come with two buttons. +One for starting and stopping the stopwatch, another to measure the lap time. +And that's exactly what lap method does. :: $stopwatch = new Stopwatch(); // Start event named 'foo' @@ -67,7 +72,9 @@ Besides getting periods, we can get other useful information from the event obje Sections -------- -Sections are a way to logically split the timeline into groups. You can see how Symfony uses sections to nicely visualize framework lifecycle in the Symfony Profiler tool. Here is a basic usage of sections.:: +Sections are a way to logically split the timeline into groups. You can see +how Symfony uses sections to nicely visualize framework lifecycle in the +Symfony Profiler tool. Here is a basic usage of sections.:: $stopwatch = new Stopwatch(); @@ -78,7 +85,8 @@ Sections are a way to logically split the timeline into groups. You can see how $events = $stopwatch->getSectionEvents('section'); -You can reopen a closed section by calling the openSection method and specifying an id of the section to be reopened. e.g.:: +You can reopen a closed section by calling the openSection method and specifying +an id of the section to be reopened. e.g.:: $stopwatch->openSection('routing'); $stopwatch->start('building_config_tree'); From 4b0ad60cad07d2fa125ba850dc787c2565818022 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 25 Nov 2012 20:04:17 -0500 Subject: [PATCH 0040/2078] [#1959] Tweaks for new stopwatch component docs --- components/stopwatch.rst | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/components/stopwatch.rst b/components/stopwatch.rst index c89c99fc4cb..6dcb0267692 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -7,6 +7,10 @@ The Stopwatch Component Stopwatch component provides a way to profile code. +.. versionadded:: 2.2 + The Stopwatch Component is new to Symfony 2.2. Previously, the ``Stopwatch`` + class was located in the ``HttpKernel`` component. + Installation ------------ @@ -19,8 +23,9 @@ Usage ----- The Stopwatch component provides an easy and consistent way to measure execution -time of certain parts of code, so that you don't constantly have to parse -microtime by yourself. The basic usage is as simple as this:: +time of certain parts of code so that you don't constantly have to parse +microtime by yourself. Instead, use the simple +:class:`Symfony\\Component\\Stopwatch\\Stopwatch` class:: use Symfony\Component\Stopwatch\Stopwatch; @@ -35,14 +40,15 @@ You also can provide a category name to an event:: $stopwatch->start('eventName', 'categoryName'); You can consider categories as a way of tagging events. The Symfony Profiler -tool uses categories to nicely colorcode different events. +tool, for example, uses categories to nicely color-code different events. Periods ------- -As we all know from the real world, all stopwatches come with two buttons. +As you know from the real world, all stopwatches come with two buttons. One for starting and stopping the stopwatch, another to measure the lap time. -And that's exactly what lap method does. :: +This is exactly what the :method:`Symfony\\Component\\Stopwatch\\Stopwatch::lap`` +method does:: $stopwatch = new Stopwatch(); // Start event named 'foo' @@ -54,39 +60,39 @@ And that's exactly what lap method does. :: // some other code goes here $event = $stopwatch->stop('foo'); -Lap information is stored in periods within the event. To get lap information aka periods call :: +Lap information is stored in periods within the event. To get lap information +(aka periods) call:: $event->getPeriods(); -Besides getting periods, we can get other useful information from the event object. E.g:: +Besides getting periods, you can get other useful information from the event object. +For example:: $event->getCategory(); // Returns the category the evenent was started in $event->getOrigin(); // Returns the start time of the Event in milliseconds - $event->ensureStopped(); // Stops all non already stopped periods + $event->ensureStopped(); // Stops all not-already-stopped periods $event->getStartTime(); // Returns the start of the very first period $event->getEndTime(); // Returns the end time of the very last period $event->getDuration(); // Gets the duration (including all periods) of the event $event->getMemory(); // Gets the max memory usage of all periods - Sections -------- Sections are a way to logically split the timeline into groups. You can see how Symfony uses sections to nicely visualize framework lifecycle in the -Symfony Profiler tool. Here is a basic usage of sections.:: +Symfony Profiler tool. Here is a basic usage of sections:: $stopwatch = new Stopwatch(); $stopwatch->openSection(); - $stopwatch->start('parisng_config_file', 'filesystem_operations'); + $stopwatch->start('parsing_config_file', 'filesystem_operations'); $stopwatch->stopSection('routing'); - $events = $stopwatch->getSectionEvents('section'); - + $events = $stopwatch->getSectionEvents('routing'); You can reopen a closed section by calling the openSection method and specifying -an id of the section to be reopened. e.g.:: +an id of the section to be reopened:: $stopwatch->openSection('routing'); $stopwatch->start('building_config_tree'); From 593168f431f1ad28db8155cd0644ccf989bbbea4 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 26 Nov 2012 09:43:41 -0500 Subject: [PATCH 0041/2078] [Stopwatch] Adding note about the Stopwatch class being added in 2.1 per @Stof --- components/stopwatch.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/stopwatch.rst b/components/stopwatch.rst index 6dcb0267692..9e120b42439 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -9,7 +9,7 @@ The Stopwatch Component .. versionadded:: 2.2 The Stopwatch Component is new to Symfony 2.2. Previously, the ``Stopwatch`` - class was located in the ``HttpKernel`` component. + class was located in the ``HttpKernel`` component (and was new in 2.1). Installation ------------ From daa59508c96a54ed382f2a557435fb874b2f986f Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 26 Nov 2012 09:50:18 -0500 Subject: [PATCH 0042/2078] [Stopwatch] Fixing a few standards per @WouterJ --- components/stopwatch.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/stopwatch.rst b/components/stopwatch.rst index 9e120b42439..3ba153457e5 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -32,7 +32,7 @@ microtime by yourself. Instead, use the simple $stopwatch = new Stopwatch(); // Start event named 'eventName' $stopwatch->start('eventName'); - // some code goes here + // ... some code goes here $event = $stopwatch->stop('eventName'); You also can provide a category name to an event:: @@ -53,11 +53,11 @@ method does:: $stopwatch = new Stopwatch(); // Start event named 'foo' $stopwatch->start('foo'); - // some code goes here + // ... some code goes here $stopwatch->lap('foo'); - // some code goes here + // ... some code goes here $stopwatch->lap('foo'); - // some other code goes here + // ... some other code goes here $event = $stopwatch->stop('foo'); Lap information is stored in periods within the event. To get lap information From 31c279328309c058c90d794e35e7e66760ade9aa Mon Sep 17 00:00:00 2001 From: Elnur Abdurrakhimov Date: Sat, 1 Dec 2012 22:19:48 +0400 Subject: [PATCH 0043/2078] Added a section on the BCrypt password encoder. --- book/security.rst | 68 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/book/security.rst b/book/security.rst index 94eb09084b1..1d3bb86c0e5 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1198,6 +1198,74 @@ from the hashed password). .. versionadded:: 2.2 As of Symfony 2.2 you can also use the PBKDF2 password encoder. +Using the BCrypt Password Encoder +................................. + +.. versionadded:: 2.2 + The BCrypt password encoder was added in Symfony 2.2. + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/security.yml + security: + # ... + encoders: + Symfony\Component\Security\Core\User\User: + algorithm: bcrypt + cost: 15 + + .. code-block:: xml + + + + + + + + .. code-block:: php + + // app/config/security.php + $container->loadFromExtension('security', array( + // ... + 'encoders' => array( + 'Symfony\Component\Security\Core\User\User' => array( + 'algorithm' => 'bcrypt', + 'cost' => 15, + ), + ), + )); + +``cost`` can be in the range of ``4-31`` and determines how long a password +will be encoded. Each increment of ``cost`` *doubles* the time it takes to +encode a password. + +If you don't provide the ``cost`` option, the default cost of ``13`` is used. + +.. note:: + + You can change the cost at any time — even if you already have some + passwords encoded using a different cost. New passwords will be encoded + using the new cost, while the already encoded ones will be validated + using a cost that was used back when they were encoded. + +A salt for each new password is generated automatically and need not be +persisted. Since an encoded password contains the salt used to encode it, +persisting the encoded password alone is enough. + +.. note:: + + All the encoded passwords are ``60`` characters long, so make sure to + allocate enough space for them to be persisted. + +Determining the Hashed Password +............................... + If you have some sort of registration form for users, you'll need to be able to determine the hashed password so that you can set it on your user. No matter what algorithm you configure for your user object, the hashed password From ab43fd9521a428ad0881630b652f5c5b3ac12783 Mon Sep 17 00:00:00 2001 From: dantleech Date: Thu, 6 Dec 2012 18:43:09 +0100 Subject: [PATCH 0044/2078] Added twig.loader definition to dic_tags --- reference/dic_tags.rst | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index febb5d80c6f..5f9f4e7a939 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -50,6 +50,8 @@ the AsseticBundle has several tags that aren't listed here. +-----------------------------------+---------------------------------------------------------------------------+ | `twig.extension`_ | Register a custom Twig Extension | +-----------------------------------+---------------------------------------------------------------------------+ +| `twig.loader`_ | Register a custom service that loads Twig templates | ++-----------------------------------+---------------------------------------------------------------------------+ | `validator.constraint_validator`_ | Create your own custom validation constraint | +-----------------------------------+---------------------------------------------------------------------------+ | `validator.initializer`_ | Register a service that initializes objects before validation | @@ -743,6 +745,37 @@ also have to be added as regular services: ->addTag('twig.extension') ; +twig.loader +----------- + +**Purpose**: Register a custom service that loads Twig templates + +To enable a custom Twig template loader, add it as a regular service in one +of your configuration, and tag it with ``twig.loader``: + +.. configuration-block:: + + .. code-block:: yaml + + services: + twig.loader.your_loader_name: + class: Fully\Qualified\Loader\Class\Name + tags: + - { name: twig.loader } + + .. code-block:: xml + + + + + + .. code-block:: php + + $container + ->register('twig.loader.your_loader_name', 'Fully\Qualified\Loader\Class\Name') + ->addTag('twig.loader') + ; + validator.constraint_validator ------------------------------ From 497dd7bbb83e5c86680433c68ace3a75a9084d14 Mon Sep 17 00:00:00 2001 From: Fabian Steiner Date: Sat, 8 Dec 2012 02:13:07 +0100 Subject: [PATCH 0045/2078] Typo: $app->getHelperSet() instead of $this->getHelperSet() --- components/console/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 9d52276414e..c1d85862083 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -383,7 +383,7 @@ information, which updates as your command runs: To display progress details, use the :class:`Symfony\\Component\\Console\\Helper\\ProgressHelper`, pass it a total number of units, and advance the progress as your command executes:: - $progress = $app->getHelperSet()->get('progress'); + $progress = $this->getHelperSet()->get('progress'); $progress->start($output, 50); $i = 0; From bc611fc554091bd4b808b67af6f20de69c1a28d4 Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Fri, 7 Dec 2012 13:15:53 +0100 Subject: [PATCH 0046/2078] added docs for PrependExtensionInterface --- .../dependency_injection/compilation.rst | 23 +++ cookbook/bundles/index.rst | 1 + cookbook/bundles/prepend_extension.rst | 135 ++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 cookbook/bundles/prepend_extension.rst diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index b7c54d19484..c244ff457a1 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -248,6 +248,29 @@ but also load a secondary one only if a certain parameter is set:: .. _components-dependency-injection-compiler-passes: +Prepending configuration passed to the Extension +------------------------------------------------ + +An Extension can prepend the configuration of any Bundle before the ``load()`` +method is called by implementing :class:`Symfony\\Component\\DependencyInjection\\Compiler\\PrependExtensionInterface`:: + + use Symfony\Component\DependencyInjection\Compiler\PrependExtensionInterface; + // ... + + class AcmeDemoExtension implements ExtensionInterface, PrependExtensionInterface + { + // ... + + public function prepend() + { + // ... + + $container->prependExtensionConfig($name, $config); + + // ... + } + } + Creating a Compiler Pass ------------------------ diff --git a/cookbook/bundles/index.rst b/cookbook/bundles/index.rst index c9a4b97ae27..aeeb5ec5fe7 100644 --- a/cookbook/bundles/index.rst +++ b/cookbook/bundles/index.rst @@ -8,3 +8,4 @@ Bundles inheritance override extension + prepend_extension diff --git a/cookbook/bundles/prepend_extension.rst b/cookbook/bundles/prepend_extension.rst new file mode 100644 index 00000000000..eb3f4c5ef18 --- /dev/null +++ b/cookbook/bundles/prepend_extension.rst @@ -0,0 +1,135 @@ +.. index:: + single: Configuration; Semantic + single: Bundle; Extension configuration + +How to simplify configuration of multiple Bundle +================================================ + +Especially when building reusable and extensible applications developers are +often faced with a choice, either create a single Bundle or create multiple +Bundles. Creating a single Bundle has the draw back that its impossible for +users to choose to remove functionality they are not using. Creating multiple +Bundles has the draw back that configuration becomes more tedious and settings +often need to be repeated for various Bundles. + +Using the below approach it is possible to remove the disadvantage of the +multiple Bundle approach, by enabling a single Extension to prepend the settings +for any Bundle. It can use the settings defined in the ``app/config/config.yml`` +to prepend settings just as if they would have been written explicitly by the +user in the application configuration. + +For example, this could be used to configure the entity manager name to use in +multiple Bundle. Or it can be used to enable an optional feature that depends +on another Bundle being loaded as well. + +In order for an Extension to be able to do this it needs to implement +:class:`Symfony\\Component\\DependencyInjection\\Compiler\\PrependExtensionInterface`:: + + // src/Acme/HelloBundle/DependencyInjection/AcmeHelloExtension.php + namespace Acme\HelloBundle\DependencyInjection; + + use Symfony\Component\HttpKernel\DependencyInjection\Extension; + use Symfony\Component\\DependencyInjection\PrependExtensionInterface; + use Symfony\Component\DependencyInjection\ContainerBuilder; + + class AcmeHelloExtension extends Extension implements PrependExtensionInterface + { + // ... + + public function prepend(ContainerBuilder $container) + { + // ... + } + } + +Inside the :method:`Symfony\\Component\\DependencyInjection\\Compiler\\PrependExtensionInterface::prepend()` +method developers have full access to the :class:`Symfony\Component\DependencyInjection\ContainerBuilder` +instance just before the :method:`Symfony\Component\HttpKernel\DependencyInjection\ExtensionInterface:load()` +method is called on the registered Bundle Extensions. In order to prepend settings +to a Bundle extension developers can use the +:method:`Symfony\Component\DependencyInjection\ContainerBuilder:prependExtensionConfig()` +method on the :class:`Symfony\Component\DependencyInjection\ContainerBuilder` +instance. As this method only prepends settings, any other settings done explicitly +inside the ``app/config/config.yml`` would override these prepended settings. + +The following example illustrates how to prepend +a configuration setting in multiple Bundles as well as disable a flag in multiple Bundles +in case specific other Bundle is not registered:: + + public function prepend(ContainerBuilder $container) + { + // get all Bundles + $bundles = $container->getParameter('kernel.bundles'); + // determine if AcmeGoodbyeBundle is registered + if (!isset($bundles['AcmeGoodbyeBundle'])) { + // disable AcmeGoodbyeBundle in Bundles + $config = array('use_acme_goodbye' => false); + foreach ($container->getExtensions() as $name => $extension) { + switch ($name) { + case 'acme_something': + case 'acme_other': + // set use_acme_goodbye to false in the config of acme_something and acme_other + // note that if the user manually configured use_acme_goodbye to true in the + // app/config/config.yml then the setting would in the end be true and not false + $container->prependExtensionConfig($name, $config); + break; + } + } + } + + // process the configuration of AcmeHelloExtension + $configs = $container->getExtensionConfig($this->getAlias()); + // use the Configuration class to generate a config array with the settings ``acme_hello`` + $config = $this->processConfiguration(new Configuration(), $configs); + + // check if entity_manager_name is set in the ``acme_hello`` configuration + if (isset($config['entity_manager_name'])) { + // prepend the acme_something settings with the entity_manager_name + $config = array('entity_manager_name' => $config['entity_manager_name']); + $container->prependExtensionConfig('acme_something', $config); + } + } + +The above would be the equivalent of writing the following into the ``app/config/config.yml`` +in case ``AcmeGoodbyeBundle`` is not registered and the ``entity_manager_name`` setting +for ``acme_hello`` is set to ``non_default``:: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + + acme_something: + # ... + use_acme_goodbye: false + entity_manager_name: non_default + + acme_other: + # ... + use_acme_goodbye: false + + .. code-block:: xml + + + + + non_default + + + + + .. code-block:: php + + // app/config/config.php + + $container->loadFromExtension('acme_something', array( + ..., + 'use_acme_goodbye' => false, + 'entity_manager_name' => 'non_default', + )); + $container->loadFromExtension('acme_other', array( + ..., + 'use_acme_goodbye' => false, + )); + From a3e41f4f6c28c3326ef556fc7244343c927cfc4a Mon Sep 17 00:00:00 2001 From: Matthieu Moquet Date: Fri, 14 Dec 2012 14:08:54 +0100 Subject: [PATCH 0047/2078] [Console] Fix a typo in a method name @see https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Helper/ProgressHelper.php#L142 --- components/console/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 9d52276414e..997d14c1172 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -416,7 +416,7 @@ progress bar:: $progress->setBarCharacter('='); // the unfinished part of the bar $progress->setEmptyBarCharacter(' '); - $progress->setProgressChar('|'); + $progress->setProgressCharacter('|'); $progress->setBarWidth(50); To see other available options, check the API documentation for From bd24a0a22a5f5240b5b0aea30784f2cd305707b2 Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Fri, 14 Dec 2012 16:15:47 +0100 Subject: [PATCH 0048/2078] [Form] Simplified "Dynamic Form Generation" to make use of the new alternative Form::add() signature --- cookbook/form/dynamic_form_generation.rst | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/cookbook/form/dynamic_form_generation.rst b/cookbook/form/dynamic_form_generation.rst index 7cdf3de9155..ae82f9aa827 100644 --- a/cookbook/form/dynamic_form_generation.rst +++ b/cookbook/form/dynamic_form_generation.rst @@ -64,9 +64,9 @@ to an Event Subscriber:: { public function buildForm(FormBuilderInterface $builder, array $options) { - $subscriber = new AddNameFieldSubscriber($builder->getFormFactory()); - $builder->addEventSubscriber($subscriber); $builder->add('price'); + + $builder->addEventSubscriber(new AddNameFieldSubscriber()); } public function getName() @@ -75,10 +75,6 @@ to an Event Subscriber:: } } -The event subscriber is passed the FormFactory object in its constructor so -that your new subscriber is capable of creating the form widget once it is -notified of the dispatched event during form creation. - .. _`cookbook-forms-inside-subscriber-class`: Inside the Event Subscriber Class @@ -93,18 +89,10 @@ might look like the following:: use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; - use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class AddNameFieldSubscriber implements EventSubscriberInterface { - private $factory; - - public function __construct(FormFactoryInterface $factory) - { - $this->factory = $factory; - } - public static function getSubscribedEvents() { // Tells the dispatcher that you want to listen on the form.pre_set_data @@ -128,7 +116,7 @@ might look like the following:: // check if the product object is "new" if (!$data->getId()) { - $form->add($this->factory->createNamed('name', 'text')); + $form->add('name', 'text'); } } } From 7a8b89c06e04e9d5f3528410951c516b6384ef1b Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Fri, 14 Dec 2012 16:13:25 +0200 Subject: [PATCH 0049/2078] Added documentation for hinclude default templates --- book/templating.rst | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/book/templating.rst b/book/templating.rst index 5db7295eae4..845119b070e 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -704,6 +704,53 @@ in your application configuration: ), )); +.. versionadded:: 2.2 + Default templates per render tag was added in Symfony 2.2 + +You can define default templates per ``render`` tag (which will override any global default templates that is defined): + +.. configuration-block:: + + .. code-block:: jinja + + {% render '...:news' with + {}, + {'standalone': 'js', 'default': 'AcmeDemoBundle:Default:content.html.twig'} + %} + + .. code-block:: php + + render( + '...:news', + array(), + array( + 'standalone' => 'js', + 'default' => 'AcmeDemoBundle:Default:content.html.twig', + ) + ) ?> + +Or you can also specify a string to display as the default content: + +.. configuration-block:: + + .. code-block:: jinja + + {% render '...:news' with + {}, + {'standalone': 'js', 'default': 'Loading...'} + %} + + .. code-block:: php + + render( + '...:news', + array(), + array( + 'standalone' => 'js', + 'default' => 'Loading...', + ) + ) ?> + .. index:: single: Templating; Linking to pages From a6fb752af0fcc83997ccd903296ff69377aa6930 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 17 Dec 2012 21:23:55 -0600 Subject: [PATCH 0050/2078] [#2021] Breaking a line --- book/templating.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/book/templating.rst b/book/templating.rst index 845119b070e..5042947b3b0 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -707,7 +707,8 @@ in your application configuration: .. versionadded:: 2.2 Default templates per render tag was added in Symfony 2.2 -You can define default templates per ``render`` tag (which will override any global default templates that is defined): +You can define default templates per ``render`` tag (which will override +any global default templates that is defined): .. configuration-block:: From 4a538777e6410d128d982375f8cc154ca9f94f05 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 17 Dec 2012 21:27:35 -0600 Subject: [PATCH 0051/2078] [#2023] Adding a missing versionadded --- reference/constraints/Luhn.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reference/constraints/Luhn.rst b/reference/constraints/Luhn.rst index f854fb8f7cb..f2103cc2a62 100644 --- a/reference/constraints/Luhn.rst +++ b/reference/constraints/Luhn.rst @@ -1,6 +1,9 @@ Luhn ====== +.. versionadded:: 2.2 + The Luhn validation is new in Symfony 2.2. + This constraint is used to ensure that a credit card number passes the `Luhn algorithm`_. It is useful as a first step to validating a credit card: before communicating with a payment gateway. From 8bd7e39bc9e4ef41485efb36ef6ce8a2d24ad321 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 19 Dec 2012 16:00:18 +0100 Subject: [PATCH 0052/2078] fixed typo --- book/security.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/security.rst b/book/security.rst index 245616e4fc7..9b8fa9560ee 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1815,7 +1815,7 @@ Utilities --------- .. versionadded:: 2.2 - The ``StringUtils`` and ```SecureRandom`` classes were added in Symfony 2.2 + The ``StringUtils`` and ``SecureRandom`` classes were added in Symfony 2.2 The Symfony Security Component comes with a collection of nice utilities related to security. These utilities are used by Symfony, but you should also use From bece669a1f9bbc54e094c0420983bbbfa76c01a2 Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Thu, 20 Dec 2012 16:33:38 +0100 Subject: [PATCH 0053/2078] Adding documentation for the CardScheme validation. --- reference/constraints.rst | 1 + reference/constraints/CardScheme.rst | 118 +++++++++++++++++++++++++++ reference/constraints/map.rst.inc | 1 + 3 files changed, 120 insertions(+) create mode 100644 reference/constraints/CardScheme.rst diff --git a/reference/constraints.rst b/reference/constraints.rst index 3598b812458..1069b0ea3e0 100644 --- a/reference/constraints.rst +++ b/reference/constraints.rst @@ -40,6 +40,7 @@ Validation Constraints Reference constraints/File constraints/Image + constraints/CardScheme constraints/Luhn constraints/Callback diff --git a/reference/constraints/CardScheme.rst b/reference/constraints/CardScheme.rst new file mode 100644 index 00000000000..5d7ad2ea585 --- /dev/null +++ b/reference/constraints/CardScheme.rst @@ -0,0 +1,118 @@ +CardScheme +========== + +.. versionadded:: 2.2 + The CardScheme validation is new in Symfony 2.2. + +This constraint ensures that a credit card number is valid for a given credit card +company. It can be used to validate the number before trying to initiate a payment +through a payment gateway. + ++----------------+--------------------------------------------------------------------------+ +| Applies to | :ref:`property or method` | ++----------------+--------------------------------------------------------------------------+ +| Options | - `schemes`_ | +| | - `message`_ | ++----------------+--------------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Validator\\Constraints\\CardScheme` | ++----------------+--------------------------------------------------------------------------+ +| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\CardSchemeValidator` | ++----------------+--------------------------------------------------------------------------+ + +Basic Usage +----------- + +To use the CardScheme validator, simply apply it to a property or method on an +object that will contain a credit card number. + +.. configuration-block:: + + .. code-block:: yaml + + # src/Acme/SubscriptionBundle/Resources/config/validation.yml + Acme\SubscriptionBundle\Entity\Transaction: + properties: + cardNumber: + - CardScheme: + schemes: [VISA] + message: You credit card number is invalid. + + .. code-block:: xml + + + + + + + + + + + + .. code-block:: php-annotations + + // src/Acme/SubscriptionBundle/Entity/Transaction.php + use Symfony\Component\Validator\Constraints as Assert; + + class Transaction + { + /** + * @Assert\CardScheme(schemes = {"VISA"}, message = "You credit card number is invalid.") + */ + protected $cardNumber; + } + + .. code-block:: php + + // src/Acme/SubscriptionBundle/Entity/Transaction.php + use Symfony\Component\Validator\Mapping\ClassMetadata; + use Symfony\Component\Validator\Constraints\CardScheme; + + class Transaction + { + protected $cardNumber; + + public static function loadValidatorMetadata(ClassMetadata $metadata) + { + $metadata->addPropertyConstraint('cardSchema', new CardScheme(array( + 'schemes' => array( + 'VISA' + ), + 'message' => 'You credit card number is invalid.', + ))); + } + } + +Available Options +----------------- + +schemes +------- + +**type**: ``array`` + +The name of the number scheme used to validate the credit card number. Valid values are: + +* AMEX +* CHINA_UNIONPAY +* DINERS +* DISCOVER +* INSTAPAYMENT +* JCB +* LASER +* MAESTRO +* MASTERCARD +* VISA + +For more information about the used schemes, see `Wikipedia`_. + +message +~~~~~~~ + +**type**: ``string`` **default**: ``Unsupported card type or invalid card number`` + +The default message supplied when the value does not pass the CardScheme check. + +.. _`Wikipedia`: http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29 \ No newline at end of file diff --git a/reference/constraints/map.rst.inc b/reference/constraints/map.rst.inc index 3bcc9ad3a3a..0482c4c5447 100644 --- a/reference/constraints/map.rst.inc +++ b/reference/constraints/map.rst.inc @@ -57,6 +57,7 @@ File Constraints Financial Constraints ~~~~~~~~~~~~~~~~~~~~~ +* :doc:`CardScheme ` * :doc:`Luhn ` Other Constraints From 65332683b72abbb9e024746bbeaa5f2c03eafd71 Mon Sep 17 00:00:00 2001 From: Lee McDermott Date: Thu, 20 Dec 2012 18:22:34 +0000 Subject: [PATCH 0054/2078] Add note about console autocompletion --- components/console/introduction.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 997d14c1172..458ade73874 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -312,6 +312,22 @@ convenient for passwords:: false ); +.. versionadded:: 2.2 + Autocompletion for questions was added in Symfony 2.2. + +You can also specify an array of potential answers for a given question. These +will be autocompleted as the user types:: + + $dialog = $this->getHelperSet()->get('dialog'); + $bundleNames = array('AcmeDemoBundle', 'AcmeBlogBundle', 'AcmeStoreBundle'); + $name = $dialog->ask( + $output, + 'Please enter the name of a bundle', + 'FooBundle', + $bundleNames + ); + + .. caution:: When you ask for a hidden response, Symfony will use either a binary, change From b254e35a26d76e88b8ce461c13a3eb750cea697d Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 24 Dec 2012 12:44:02 -0500 Subject: [PATCH 0055/2078] [#1862] Fixing bad configuration for new failure_path_parameter option --- cookbook/security/form_login.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cookbook/security/form_login.rst b/cookbook/security/form_login.rst index 66ffc009617..0b8279eca56 100644 --- a/cookbook/security/form_login.rst +++ b/cookbook/security/form_login.rst @@ -42,7 +42,7 @@ Form Login Configuration Reference # login failure redirecting options (read further below) failure_path: null failure_forward: false - failure_target_path: _failure_path + failure_path_parameter: _failure_path # field names for the username and password fields username_parameter: _username @@ -67,7 +67,7 @@ Form Login Configuration Reference use_referer="false" failure_path="null" failure_forward="false" - failure_target_path="_failure_path" + failure_path_parameter="_failure_path" username_parameter="_username" password_parameter="_password" csrf_parameter="_csrf_token" @@ -92,7 +92,7 @@ Form Login Configuration Reference 'use_referer' => false, 'failure_path' => null, 'failure_forward' => false, - 'failure_target_path' => _failure_path, + 'failure_path_parameter' => _failure_path, 'username_parameter' => '_username', 'password_parameter' => '_password', 'csrf_parameter' => '_csrf_token', From 42b698dcbdb1d1f4fedfe8bfd98c57d8637257d0 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 26 Dec 2012 14:06:23 -0500 Subject: [PATCH 0056/2078] [#2002] Re-adding the caching information to the rendering a template without a controller doc --- .../templating/render_without_controller.rst | 68 ++++++++++++++++++- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/cookbook/templating/render_without_controller.rst b/cookbook/templating/render_without_controller.rst index 5ab276b5d83..3caa0a7e5f7 100644 --- a/cookbook/templating/render_without_controller.rst +++ b/cookbook/templating/render_without_controller.rst @@ -57,8 +57,8 @@ template you've passed as the ``template`` default value. You can of course also use this trick when rendering embedded controllers from within a template. But since the purpose of rendering a controller from within a template is typically to prepare some data in a custom controller, -this probably isn't useful, except to easily cache static partials, a feature -which will become available in Symfony 2.2. +this is probably only useful if you'd like to cache this page partial (see +:ref:`cookbook-templating-no-controller-caching`). .. configuration-block:: @@ -71,3 +71,67 @@ which will become available in Symfony 2.2. render( $view['router']->generate('acme_privacy', array(), true) ) ?> + +.. _cookbook-templating-no-controller-caching: + +Caching the static Template +--------------------------- + +.. versionadded:: 2.2 + The ability to cache templates rendered via ``FrameworkBundle:Template:template`` + is new in Symfony 2.2. + +Since templates that are rendered in this way are typically static, it might +make sense to cache them. Fortunately, this is easy! By configuring a few +other variables in your route, you can control exactly how your page is cached: + +.. configuration-block:: + + .. code-block:: yaml + + acme_privacy: + pattern: /privacy + defaults: + _controller: FrameworkBundle:Template:template + template: 'AcmeBundle:Static:privacy.html.twig' + maxAge: 86400 + sharedMaxAge: 86400 + + .. code-block:: xml + + + + + + + FrameworkBundle:Template:template + AcmeBundle:Static:privacy.html.twig + 86400 + 86400 + + + + .. code-block:: php + + use Symfony\Component\Routing\RouteCollection; + use Symfony\Component\Routing\Route; + + $collection = new RouteCollection(); + $collection->add('acme_privacy', new Route('/privacy', array( + '_controller' => 'FrameworkBundle:Template:template', + 'template' => 'AcmeBundle:Static:privacy.html.twig', + 'maxAge' => 86400, + 'sharedMaxAge' => 86400, + ))); + + return $collection; + +The ``maxAge`` and ``sharedMaxAge`` values are used to modify the Response +object created in the controller. For more information on caching, see +:doc:`/book/http_cache`. + +There is also a ``private`` variable (not shown here). By default, the Response +will be made public, as long as ``maxAge`` or ``sharedMaxAge`` are passed. +If set to ``true``, the Response will be marked as private. \ No newline at end of file From 79227c86471150cad1eeab920a6aebd2ddfe7e6d Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 26 Dec 2012 16:23:17 -0500 Subject: [PATCH 0057/2078] [#2007] Proofreading the new prepend extension docs, adding some other links/notes to other sections --- .../dependency_injection/compilation.rst | 8 ++++- cookbook/bundles/extension.rst | 10 ++++++ cookbook/bundles/prepend_extension.rst | 32 +++++++++---------- cookbook/map.rst.inc | 1 + 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index c244ff457a1..cb5c907b804 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -248,9 +248,12 @@ but also load a secondary one only if a certain parameter is set:: .. _components-dependency-injection-compiler-passes: -Prepending configuration passed to the Extension +Prepending Configuration passed to the Extension ------------------------------------------------ +.. versionadded:: 2.1 + The ability to prepend the configuration of a bundle is new in Symfony 2.2. + An Extension can prepend the configuration of any Bundle before the ``load()`` method is called by implementing :class:`Symfony\\Component\\DependencyInjection\\Compiler\\PrependExtensionInterface`:: @@ -271,6 +274,9 @@ method is called by implementing :class:`Symfony\\Component\\DependencyInjection } } +For more details, see :doc:`/cookbook/bundles/prepend_extension`, which is +specific to the Symfony2 Framework, but contains more details about this feature. + Creating a Compiler Pass ------------------------ diff --git a/cookbook/bundles/extension.rst b/cookbook/bundles/extension.rst index aed9e8f4090..7a54a18ff5f 100644 --- a/cookbook/bundles/extension.rst +++ b/cookbook/bundles/extension.rst @@ -483,6 +483,16 @@ normalization and advanced merging. You can read more about this in :doc:`the Co You can also see it action by checking out some of the core Configuration classes, such as the one from the `FrameworkBundle Configuration`_ or the `TwigBundle Configuration`_. +Modifying the configuration of another Bundle +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you have multiple bundles that depend on each other, it may be useful +to allow one ``Extension`` class to modify the configuration passed to another +bundle's ``Extension`` class, as if the end-developer has actually placed that +configuration in his/her ``app/config/config.yml`` file. + +For more details, see :doc:`/cookbook/bundles/prepend_extension`. + Default Configuration Dump ~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/cookbook/bundles/prepend_extension.rst b/cookbook/bundles/prepend_extension.rst index eb3f4c5ef18..0424e6dbcfe 100644 --- a/cookbook/bundles/prepend_extension.rst +++ b/cookbook/bundles/prepend_extension.rst @@ -5,24 +5,24 @@ How to simplify configuration of multiple Bundle ================================================ -Especially when building reusable and extensible applications developers are -often faced with a choice, either create a single Bundle or create multiple -Bundles. Creating a single Bundle has the draw back that its impossible for +When building reusable and extensible applications, developers are often +faced with a choice: either create a single large Bundle or multiple smaller +Bundles. Creating a single Bundle has the draw back that it's impossible for users to choose to remove functionality they are not using. Creating multiple Bundles has the draw back that configuration becomes more tedious and settings often need to be repeated for various Bundles. -Using the below approach it is possible to remove the disadvantage of the -multiple Bundle approach, by enabling a single Extension to prepend the settings +Using the below approach, it is possible to remove the disadvantage of the +multiple Bundle approach by enabling a single Extension to prepend the settings for any Bundle. It can use the settings defined in the ``app/config/config.yml`` to prepend settings just as if they would have been written explicitly by the user in the application configuration. For example, this could be used to configure the entity manager name to use in -multiple Bundle. Or it can be used to enable an optional feature that depends +multiple Bundles. Or it can be used to enable an optional feature that depends on another Bundle being loaded as well. -In order for an Extension to be able to do this it needs to implement +To give an Extension the power to do this, it needs to implement :class:`Symfony\\Component\\DependencyInjection\\Compiler\\PrependExtensionInterface`:: // src/Acme/HelloBundle/DependencyInjection/AcmeHelloExtension.php @@ -42,19 +42,19 @@ In order for an Extension to be able to do this it needs to implement } } -Inside the :method:`Symfony\\Component\\DependencyInjection\\Compiler\\PrependExtensionInterface::prepend()` -method developers have full access to the :class:`Symfony\Component\DependencyInjection\ContainerBuilder` -instance just before the :method:`Symfony\Component\HttpKernel\DependencyInjection\ExtensionInterface:load()` -method is called on the registered Bundle Extensions. In order to prepend settings -to a Bundle extension developers can use the -:method:`Symfony\Component\DependencyInjection\ContainerBuilder:prependExtensionConfig()` -method on the :class:`Symfony\Component\DependencyInjection\ContainerBuilder` +Inside the :method:`Symfony\\Component\\DependencyInjection\\Compiler\\PrependExtensionInterface::prepend` +method, developers have full access to the :class:`Symfony\\Component\\DependencyInjection\\ContainerBuilder` +instance just before the :method:`Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface::load` +method is called on each of the registered Bundle Extensions. In order to +prepend settings to a Bundle extension developers can use the +:method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::prependExtensionConfig` +method on the :class:`Symfony\\Component\\DependencyInjection\\ContainerBuilder` instance. As this method only prepends settings, any other settings done explicitly inside the ``app/config/config.yml`` would override these prepended settings. The following example illustrates how to prepend a configuration setting in multiple Bundles as well as disable a flag in multiple Bundles -in case specific other Bundle is not registered:: +in case a specific other Bundle is not registered:: public function prepend(ContainerBuilder $container) { @@ -92,7 +92,7 @@ in case specific other Bundle is not registered:: The above would be the equivalent of writing the following into the ``app/config/config.yml`` in case ``AcmeGoodbyeBundle`` is not registered and the ``entity_manager_name`` setting -for ``acme_hello`` is set to ``non_default``:: +for ``acme_hello`` is set to ``non_default``: .. configuration-block:: diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index 5596e66b552..e2ee0fcf118 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -11,6 +11,7 @@ * :doc:`/cookbook/bundles/inheritance` * :doc:`/cookbook/bundles/override` * :doc:`/cookbook/bundles/extension` + * :doc:`/cookbook/bundles/prepend_extension` * :doc:`/cookbook/cache/index` From be09d551682bdefc8e8bc1c3c02e907bc17c6aa8 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 26 Dec 2012 16:33:07 -0500 Subject: [PATCH 0058/2078] [#2005] Tweaking new docs about twig.loader --- reference/dic_tags.rst | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index 4264b968e5f..70ea604975f 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -752,29 +752,31 @@ twig.loader **Purpose**: Register a custom service that loads Twig templates -To enable a custom Twig template loader, add it as a regular service in one -of your configuration, and tag it with ``twig.loader``: +By default, Symfony uses only one `Twig Loader`_ - +:class:`Symfony\\Bundle\\TwigBundle\\Loader\\FilesystemLoader`. If you need +to load Twig templates from another resource, you can create a service for +the new loader and tag it with ``twig.loader``: .. configuration-block:: .. code-block:: yaml services: - twig.loader.your_loader_name: - class: Fully\Qualified\Loader\Class\Name + acme.demo_bundle.loader.some_twig_loader: + class: Acme\DemoBundle\Loader\SomeTwigLoader tags: - { name: twig.loader } .. code-block:: xml - + .. code-block:: php $container - ->register('twig.loader.your_loader_name', 'Fully\Qualified\Loader\Class\Name') + ->register('acme.demo_bundle.loader.some_twig_loader', 'Acme\DemoBundle\Loader\SomeTwigLoader') ->addTag('twig.loader') ; @@ -808,3 +810,4 @@ For an example, see the ``EntityInitializer`` class inside the Doctrine Bridge. .. _`Twig official extension repository`: https://github.com/fabpot/Twig-extensions .. _`KernelEvents`: https://github.com/symfony/symfony/blob/2.1/src/Symfony/Component/HttpKernel/KernelEvents.php .. _`SwiftMailer's Plugin Documentation`: http://swiftmailer.org/docs/plugins.html +.. _`Twig Loader`: http://twig.sensiolabs.org/doc/api.html#loaders \ No newline at end of file From 56d0081aa39581263e5d2c7d6d22702590ec3111 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 26 Dec 2012 16:58:27 -0500 Subject: [PATCH 0059/2078] [#2024] Added a versionadded note for the new FormInterface::add signature --- cookbook/form/dynamic_form_generation.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cookbook/form/dynamic_form_generation.rst b/cookbook/form/dynamic_form_generation.rst index ae82f9aa827..17f66d96311 100644 --- a/cookbook/form/dynamic_form_generation.rst +++ b/cookbook/form/dynamic_form_generation.rst @@ -82,7 +82,13 @@ Inside the Event Subscriber Class The goal is to create a "name" field *only* if the underlying Product object is new (e.g. hasn't been persisted to the database). Based on that, the subscriber -might look like the following:: +might look like the following: + +.. versionadded:: 2.2 + The ability to pass a string into :method:`FormInterface::add` + was added in Symfony 2.2. + +.. code-block:: php // src/Acme/DemoBundle/Form/EventListener/AddNameFieldSubscriber.php namespace Acme\DemoBundle\Form\EventListener; From 47e72d68c45fba6c9300aa0d13b0322d83998bba Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Sun, 30 Dec 2012 19:42:59 +0100 Subject: [PATCH 0060/2078] Minor changes on the CardScheme validator --- reference/constraints/CardScheme.rst | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/reference/constraints/CardScheme.rst b/reference/constraints/CardScheme.rst index 5d7ad2ea585..f60c9919bbf 100644 --- a/reference/constraints/CardScheme.rst +++ b/reference/constraints/CardScheme.rst @@ -93,18 +93,19 @@ schemes **type**: ``array`` -The name of the number scheme used to validate the credit card number. Valid values are: - -* AMEX -* CHINA_UNIONPAY -* DINERS -* DISCOVER -* INSTAPAYMENT -* JCB -* LASER -* MAESTRO -* MASTERCARD -* VISA +This option is required and represents the name of the number scheme used to +validate the credit card number. Valid values are: + +* ``AMEX`` +* ``CHINA_UNIONPAY`` +* ``DINERS`` +* ``DISCOVER`` +* ``INSTAPAYMENT`` +* ``JCB`` +* ``LASER`` +* ``MAESTRO`` +* ``MASTERCARD`` +* ``VISA`` For more information about the used schemes, see `Wikipedia`_. From a708da8744c61724b460cfb3d40c0d55012a3df4 Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Sun, 30 Dec 2012 20:34:45 +0100 Subject: [PATCH 0061/2078] Moving the documentation of the ProgressHelper into it's own document --- components/console/helpers/index.rst | 1 + components/console/helpers/map.rst.inc | 1 + components/console/helpers/progresshelper.rst | 73 +++++++++++++++++++ components/console/introduction.rst | 72 +----------------- 4 files changed, 76 insertions(+), 71 deletions(-) create mode 100644 components/console/helpers/progresshelper.rst diff --git a/components/console/helpers/index.rst b/components/console/helpers/index.rst index c11b6e1a994..83a1e9c53cd 100644 --- a/components/console/helpers/index.rst +++ b/components/console/helpers/index.rst @@ -9,6 +9,7 @@ The Console Helpers dialoghelper formatterhelper + progresshelper The Console Components comes with some usefull helpers. These helpers contain function to ease some common tasks. diff --git a/components/console/helpers/map.rst.inc b/components/console/helpers/map.rst.inc index d324d8c2aeb..cbc819ad832 100644 --- a/components/console/helpers/map.rst.inc +++ b/components/console/helpers/map.rst.inc @@ -1,2 +1,3 @@ * :doc:`/components/console/helpers/dialoghelper` * :doc:`/components/console/helpers/formatterhelper` +* :doc:`/components/console/helpers/progresshelper` diff --git a/components/console/helpers/progresshelper.rst b/components/console/helpers/progresshelper.rst new file mode 100644 index 00000000000..0b3b8b7743e --- /dev/null +++ b/components/console/helpers/progresshelper.rst @@ -0,0 +1,73 @@ +.. index:: + single: Console Helpers; Progress Helper + +Progress Helper +=============== + +.. versionadded:: 2.2 + The ``progress`` helper was added in Symfony 2.2. + +When executing longer-running commands, it may be helpful to show progress +information, which updates as your command runs: + +.. image:: /images/components/console/progress.png + +To display progress details, use the :class:`Symfony\\Component\\Console\\Helper\\ProgressHelper`, +pass it a total number of units, and advance the progress as your command executes:: + + $progress = $this->getHelperSet()->get('progress'); + + $progress->start($output, 50); + $i = 0; + while ($i++ < 50) { + // do some work + + // advance the progress bar 1 unit + $progress->advance(); + } + + $progress->finish(); + +The appearance of the progress output can be customized as well, with a number +of different levels of verbosity. Each of these displays different possible +items - like percentage completion, a moving progress bar, or current/total +information (e.g. 10/50):: + + $progress->setFormat(ProgressHelper::FORMAT_QUIET); + $progress->setFormat(ProgressHelper::FORMAT_NORMAL); + $progress->setFormat(ProgressHelper::FORMAT_VERBOSE); + $progress->setFormat(ProgressHelper::FORMAT_QUIET_NOMAX); + // the default value + $progress->setFormat(ProgressHelper::FORMAT_NORMAL_NOMAX); + $progress->setFormat(ProgressHelper::FORMAT_VERBOSE_NOMAX); + +You can also control the different characters and the width used for the +progress bar:: + + // the finished part of the bar + $progress->setBarCharacter('='); + // the unfinished part of the bar + $progress->setEmptyBarCharacter(' '); + $progress->setProgressCharacter('|'); + $progress->setBarWidth(50); + +To see other available options, check the API documentation for +:class:`Symfony\\Component\\Console\\Helper\\ProgressHelper`. + +.. caution:: + + For performance reasons, be careful to not set the total number of steps + to a high number. For example, if you're iterating over a large number + of items, consider a smaller "step" number that updates on only some + iterations:: + + $progress->start($output, 500); + $i = 0; + while ($i++ < 50000) { + // ... do some work + + // advance every 100 iterations + if ($i % 100 == 0) { + $progress->advance(); + } + } \ No newline at end of file diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 5d4af908c42..548a72c05f7 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -278,77 +278,6 @@ You can combine VALUE_IS_ARRAY with VALUE_REQUIRED or VALUE_OPTIONAL like this: 1 ); -Displaying a Progress Bar -------------------------- - -.. versionadded:: 2.2 - The ``progress`` helper was added in Symfony 2.2. - -When executing longer-running commands, it may be helpful to show progress -information, which updates as your command runs: - -.. image:: /images/components/console/progress.png - -To display progress details, use the :class:`Symfony\\Component\\Console\\Helper\\ProgressHelper`, -pass it a total number of units, and advance the progress as your command executes:: - - $progress = $this->getHelperSet()->get('progress'); - - $progress->start($output, 50); - $i = 0; - while ($i++ < 50) { - // do some work - - // advance the progress bar 1 unit - $progress->advance(); - } - - $progress->finish(); - -The appearance of the progress output can be customized as well, with a number -of different levels of verbosity. Each of these displays different possible -items - like percentage completion, a moving progress bar, or current/total -information (e.g. 10/50):: - - $progress->setFormat(ProgressHelper::FORMAT_QUIET); - $progress->setFormat(ProgressHelper::FORMAT_NORMAL); - $progress->setFormat(ProgressHelper::FORMAT_VERBOSE); - $progress->setFormat(ProgressHelper::FORMAT_QUIET_NOMAX); - // the default value - $progress->setFormat(ProgressHelper::FORMAT_NORMAL_NOMAX); - $progress->setFormat(ProgressHelper::FORMAT_VERBOSE_NOMAX); - -You can also control the different characters and the width used for the -progress bar:: - - // the finished part of the bar - $progress->setBarCharacter('='); - // the unfinished part of the bar - $progress->setEmptyBarCharacter(' '); - $progress->setProgressCharacter('|'); - $progress->setBarWidth(50); - -To see other available options, check the API documentation for -:class:`Symfony\\Component\\Console\\Helper\\ProgressHelper`. - -.. caution:: - - For performance reasons, be careful to not set the total number of steps - to a high number. For example, if you're iterating over a large number - of items, consider a smaller "step" number that updates on only some - iterations:: - - $progress->start($output, 500); - $i = 0; - while ($i++ < 50000) { - // ... do some work - - // advance every 100 iterations - if ($i % 100 == 0) { - $progress->advance(); - } - } - Console Helpers --------------- @@ -357,6 +286,7 @@ tools capable of helping you with different tasks: * :doc:`/components/console/helpers/dialoghelper`: interactively ask the user for information * :doc:`/components/console/helpers/formatterhelper`: customize the output colorization +* :doc:`/components/console/helpers/progresshelper`: shows a progress bar Testing Commands ---------------- From 66c94e41b518d51329058547f993287270fe25e6 Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Sun, 30 Dec 2012 20:49:27 +0100 Subject: [PATCH 0062/2078] Documenting the DialogHelper select method. --- components/console/helpers/dialoghelper.rst | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index 6528b4154ee..5adc5194a90 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -148,3 +148,30 @@ You can also ask and validate a hidden response:: If you want to allow the response to be visible if it cannot be hidden for some reason, pass true as the fifth argument. + +Let the user choose from a list of answers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 2.2 + The ``select`` method was added in Symfony 2.2. + +If you have a predefined set of answers the user can choose from, you +could use the ``ask`` method described above or, to make sure the user +provided a correct answer, the ``askAndValidate`` method. Both have +the disadvantage that you need to handle incorrect values yourself. + +Instead, you can use the ``select`` method, which makes sure that the user +can only enter a valid string from a predefined list:: + + $dialog = $app->getHelperSet()->get('dialog'); + $colors = array('red', 'blue', 'yellow'); + + $color = $dialog->select($output, 'Please select your favorite color (default to red)', $colors, 0); + + // Work with the color + +If the user enters an invalid string, an error message is shown and the user +is asked to provide the answer another time, till he enters a valid string. + +The last parameter is the index of the default value in the array or ``null`` if +no default should be provided. \ No newline at end of file From 23c8e48bfe83034e207bb7081ec979a0c43e070e Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Dec 2012 16:33:59 -0500 Subject: [PATCH 0063/2078] [#2054] Slight tweaks to new CardScheme document --- reference/constraints/CardScheme.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/reference/constraints/CardScheme.rst b/reference/constraints/CardScheme.rst index f60c9919bbf..fe9b27f7c89 100644 --- a/reference/constraints/CardScheme.rst +++ b/reference/constraints/CardScheme.rst @@ -22,8 +22,8 @@ through a payment gateway. Basic Usage ----------- -To use the CardScheme validator, simply apply it to a property or method on an -object that will contain a credit card number. +To use the ``CardScheme`` validator, simply apply it to a property or method +on an object that will contain a credit card number. .. configuration-block:: @@ -91,7 +91,7 @@ Available Options schemes ------- -**type**: ``array`` +**type**: ``array`` [:ref:`default option`] This option is required and represents the name of the number scheme used to validate the credit card number. Valid values are: @@ -107,13 +107,13 @@ validate the credit card number. Valid values are: * ``MASTERCARD`` * ``VISA`` -For more information about the used schemes, see `Wikipedia`_. +For more information about the used schemes, see `Wikipedia: Issuer identification number (IIN)`_. message ~~~~~~~ **type**: ``string`` **default**: ``Unsupported card type or invalid card number`` -The default message supplied when the value does not pass the CardScheme check. +The message shown when the value does not pass the ``CardScheme`` check. -.. _`Wikipedia`: http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29 \ No newline at end of file +.. _`Wikipedia: Issuer identification number (IIN)`: http://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29 \ No newline at end of file From 4c14ff472456fd4452e2696fa27b375331bc26fc Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Dec 2012 16:44:03 -0500 Subject: [PATCH 0064/2078] [#2007] Fixing bad versionadded number - thanks to @trompette --- components/dependency_injection/compilation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index cb5c907b804..8800afe18c4 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -251,7 +251,7 @@ but also load a secondary one only if a certain parameter is set:: Prepending Configuration passed to the Extension ------------------------------------------------ -.. versionadded:: 2.1 +.. versionadded:: 2.2 The ability to prepend the configuration of a bundle is new in Symfony 2.2. An Extension can prepend the configuration of any Bundle before the ``load()`` From 61abc9588b8f20c03791e6f2f9efe646239e897d Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Mon, 31 Dec 2012 11:41:36 +0100 Subject: [PATCH 0065/2078] Updating description of the DialogHelper select method --- components/console/helpers/dialoghelper.rst | 24 +++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index 5adc5194a90..95420fe9f0b 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -160,18 +160,30 @@ could use the ``ask`` method described above or, to make sure the user provided a correct answer, the ``askAndValidate`` method. Both have the disadvantage that you need to handle incorrect values yourself. -Instead, you can use the ``select`` method, which makes sure that the user -can only enter a valid string from a predefined list:: +Instead, you can use the +:method:`Symfony\\Component\\Console\\Helper\\DialogHelper::select` +method, which makes sure that the user can only enter a valid string +from a predefined list:: $dialog = $app->getHelperSet()->get('dialog'); $colors = array('red', 'blue', 'yellow'); - $color = $dialog->select($output, 'Please select your favorite color (default to red)', $colors, 0); + $colorKey = $dialog->select($output, 'Please select your favorite color (default to red)', $colors, 0); + $output->writeln('You have just selected: ' . $colors[$color]); - // Work with the color + // ... do something with the color If the user enters an invalid string, an error message is shown and the user is asked to provide the answer another time, till he enters a valid string. -The last parameter is the index of the default value in the array or ``null`` if -no default should be provided. \ No newline at end of file +The ``select`` method takes 6 parameters: + +* ``output``: The output instance +* ``question``: The question to ask +* ``choices``: An array of strings with the choices the user can pick +* ``default``: The index of the default value in the array or ``null`` if no + default should be provided (default ``null``) +* ``attempts``: Maximum number of times to ask or ``false`` for infinite times + (default ``false``) +* ``errorMessage``: Error message to display when wrong answer is entered (default + ``Value "%s" is invalid``) \ No newline at end of file From 0e6147bb6909d5d8265d20490b33f6c4406e84e7 Mon Sep 17 00:00:00 2001 From: Nikita Konstantinov Date: Mon, 31 Dec 2012 22:32:06 +0400 Subject: [PATCH 0066/2078] fix typos --- book/http_fundamentals.rst | 2 +- book/propel.rst | 2 +- book/validation.rst | 2 +- components/console/helpers/dialoghelper.rst | 2 +- components/console/single_command_tool.rst | 2 +- components/dependency_injection/compilation.rst | 2 +- components/event_dispatcher/generic_event.rst | 2 +- components/event_dispatcher/introduction.rst | 2 +- components/http_foundation/introduction.rst | 2 +- components/routing/introduction.rst | 6 +++--- components/security/authentication.rst | 12 +++++++----- cookbook/bundles/extension.rst | 1 + cookbook/bundles/prepend_extension.rst | 2 +- cookbook/form/create_form_type_extension.rst | 1 + cookbook/security/custom_provider.rst | 2 +- reference/constraints/Callback.rst | 1 + reference/dic_tags.rst | 2 +- 17 files changed, 25 insertions(+), 20 deletions(-) diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index 0cc1bc77356..c39d0889856 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -366,7 +366,7 @@ on that value. This can get ugly quickly:: $request = Request::createFromGlobals(); $path = $request->getPathInfo(); // the URI path being requested - if (in_array($path, array('', '/')) { + if (in_array($path, array('', '/'))) { $response = new Response('Welcome to the homepage.'); } elseif ($path == '/contact') { $response = new Response('Contact us'); diff --git a/book/propel.rst b/book/propel.rst index 612257e0ac4..374803c1f20 100644 --- a/book/propel.rst +++ b/book/propel.rst @@ -263,7 +263,7 @@ If you want to reuse some queries, you can add your own methods to the public function filterByExpensivePrice() { return $this - ->filterByPrice(array('min' => 1000)) + ->filterByPrice(array('min' => 1000)); } } diff --git a/book/validation.rst b/book/validation.rst index 9565bd272de..e6495e13d22 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -825,7 +825,7 @@ it looks like this:: // this IS a valid email address, do something } else { // this is *not* a valid email address - $errorMessage = $errorList[0]->getMessage() + $errorMessage = $errorList[0]->getMessage(); // ... do something with the error } diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index 6528b4154ee..e35e7ed4fcc 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -136,7 +136,7 @@ You can also ask and validate a hidden response:: if (trim($value) == '') { throw new \Exception('The password can not be empty'); } - } + }; $password = $dialog->askHiddenResponseAndValidate( $output, diff --git a/components/console/single_command_tool.rst b/components/console/single_command_tool.rst index b3ff5172305..ba3cceffbf9 100644 --- a/components/console/single_command_tool.rst +++ b/components/console/single_command_tool.rst @@ -37,7 +37,7 @@ it is possible to remove this need by extending the application:: { // Keep the core default commands to have the HelpCommand // which is used when using the --help option - $defaultCommands = parent::getDefaultCommands() + $defaultCommands = parent::getDefaultCommands(); $defaultCommands[] = new MyCommand(); diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index 8800afe18c4..71ea7d90fbd 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -213,7 +213,7 @@ benefit of merging multiple files and validation of the configuration:: $processor = new Processor(); $config = $processor->processConfiguration($configuration, $configs); - $container->setParameter('acme_demo.FOO', $config['foo']) + $container->setParameter('acme_demo.FOO', $config['foo']); // ... } diff --git a/components/event_dispatcher/generic_event.rst b/components/event_dispatcher/generic_event.rst index 64333c92be0..e7a3dd5be36 100644 --- a/components/event_dispatcher/generic_event.rst +++ b/components/event_dispatcher/generic_event.rst @@ -74,7 +74,7 @@ the event arguments:: $event = new GenericEvent( $subject, - array('type' => 'foo', 'counter' => 0)) + array('type' => 'foo', 'counter' => 0) ); $dispatcher->dispatch('foo', $event); diff --git a/components/event_dispatcher/introduction.rst b/components/event_dispatcher/introduction.rst index 7a81daeda05..e40c6754ea3 100644 --- a/components/event_dispatcher/introduction.rst +++ b/components/event_dispatcher/introduction.rst @@ -190,7 +190,7 @@ event to determine the exact ``Symfony\Component\EventDispatcher\Event`` instance that's being passed. For example, the ``kernel.event`` event passes an instance of ``Symfony\Component\HttpKernel\Event\FilterResponseEvent``:: - use Symfony\Component\HttpKernel\Event\FilterResponseEvent + use Symfony\Component\HttpKernel\Event\FilterResponseEvent; public function onKernelResponse(FilterResponseEvent $event) { diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 60437584d14..87c6bf8f546 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -250,7 +250,7 @@ If you need to get full access to parsed data from ``Accept``, ``Accept-Language use Symfony\Component\HttpFoundation\AcceptHeader; $accept = AcceptHeader::fromString($request->headers->get('Accept')); - if ($accept->has('text/html') { + if ($accept->has('text/html')) { $item = $accept->get('html'); $charset = $item->getAttribute('charset', 'utf-8'); $quality = $item->getQuality(); diff --git a/components/routing/introduction.rst b/components/routing/introduction.rst index 6fd01e6f8f7..daf0facf1aa 100644 --- a/components/routing/introduction.rst +++ b/components/routing/introduction.rst @@ -33,7 +33,7 @@ your autoloader to load the Routing component:: use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\Route; - $route = new Route('/foo', array('controller' => 'MyController')) + $route = new Route('/foo', array('controller' => 'MyController')); $routes = new RouteCollection(); $routes->add('route_name', $route); @@ -333,9 +333,9 @@ automatically in the background if you want to use it. A basic example of the $router = new Router( new YamlFileLoader($locator), - "routes.yml", + 'routes.yml', array('cache_dir' => __DIR__.'/cache'), - $requestContext, + $requestContext ); $router->match('/foo/bar'); diff --git a/components/security/authentication.rst b/components/security/authentication.rst index ad9efbf8b78..969b6dded6b 100644 --- a/components/security/authentication.rst +++ b/components/security/authentication.rst @@ -130,11 +130,13 @@ password was valid:: use Symfony\Component\Security\Core\Encoder\EncoderFactory; $userProvider = new InMemoryUserProvider( - array('admin' => array( - // password is "foo" - 'password' => '5FZ2Z8QIkA7UTZ4BYkoC+GsReLf569mSKDsfods6LYQ8t+a8EW9oaircfMpmaLbPBh4FOBiiFyLfuZmTSUwzZg==', - 'roles' => array('ROLE_ADMIN'), - ), + array( + 'admin' => array( + // password is "foo" + 'password' => '5FZ2Z8QIkA7UTZ4BYkoC+GsReLf569mSKDsfods6LYQ8t+a8EW9oaircfMpmaLbPBh4FOBiiFyLfuZmTSUwzZg==', + 'roles' => array('ROLE_ADMIN'), + ), + ) ); // for some extra checks: is account enabled, locked, expired, etc.? diff --git a/cookbook/bundles/extension.rst b/cookbook/bundles/extension.rst index 7a54a18ff5f..dbdf7f432b2 100644 --- a/cookbook/bundles/extension.rst +++ b/cookbook/bundles/extension.rst @@ -537,6 +537,7 @@ Comments and examples can be added to your configuration nodes using the return $treeBuilder; } + } This text appears as yaml comments in the output of the ``config:dump-reference`` command. diff --git a/cookbook/bundles/prepend_extension.rst b/cookbook/bundles/prepend_extension.rst index 0424e6dbcfe..8ba5180c78f 100644 --- a/cookbook/bundles/prepend_extension.rst +++ b/cookbook/bundles/prepend_extension.rst @@ -29,7 +29,7 @@ To give an Extension the power to do this, it needs to implement namespace Acme\HelloBundle\DependencyInjection; use Symfony\Component\HttpKernel\DependencyInjection\Extension; - use Symfony\Component\\DependencyInjection\PrependExtensionInterface; + use Symfony\Component\DependencyInjection\PrependExtensionInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; class AcmeHelloExtension extends Extension implements PrependExtensionInterface diff --git a/cookbook/form/create_form_type_extension.rst b/cookbook/form/create_form_type_extension.rst index 3e25f512295..cd59311b3e1 100644 --- a/cookbook/form/create_form_type_extension.rst +++ b/cookbook/form/create_form_type_extension.rst @@ -168,6 +168,7 @@ database):: return $webPath; } + } Your form type extension class will need to do two things in order to extend the ``file`` form type: diff --git a/cookbook/security/custom_provider.rst b/cookbook/security/custom_provider.rst index 7367bb14556..fd1c7015105 100644 --- a/cookbook/security/custom_provider.rst +++ b/cookbook/security/custom_provider.rst @@ -134,7 +134,7 @@ Here's an example of how this might look:: // ... - return new WebserviceUser($username, $password, $salt, $roles) + return new WebserviceUser($username, $password, $salt, $roles); } throw new UsernameNotFoundException(sprintf('Username "%s" does not exist.', $username)); diff --git a/reference/constraints/Callback.rst b/reference/constraints/Callback.rst index fa36d443e87..acf2f9ce264 100644 --- a/reference/constraints/Callback.rst +++ b/reference/constraints/Callback.rst @@ -88,6 +88,7 @@ those errors should be attributed:: $context->addViolationAtSubPath('firstname', 'This name sounds totally fake!', array(), null); } } + } Options ------- diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index fe3ea1f13b3..8d5bb0f1f01 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -621,7 +621,7 @@ other source, first create a class that implements the // src/Acme/MainBundle/Translation/MyCustomLoader.php namespace Acme\MainBundle\Translation; - use Symfony\Component\Translation\Loader\LoaderInterface + use Symfony\Component\Translation\Loader\LoaderInterface; use Symfony\Component\Translation\MessageCatalogue; class MyCustomLoader implements LoaderInterface From f002cea050ecdd782e1b3d2b0f99084b7ca65be3 Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Tue, 1 Jan 2013 22:15:58 +0100 Subject: [PATCH 0067/2078] Reworking the documentation on the DialogHelper select method Bugfixing a wording in the ProgressHelper --- components/console/helpers/dialoghelper.rst | 27 +++++++++---------- components/console/helpers/progresshelper.rst | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index 95420fe9f0b..80354b0897d 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -168,22 +168,21 @@ from a predefined list:: $dialog = $app->getHelperSet()->get('dialog'); $colors = array('red', 'blue', 'yellow'); - $colorKey = $dialog->select($output, 'Please select your favorite color (default to red)', $colors, 0); + $color = $dialog->select( + $output, + 'Please select your favorite color (default to red)', + $colors, + 0 + ); $output->writeln('You have just selected: ' . $colors[$color]); // ... do something with the color +The option which should be selected by default is provided with the fourth +parameter. The default is ``null``, which means that no option is the default one. + If the user enters an invalid string, an error message is shown and the user -is asked to provide the answer another time, till he enters a valid string. - -The ``select`` method takes 6 parameters: - -* ``output``: The output instance -* ``question``: The question to ask -* ``choices``: An array of strings with the choices the user can pick -* ``default``: The index of the default value in the array or ``null`` if no - default should be provided (default ``null``) -* ``attempts``: Maximum number of times to ask or ``false`` for infinite times - (default ``false``) -* ``errorMessage``: Error message to display when wrong answer is entered (default - ``Value "%s" is invalid``) \ No newline at end of file +is asked to provide the answer another time, till he enters a valid string +or the maximum attempts is reached (which you can define in the fifth +parameter). The default value for the attempts is ``false``, which means infinite +attempts. You can define your own error message in the sixth parameter. diff --git a/components/console/helpers/progresshelper.rst b/components/console/helpers/progresshelper.rst index 0b3b8b7743e..757091ba20d 100644 --- a/components/console/helpers/progresshelper.rst +++ b/components/console/helpers/progresshelper.rst @@ -20,7 +20,7 @@ pass it a total number of units, and advance the progress as your command execut $progress->start($output, 50); $i = 0; while ($i++ < 50) { - // do some work + // ... do some work // advance the progress bar 1 unit $progress->advance(); From ec3132510857c6fe03546a9bab819a09cff7d417 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Wed, 2 Jan 2013 01:41:20 +0100 Subject: [PATCH 0068/2078] [Component][Finder] Documented wildcard (glob pattern) support. --- components/finder.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/components/finder.rst b/components/finder.rst index 1c8c80728c8..a766983ed85 100644 --- a/components/finder.rst +++ b/components/finder.rst @@ -69,6 +69,15 @@ Search in several locations by chaining calls to $finder->files()->in(__DIR__)->in('/elsewhere'); +.. versionadded:: 2.2 + Wildcard support was added in version 2.2. + +Use wildcard characters to search in the directories matching a pattern:: + + $finder->in('src/Symfony/*/*/Resources'); + +Each pattern has to resolve to at least one directory path. + Exclude directories from matching with the :method:`Symfony\\Component\\Finder\\Finder::exclude` method:: From c9a25a561f7f7529f8a567a887ad1d707b6b83d1 Mon Sep 17 00:00:00 2001 From: Lukas Kahwe Smith Date: Sat, 5 Jan 2013 13:23:11 +0100 Subject: [PATCH 0069/2078] typo fix --- cookbook/bundles/prepend_extension.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/bundles/prepend_extension.rst b/cookbook/bundles/prepend_extension.rst index 8ba5180c78f..27725542c2b 100644 --- a/cookbook/bundles/prepend_extension.rst +++ b/cookbook/bundles/prepend_extension.rst @@ -2,8 +2,8 @@ single: Configuration; Semantic single: Bundle; Extension configuration -How to simplify configuration of multiple Bundle -================================================ +How to simplify configuration of multiple Bundles +================================================= When building reusable and extensible applications, developers are often faced with a choice: either create a single large Bundle or multiple smaller From dbfcaffa1bf10f658e9c49384b848e56e73d4b5f Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Sat, 5 Jan 2013 15:26:20 +0100 Subject: [PATCH 0070/2078] Adapted the docs to the rename of the "virtual" form option to "inherit_data" --- cookbook/form/index.rst | 2 +- ...uals_forms.rst => inherit_data_option.rst} | 68 ++++++++----------- cookbook/map.rst.inc | 2 +- 3 files changed, 32 insertions(+), 40 deletions(-) rename cookbook/form/{use_virtuals_forms.rst => inherit_data_option.rst} (59%) diff --git a/cookbook/form/index.rst b/cookbook/form/index.rst index e60f02c9a68..9ec1c8ea260 100644 --- a/cookbook/form/index.rst +++ b/cookbook/form/index.rst @@ -10,4 +10,4 @@ Form form_collections create_custom_field_type create_form_type_extension - use_virtuals_forms + inherit_data_option diff --git a/cookbook/form/use_virtuals_forms.rst b/cookbook/form/inherit_data_option.rst similarity index 59% rename from cookbook/form/use_virtuals_forms.rst rename to cookbook/form/inherit_data_option.rst index 41b05355ac8..6241927f0ff 100644 --- a/cookbook/form/use_virtuals_forms.rst +++ b/cookbook/form/inherit_data_option.rst @@ -1,13 +1,12 @@ .. index:: - single: Form; Virtual forms + single: Form; The "inherit_data" option -How to use the Virtual Form Field Option -======================================== +Reducing Code Duplication with "inherit_data" +============================================= -The ``virtual`` form field option can be very useful when you have some -duplicated fields in different entities. - -For example, imagine you have two entities, a ``Company`` and a ``Customer``:: +The ``inherit_data`` form field option can be very useful when you have some +duplicated fields in different entities. For example, imagine you have two +entities, a ``Company`` and a ``Customer``:: // src/Acme/HelloBundle/Entity/Company.php namespace Acme\HelloBundle\Entity; @@ -39,13 +38,10 @@ For example, imagine you have two entities, a ``Company`` and a ``Customer``:: private $country; } -Like you can see, each entity shares a few of the same fields: ``address``, +As you can see, each entity shares a few of the same fields: ``address``, ``zipcode``, ``city``, ``country``. -Now, you want to build two forms: one for a ``Company`` and the second for -a ``Customer``. - -Start by creating a very simple ``CompanyType`` and ``CustomerType``:: +Let's build two forms for these entities, ``CompanyType`` and ``CustomerType``:: // src/Acme/HelloBundle/Form/Type/CompanyType.php namespace Acme\HelloBundle\Form\Type; @@ -79,8 +75,9 @@ Start by creating a very simple ``CompanyType`` and ``CustomerType``:: } } -Now, to deal with the four duplicated fields. Here is a (simple) -location form type:: +Instead of including the duplicated fields ``address``, ``zipcode``, ``city`` +and ``country``in both of these forms, we will create a third form for that. +We will call this form simply ``LocationType``:: // src/Acme/HelloBundle/Form/Type/LocationType.php namespace Acme\HelloBundle\Form\Type; @@ -102,7 +99,7 @@ location form type:: public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'virtual' => true + 'inherit_data' => true )); } @@ -112,20 +109,25 @@ location form type:: } } -You don't *actually* have a location field in each of your entities, so you -can't directly link ``LocationType`` to ``CompanyType`` or ``CustomerType``. -But you absolutely want to have a dedicated form type to deal with location (remember, DRY!). +The location form has an interesting option set, namely ``inherit_data``. This +option lets the form inherit its data from its parent form. If embedded in +the company form, the fields of the location form will access the properties of +the ``Company`` instance. If embedded in the customer form, the fields will +access the properties of the ``Customer`` instance instead. Easy, eh? -The ``virtual`` form field option is the solution. +.. note:: -You can set the option ``'virtual' => true`` in the ``setDefaultOptions()`` method -of ``LocationType`` and directly start using it in the two original form types. + Instead of setting the ``inherit_data`` option inside ``LocationType``, you + can also (just like with any option) pass it in the third argument of + ``$builder->add()``. -Look at the result:: +Let's make this work by adding the location form to our two original forms:: - // CompanyType + // src/Acme/HelloBundle/Form/Type/CompanyType.php public function buildForm(FormBuilderInterface $builder, array $options) { + // ... + $builder->add('foo', new LocationType(), array( 'data_class' => 'Acme\HelloBundle\Entity\Company' )); @@ -133,25 +135,15 @@ Look at the result:: .. code-block:: php - // CustomerType + // src/Acme/HelloBundle/Form/Type/CustomerType.php public function buildForm(FormBuilderInterface $builder, array $options) { + // ... + $builder->add('bar', new LocationType(), array( 'data_class' => 'Acme\HelloBundle\Entity\Customer' )); } -With the virtual option set to false (default behavior), the Form Component -expects each underlying object to have a ``foo`` (or ``bar``) property that -is either some object or array which contains the four location fields. -Of course, you don't have this object/array in your entities and you don't want it! - -With the virtual option set to true, the Form component skips the ``foo`` (or ``bar``) -property, and instead "gets" and "sets" the 4 location fields directly -on the underlying object! - -.. note:: - - Instead of setting the ``virtual`` option inside ``LocationType``, you - can (just like with any options) also pass it in as an array option to - the third argument of ``$builder->add()``. +That's it! You have extracted duplicated field definitions to a separate +location form that you can reuse wherever you need it. diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index e2ee0fcf118..c1df5af3dd4 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -79,7 +79,7 @@ * :doc:`/cookbook/form/form_collections` * :doc:`/cookbook/form/create_custom_field_type` * :doc:`/cookbook/form/create_form_type_extension` - * :doc:`/cookbook/form/use_virtuals_forms` + * :doc:`/cookbook/form/inherit_data_option` * (validation) :doc:`/cookbook/validation/custom_constraint` * (doctrine) :doc:`/cookbook/doctrine/file_uploads` From 5828740f7153d21ac3e5c8e99f62528dfd0f763b Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Tue, 8 Jan 2013 21:29:22 +0100 Subject: [PATCH 0071/2078] [Validation] Update CardScheme --- reference/constraints/CardScheme.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reference/constraints/CardScheme.rst b/reference/constraints/CardScheme.rst index fe9b27f7c89..5de3b4b20b0 100644 --- a/reference/constraints/CardScheme.rst +++ b/reference/constraints/CardScheme.rst @@ -91,10 +91,11 @@ Available Options schemes ------- -**type**: ``array`` [:ref:`default option`] +**type**: ``mixed`` [:ref:`default option`] This option is required and represents the name of the number scheme used to -validate the credit card number. Valid values are: +validate the credit card number. It can either be a String or an Array. Valid +values are: * ``AMEX`` * ``CHINA_UNIONPAY`` From cc3ce38577a35a23bea266a11dc37c27c08d25f9 Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Wed, 9 Jan 2013 09:27:42 +0100 Subject: [PATCH 0072/2078] Fixing minor grammer issues in CardScheme constraint --- reference/constraints/CardScheme.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/CardScheme.rst b/reference/constraints/CardScheme.rst index 5de3b4b20b0..35b63aacb02 100644 --- a/reference/constraints/CardScheme.rst +++ b/reference/constraints/CardScheme.rst @@ -94,7 +94,7 @@ schemes **type**: ``mixed`` [:ref:`default option`] This option is required and represents the name of the number scheme used to -validate the credit card number. It can either be a String or an Array. Valid +validate the credit card number, it can either be a string or an array. Valid values are: * ``AMEX`` From c2d0b9991cb4b256bcdb893b3a7878ca1d3a9604 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 12 Jan 2013 10:50:45 +0100 Subject: [PATCH 0073/2078] made changes to take into account the new usage of the different content rendering strategies --- book/_security-2012-6431.rst.inc | 9 -- book/http_cache.rst | 111 ++++++++++-------- book/templating.rst | 76 +++--------- cookbook/service_container/scopes.rst | 2 +- .../templating/render_without_controller.rst | 2 +- quick_tour/the_view.rst | 56 ++------- reference/twig_reference.rst | 16 ++- 7 files changed, 106 insertions(+), 166 deletions(-) delete mode 100644 book/_security-2012-6431.rst.inc diff --git a/book/_security-2012-6431.rst.inc b/book/_security-2012-6431.rst.inc deleted file mode 100644 index 5d9137bba63..00000000000 --- a/book/_security-2012-6431.rst.inc +++ /dev/null @@ -1,9 +0,0 @@ -.. note:: - - Since Symfony 2.0.20/2.1.5, the Twig ``render`` tag now takes an absolute url - instead of a controller logical path. This fixes an important security - issue (`CVE-2012-6431`_) reported on the official blog. If your application - uses an older version of Symfony or still uses the previous ``render`` tag - syntax, you should upgrade as soon as possible. - -.. _`CVE-2012-6431`: http://symfony.com/blog/security-release-symfony-2-0-20-and-2-1-5-released \ No newline at end of file diff --git a/book/http_cache.rst b/book/http_cache.rst index 266a238005a..76eef9765e6 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -881,58 +881,37 @@ matter), Symfony2 uses the standard ``render`` helper to configure ESI tags: .. code-block:: jinja - {% render url('latest_news', { 'max': 5 }), {'standalone': true} %} + {# you can use a controller reference #} + {{ render_esi(controller('...:news', { 'max': 5 })) }} + + {# ... or a URL #} + {{ render_esi(url('latest_news', { 'max': 5 })) }} .. code-block:: php + render( + new ControllerReference('...:news', array('max' => 5)), + array('strategy' => 'esi')) + ?> + render( $view['router']->generate('latest_news', array('max' => 5), true), - array('standalone' => true) + array('strategy' => 'esi') ) ?> -.. include:: /book/_security-2012-6431.rst.inc - -The ``render`` tag takes the absolute url to the embedded action. This means -that you need to define a new route to the controller that you're embedding: - -.. code-block:: yaml - - # app/config/routing.yml - latest_news: - pattern: /esi/latest-news/{max} - defaults: { _controller: AcmeNewsBundle:News:news } - requirements: { max: \d+ } - -.. caution:: - - Unless you want this URL to be accessible to the outside world, you - should use Symfony's firewall to secure it (by allowing access to your - reverse proxy's IP range). See the :ref:`Securing by IP` - section of the :doc:`Security Chapter ` for more information - on how to do this. - -.. tip:: +By using the ``esi`` rendering strategy (via the ``render_esi`` Twig +function), you tell Symfony2 that the action should be rendered as an ESI tag. +You might be wondering why you would want to use a helper instead of just +writing the ESI tag yourself. That's because using a helper makes your +application work even if there is no gateway cache installed. - The best practice is to mount all your ESI urls on a single prefix (e.g. - ``/esi``) of your choice. This has two main advantages. First, it eases - the management of ESI urls as you can easily identify the routes used for ESI. - Second, it eases security management since securing all urls starting - with the same prefix is easier than securing each individual url. See - the above note for more details on securing ESI URLs. - -By setting ``standalone`` to ``true`` in the ``render`` Twig tag, you tell -Symfony2 that the action should be rendered as an ESI tag. You might be -wondering why you would want to use a helper instead of just writing the ESI tag -yourself. That's because using a helper makes your application work even if -there is no gateway cache installed. - -When standalone is ``false`` (the default), Symfony2 merges the included page -content within the main one before sending the response to the client. But -when standalone is ``true``, *and* if Symfony2 detects that it's talking -to a gateway cache that supports ESI, it generates an ESI include tag. But -if there is no gateway cache or if it does not support ESI, Symfony2 will -just merge the included page content within the main one as it would have -done were standalone set to ``false``. +When using the default ``render`` function (or setting the strategy to +``default``), Symfony2 merges the included page content within the main one +before sending the response to the client. But when using ``esi`` strategy, +*and* if Symfony2 detects that it's talking to a gateway cache that supports +ESI, it generates an ESI include tag. But if there is no gateway cache or if +it does not support ESI, Symfony2 will just merge the included page content +within the main one as it would have done if you had used ``render``. .. note:: @@ -947,14 +926,52 @@ of the master page. public function newsAction($max) { - // ... + // ... - $response->setSharedMaxAge(60); + $response->setSharedMaxAge(60); } With ESI, the full page cache will be valid for 600 seconds, but the news component cache will only last for 60 seconds. +When using a controller reference, the ESI tag should reference the embedded +action as an accessible URL so the gateway cache can fetch it independently of +the rest of the page. Of course, an action can't be accessed via a URL unless +it has a route that points to it. Symfony2 takes care of this via a generic +route and controller. For the ESI include tag to work properly, you must +define the ``_proxy`` route: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/routing.yml + _proxy: + resource: "@FrameworkBundle/Resources/config/routing/proxy.xml" + prefix: /proxy + + .. code-block:: xml + + + + + + + + + + .. code-block:: php + + // app/config/routing.php + use Symfony\Component\Routing\RouteCollection; + use Symfony\Component\Routing\Route; + + $collection->addCollection($loader->import('@FrameworkBundle/Resources/config/routing/proxy.xml', '/proxy')); + + return $collection; + One great advantage of this caching strategy is that you can make your application as dynamic as needed and at the same time, hit the application as little as possible. @@ -967,7 +984,7 @@ little as possible. obey the ``max-age`` directive and cache the entire page. And you don't want that. -The ``render`` helper supports two other useful options: +The ``render_esi`` helper supports two other useful options: * ``alt``: used as the ``alt`` attribute on the ESI tag, which allows you to specify an alternative URL to be used if the ``src`` cannot be found; diff --git a/book/templating.rst b/book/templating.rst index decaf19417b..e1f448ba9d4 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -623,43 +623,8 @@ The ``recentList`` template is perfectly straightforward: (e.g. ``/article/*slug*``). This is a bad practice. In the next section, you'll learn how to do this correctly. -Even though this controller will only be used internally, you'll need to -create a route that points to the controller: - -.. configuration-block:: - - .. code-block:: yaml - - latest_articles: - pattern: /articles/latest/{max} - defaults: { _controller: AcmeArticleBundle:Article:recentArticles } - - .. code-block:: xml - - - - - - - AcmeArticleBundle:Article:recentArticles - - - - .. code-block:: php - - use Symfony\Component\Routing\RouteCollection; - use Symfony\Component\Routing\Route; - - $collection = new RouteCollection(); - $collection->add('latest_articles', new Route('/articles/latest/{max}', array( - '_controller' => 'AcmeArticleBundle:Article:recentArticles', - ))); - - return $collection; - -To include the controller, you'll need to refer to it using an absolute url: +To include the controller, you'll need to refer to it using the standard +string syntax for controllers (i.e. **bundle**:**controller**:**action**): .. configuration-block:: @@ -669,7 +634,7 @@ To include the controller, you'll need to refer to it using an absolute url: {# ... #} .. code-block:: html+php @@ -679,12 +644,10 @@ To include the controller, you'll need to refer to it using an absolute url: -.. include:: /book/_security-2012-6431.rst.inc - Whenever you find that you need a variable or a piece of information that you don't have access to in a template, consider rendering a controller. Controllers are fast to execute and promote good code organization and reuse. @@ -703,13 +666,20 @@ Symfony2 uses the standard ``render`` helper to configure ``hinclude`` tags: .. code-block:: jinja - {% render url('...'), {'standalone': 'js'} %} + {{ render_hinclude(controller('...')) }} + + {{ render_hinclude(url('...')) }} .. code-block:: php + render( + new ControllerReference('...'), + array('strategy' => 'hinclude') + ) ?> + render( $view['router']->generate('...'), - array('standalone' => 'js') + array('strategy' => 'hinclude') ) ?> .. note:: @@ -756,18 +726,14 @@ any global default templates that is defined): .. code-block:: jinja - {% render '...:news' with - {}, - {'standalone': 'js', 'default': 'AcmeDemoBundle:Default:content.html.twig'} - %} + {{ render_hinclude(controller('...'), {'default': 'AcmeDemoBundle:Default:content.html.twig'}) }} .. code-block:: php render( - '...:news', - array(), + new ControllerReference('...'), array( - 'standalone' => 'js', + 'strategy' => 'hinclude', 'default' => 'AcmeDemoBundle:Default:content.html.twig', ) ) ?> @@ -778,18 +744,14 @@ Or you can also specify a string to display as the default content: .. code-block:: jinja - {% render '...:news' with - {}, - {'standalone': 'js', 'default': 'Loading...'} - %} + {{ render_hinclude(controller('...'), {'default': 'Loading...'}) }} .. code-block:: php render( - '...:news', - array(), + new ControllerReference('...'), array( - 'standalone' => 'js', + 'strategy' => 'hinclude', 'default' => 'Loading...', ) ) ?> diff --git a/cookbook/service_container/scopes.rst b/cookbook/service_container/scopes.rst index 2eea3583f04..7bc561ee44f 100644 --- a/cookbook/service_container/scopes.rst +++ b/cookbook/service_container/scopes.rst @@ -48,7 +48,7 @@ when compiling the container. Read the sidebar below for more details. *RequestA*) is passed to it. Life is good! * You've now made a subrequest in Symfony, which is a fancy way of saying - that you've called, for example, the `{% render ... %}` Twig function, + that you've called, for example, the `{{ render(...) }}` Twig function, which executes another controller. Internally, the old `request` service (*RequestA*) is actually replaced by a new request instance (*RequestB*). This happens in the background, and it's totally normal. diff --git a/cookbook/templating/render_without_controller.rst b/cookbook/templating/render_without_controller.rst index 3caa0a7e5f7..2f2b63e6d52 100644 --- a/cookbook/templating/render_without_controller.rst +++ b/cookbook/templating/render_without_controller.rst @@ -64,7 +64,7 @@ this is probably only useful if you'd like to cache this page partial (see .. code-block:: html+jinja - {% render url('acme_privacy') %} + {{ render(url('acme_privacy')) }} .. code-block:: html+php diff --git a/quick_tour/the_view.rst b/quick_tour/the_view.rst index 36cabefe769..913f7c93e92 100644 --- a/quick_tour/the_view.rst +++ b/quick_tour/the_view.rst @@ -180,57 +180,19 @@ And what if you want to embed the result of another controller in a template? That's very useful when working with Ajax, or when the embedded template needs some variable not available in the main template. -Suppose you've created a ``fancyAction`` controller method, and you want to "render" -it inside the ``index`` template. First, create a route to your new controller -in one of your application's routing configuration files. - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/routing.yml - fancy: - pattern: /included/fancy/{name}/{color} - defaults: { _controller: AcmeDemoBundle:Demo:fancy } - - .. code-block:: xml - - - - - - - AcmeDemoBundle:Demo:fancy - - - - .. code-block:: php - - // app/config/routing.php - use Symfony\Component\Routing\RouteCollection; - use Symfony\Component\Routing\Route; - - $collection = new RouteCollection(); - $collection->add('fancy', new Route('/included/fancy/{name}/{color}', array( - '_controller' => 'AcmeDemoBundle:Demo:fancy', - ))); - - return $collection; - -To include the result (e.g. ``HTML``) of the controller, use the ``render`` tag: +Suppose you've created a ``fancyAction`` controller method, and you want to +"render" it inside the ``index`` template, which means including the result +(e.g. ``HTML``) of the controller, use the ``render`` function: .. code-block:: jinja {# src/Acme/DemoBundle/Resources/views/Demo/index.html.twig #} - {% render url('fancy', { 'name': name, 'color': 'green'}) %} - -.. include:: /book/_security-2012-6431.rst.inc + {{ render(controller("AcmeDemoBundle:Demo:fancy", {'name': name, 'color': 'green'})) }} -The ``render`` tag will execute the ``AcmeDemoBundle:Demo:fancy`` controller -and include its result. For example, your new ``fancyAction`` might look -like this:: +Here, the ``AcmeDemoBundle:Demo:fancy`` string refers to the ``fancy`` action +of the ``Demo`` controller. The arguments (``name`` and ``color``) act like +simulated request variables (as if the ``fancyAction`` were handling a whole +new request) and are made available to the controller:: // src/Acme/DemoBundle/Controller/DemoController.php @@ -243,7 +205,7 @@ like this:: return $this->render('AcmeDemoBundle:Demo:fancy.html.twig', array( 'name' => $name, - 'object' => $object + 'object' => $object, )); } diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 404b9b1dc2f..661d7574205 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -23,6 +23,18 @@ Functions +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | Function Syntax | Usage | +====================================================+============================================================================================+ +| ``render(controller('B:C:a', {params}))`` | This will render the Response Content for the given controller or | +| ``render(path('route', {params}))`` | URL. For more information, see :ref:`templating-embedding-controller`. | +| ``render(url('route', {params}))`` | | ++----------------------------------------------------+--------------------------------------------------------------------------------------------+ +| ``render_esi(controller('B:C:a', {params}))`` | This will generates an ESI tag when possible or fallback to the ``render`` | +| ``render_esi(url('route', {params}))`` | behavior otherwise. For more information, see :ref:`templating-embedding-controller`. | +| ``render_esi(path('route', {params}))`` | | ++----------------------------------------------------+--------------------------------------------------------------------------------------------+ +| ``render_hinclude(controller('B:C:a', {params}))`` | This will generates an Hinclude tag for the given controller or URL. | +| ``render_hinclude(url('route', {params}))`` | For more information, see :ref:`templating-embedding-controller`. | +| ``render_hinclude(path('route', {params}))`` | | ++----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``asset(path, packageName = null)`` | Get the public path of the asset, more information in | | | ":ref:`book-templating-assets`". | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ @@ -113,10 +125,6 @@ Tags +---------------------------------------------------+-------------------------------------------------------------------+ | Tag Syntax | Usage | +===================================================+===================================================================+ -| ``{% render url('route', {parameters}) %}`` | This will render the Response Content for the given controller | -| | that the URL points to. For more information, | -| | see :ref:`templating-embedding-controller`. | -+---------------------------------------------------+-------------------------------------------------------------------+ | ``{% form_theme form 'file' %}`` | This will look inside the given file for overridden form blocks, | | | more information in :doc:`/cookbook/form/form_customization`. | +---------------------------------------------------+-------------------------------------------------------------------+ From abdcf9f7f4afa355a8fedd9921a42f73fc21fb76 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 12 Jan 2013 10:59:20 +0100 Subject: [PATCH 0074/2078] fixed markup --- cookbook/service_container/scopes.rst | 40 +++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/cookbook/service_container/scopes.rst b/cookbook/service_container/scopes.rst index 7bc561ee44f..aee6710636f 100644 --- a/cookbook/service_container/scopes.rst +++ b/cookbook/service_container/scopes.rst @@ -7,7 +7,7 @@ How to work with Scopes This entry is all about scopes, a somewhat advanced topic related to the :doc:`/book/service_container`. If you've ever gotten an error mentioning "scopes" when creating services, or need to create a service that depends -on the `request` service, then this entry is for you. +on the ``request`` service, then this entry is for you. Understanding Scopes -------------------- @@ -16,49 +16,49 @@ The scope of a service controls how long an instance of a service is used by the container. The Dependency Injection component provides two generic scopes: -- `container` (the default one): The same instance is used each time you +- ``container`` (the default one): The same instance is used each time you request it from this container. -- `prototype`: A new instance is created each time you request the service. +- ``prototype``: A new instance is created each time you request the service. -The FrameworkBundle also defines a third scope: `request`. This scope is +The FrameworkBundle also defines a third scope: ``request``. This scope is tied to the request, meaning a new instance is created for each subrequest and is unavailable outside the request (for instance in the CLI). Scopes add a constraint on the dependencies of a service: a service cannot depend on services from a narrower scope. For example, if you create a generic -`my_foo` service, but try to inject the `request` component, you'll receive +``my_foo`` service, but try to inject the ``request`` component, you'll receive a :class:`Symfony\\Component\\DependencyInjection\\Exception\\ScopeWideningInjectionException` when compiling the container. Read the sidebar below for more details. .. sidebar:: Scopes and Dependencies - Imagine you've configured a `my_mailer` service. You haven't configured - the scope of the service, so it defaults to `container`. In other words, - every time you ask the container for the `my_mailer` service, you get + Imagine you've configured a ``my_mailer`` service. You haven't configured + the scope of the service, so it defaults to ``container``. In other words, + every time you ask the container for the ``my_mailer`` service, you get the same object back. This is usually how you want your services to work. - Imagine, however, that you need the `request` service in your `my_mailer` + Imagine, however, that you need the ``request`` service in your ``my_mailer`` service, maybe because you're reading the URL of the current request. So, you add it as a constructor argument. Let's look at why this presents a problem: - * When requesting `my_mailer`, an instance of `my_mailer` (let's call - it *MailerA*) is created and the `request` service (let's call it + * When requesting ``my_mailer``, an instance of ``my_mailer`` (let's call + it *MailerA*) is created and the ``request`` service (let's call it *RequestA*) is passed to it. Life is good! * You've now made a subrequest in Symfony, which is a fancy way of saying - that you've called, for example, the `{{ render(...) }}` Twig function, - which executes another controller. Internally, the old `request` service + that you've called, for example, the ``{{ render(...) }}`` Twig function, + which executes another controller. Internally, the old ``request`` service (*RequestA*) is actually replaced by a new request instance (*RequestB*). This happens in the background, and it's totally normal. - * In your embedded controller, you once again ask for the `my_mailer` - service. Since your service is in the `container` scope, the same + * In your embedded controller, you once again ask for the ``my_mailer`` + service. Since your service is in the ``container`` scope, the same instance (*MailerA*) is just re-used. But here's the problem: the *MailerA* instance still contains the old *RequestA* object, which is now **not** the correct request object to have (*RequestB* is now - the current `request` service). This is subtle, but the mis-match could + the current ``request`` service). This is subtle, but the mis-match could cause major problems, which is why it's not allowed. So, that's the reason *why* scopes exist, and how they can cause @@ -101,9 +101,9 @@ The scope of a service is set in the definition of the service: new Definition('Acme\HelloBundle\Mail\GreetingCardManager') )->setScope('request'); -If you don't specify the scope, it defaults to `container`, which is what +If you don't specify the scope, it defaults to ``container``, which is what you want most of the time. Unless your service depends on another service -that's scoped to a narrower scope (most commonly, the `request` service), +that's scoped to a narrower scope (most commonly, the ``request`` service), you probably don't need to set the scope. Using a Service from a narrower Scope @@ -111,10 +111,10 @@ Using a Service from a narrower Scope If your service depends on a scoped service, the best solution is to put it in the same scope (or a narrower one). Usually, this means putting your -new service in the `request` scope. +new service in the ``request`` scope. But this is not always possible (for instance, a twig extension must be in -the `container` scope as the Twig environment needs it as a dependency). +the ``container`` scope as the Twig environment needs it as a dependency). In these cases, you should pass the entire container into your service and retrieve your dependency from the container each time you need it to be sure you have the right instance:: From 1550871c82c6cd440a2c5b7bce81f93ab4ad6fe1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 12 Jan 2013 11:02:24 +0100 Subject: [PATCH 0075/2078] switched usage of the include tag to the include function --- book/templating.rst | 6 ++---- quick_tour/the_view.rst | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index e1f448ba9d4..54d282ebc2f 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -532,9 +532,7 @@ Including this template from any other template is simple:

Recent Articles

{% for article in articles %} - {% include 'AcmeArticleBundle:Article:articleDetails.html.twig' - with {'article': article} - %} + {{ include('AcmeArticleBundle:Article:articleDetails.html.twig', {'article': article}) }} {% endfor %} {% endblock %} @@ -551,7 +549,7 @@ Including this template from any other template is simple: stop() ?> -The template is included using the ``{% include %}`` tag. Notice that the +The template is included using the ``{{ include() }}`` function. Notice that the template name follows the same typical convention. The ``articleDetails.html.twig`` template uses an ``article`` variable. This is passed in by the ``list.html.twig`` template using the ``with`` command. diff --git a/quick_tour/the_view.rst b/quick_tour/the_view.rst index 913f7c93e92..ad3ed4557ff 100644 --- a/quick_tour/the_view.rst +++ b/quick_tour/the_view.rst @@ -170,7 +170,7 @@ And change the ``index.html.twig`` template to include it: {# override the body block from embedded.html.twig #} {% block content %} - {% include "AcmeDemoBundle:Demo:embedded.html.twig" %} + {{ include("AcmeDemoBundle:Demo:embedded.html.twig") }} {% endblock %} Embedding other Controllers From 08a284724e3ae1b6fbc6a4c692ab773bd208f13b Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 13 Jan 2013 10:34:00 -0600 Subject: [PATCH 0076/2078] [#2121] Fixing a now defunct include --- book/security.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/book/security.rst b/book/security.rst index ab4b3090de7..9d97dc30433 100644 --- a/book/security.rst +++ b/book/security.rst @@ -921,8 +921,6 @@ Now, if the same request comes from ``127.0.0.1``: * The second access rule is not examined as the first rule matched. -.. include:: /book/_security-2012-6431.rst.inc - .. _book-security-securing-channel: Securing by Channel From a8d444e40e56180212c097852b41a0deb224489e Mon Sep 17 00:00:00 2001 From: Johnny Robeson Date: Sun, 13 Jan 2013 14:33:03 -0500 Subject: [PATCH 0077/2078] Fix UsernameNotFoundException example (take 2) here is the fix properly applied to master --- cookbook/security/entity_provider.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index e67be2213f4..3213a5d0ee5 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -384,7 +384,7 @@ The code below shows the implementation of the // if there is no record matching the criteria. $user = $q->getSingleResult(); } catch (NoResultException $e) { - throw new UsernameNotFoundException(sprintf('Unable to find an active admin AcmeUserBundle:User object identified by "%s".', $username), null, 0, $e); + throw new UsernameNotFoundException(sprintf('Unable to find an active admin AcmeUserBundle:User object identified by "%s".', $username), 0, $e); } return $user; From 21178b1b14bf74ea635beacf5b024b48560b7a8f Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 13 Jan 2013 13:49:29 -0600 Subject: [PATCH 0078/2078] [#2121] Tweaking a few things related to new render changes --- book/http_cache.rst | 23 +++++++++++++++-------- book/templating.rst | 10 +++++++--- quick_tour/the_view.rst | 2 +- reference/twig_reference.rst | 13 ++++++++++--- 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/book/http_cache.rst b/book/http_cache.rst index 76eef9765e6..db6afebf919 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -906,12 +906,13 @@ writing the ESI tag yourself. That's because using a helper makes your application work even if there is no gateway cache installed. When using the default ``render`` function (or setting the strategy to -``default``), Symfony2 merges the included page content within the main one -before sending the response to the client. But when using ``esi`` strategy, -*and* if Symfony2 detects that it's talking to a gateway cache that supports -ESI, it generates an ESI include tag. But if there is no gateway cache or if -it does not support ESI, Symfony2 will just merge the included page content -within the main one as it would have done if you had used ``render``. +``default``), Symfony2 merges the included page content into the main one +before sending the response to the client. But if you use the ``esi`` strategy +(i.e. call ``render_esi``), *and* if Symfony2 detects that it's talking to +a gateway cache that supports ESI, it generates an ESI include tag. But if +there is no gateway cache or if it does not support ESI, Symfony2 will just +merge the included page content within the main one as it would have done +if you had used ``render``. .. note:: @@ -938,8 +939,8 @@ When using a controller reference, the ESI tag should reference the embedded action as an accessible URL so the gateway cache can fetch it independently of the rest of the page. Of course, an action can't be accessed via a URL unless it has a route that points to it. Symfony2 takes care of this via a generic -route and controller. For the ESI include tag to work properly, you must -define the ``_proxy`` route: +route. For the ESI include tag to work properly, you must define the ``_proxy`` +route: .. configuration-block:: @@ -976,6 +977,12 @@ One great advantage of this caching strategy is that you can make your application as dynamic as needed and at the same time, hit the application as little as possible. +.. tip:: + + The proxy route doesn't point to a real controller. Instead, it's handled + by an internal :class:`Symfony\\Component\\HttpKernel\\EventListener\\RouterProxyListener` + class. This listener only responds to local IP addresses or trusted proxies. + .. note:: Once you start using ESI, remember to always use the ``s-maxage`` diff --git a/book/templating.rst b/book/templating.rst index 54d282ebc2f..720befe4465 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -560,6 +560,10 @@ template using the ``with`` command. maps (i.e. an array with named keys). If you needed to pass in multiple elements, it would look like this: ``{'foo': foo, 'bar': bar}``. +.. versionadded:: 2.2 + The ``include()`` function is a new Twig feature that's available in + Symfony 2.2. Prior, the ``{% include %}`` tag was used. + .. index:: single: Templating; Embedding action @@ -715,10 +719,10 @@ in your application configuration: )); .. versionadded:: 2.2 - Default templates per render tag was added in Symfony 2.2 + Default templates per render function was added in Symfony 2.2 -You can define default templates per ``render`` tag (which will override -any global default templates that is defined): +You can define default templates per ``render`` function (which will override +any global default template that is defined): .. configuration-block:: diff --git a/quick_tour/the_view.rst b/quick_tour/the_view.rst index ad3ed4557ff..60788277a0d 100644 --- a/quick_tour/the_view.rst +++ b/quick_tour/the_view.rst @@ -182,7 +182,7 @@ some variable not available in the main template. Suppose you've created a ``fancyAction`` controller method, and you want to "render" it inside the ``index`` template, which means including the result -(e.g. ``HTML``) of the controller, use the ``render`` function: +(e.g. ``HTML``) of the controller. To do this, use the ``render`` function: .. code-block:: jinja diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 661d7574205..90076fcca20 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -20,21 +20,28 @@ Functions .. versionadded:: 2.1 The ``csrf_token``, ``logout_path`` and ``logout_url`` functions were added in Symfony2.1 +.. versionadded:: 2.3 + The ``render`` and ``controller`` functions are new in Symfony 2.2. Prior, + the ``{% render %}`` tag was used and had a different signature. + +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | Function Syntax | Usage | +====================================================+============================================================================================+ -| ``render(controller('B:C:a', {params}))`` | This will render the Response Content for the given controller or | -| ``render(path('route', {params}))`` | URL. For more information, see :ref:`templating-embedding-controller`. | +| ``render(uri, options = {})`` | This will render the Response Content for the given controller or | +| ``render(controller('B:C:a', {params}))`` | URL. For more information, see :ref:`templating-embedding-controller`. | +| ``render(path('route', {params}))`` | | | ``render(url('route', {params}))`` | | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``render_esi(controller('B:C:a', {params}))`` | This will generates an ESI tag when possible or fallback to the ``render`` | | ``render_esi(url('route', {params}))`` | behavior otherwise. For more information, see :ref:`templating-embedding-controller`. | | ``render_esi(path('route', {params}))`` | | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ -| ``render_hinclude(controller('B:C:a', {params}))`` | This will generates an Hinclude tag for the given controller or URL. | +| ``render_hinclude(controller(...))`` | This will generates an Hinclude tag for the given controller or URL. | | ``render_hinclude(url('route', {params}))`` | For more information, see :ref:`templating-embedding-controller`. | | ``render_hinclude(path('route', {params}))`` | | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ +| ``controller(attributes = {}, query = {})`` | Used along with the ``render`` tag to refer to the controller that you want to render | ++----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``asset(path, packageName = null)`` | Get the public path of the asset, more information in | | | ":ref:`book-templating-assets`". | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ From f320634a0edb3c602112f1eb4d54fddc37ec5ec8 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 15 Jan 2013 08:19:08 -0500 Subject: [PATCH 0079/2078] Fixing a typo --- components/console/helpers/dialoghelper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index e35e7ed4fcc..1b1070a4166 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -59,7 +59,7 @@ Hiding the User's Response .. versionadded:: 2.2 The ``askHiddenResponse`` method was added in Symfony 2.2. -You can also ask question and hide the response. This is particularly +You can also ask a question and hide the response. This is particularly convenient for passwords:: $dialog = $this->getHelperSet()->get('dialog'); From 6fd5ffce435974a9f7338f7f93c3ece275ccd897 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 20 Jan 2013 09:28:34 +0100 Subject: [PATCH 0080/2078] added a missing reference to the proxy route (refs symfony/symfony-standard#475) --- book/templating.rst | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/book/templating.rst b/book/templating.rst index 720befe4465..def233ccdba 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -688,6 +688,42 @@ Symfony2 uses the standard ``render`` helper to configure ``hinclude`` tags: hinclude.js_ needs to be included in your page to work. +.. note:: + + When using a controller instead of an URL, you must enable the Symfony + ``proxy`` routing configuration: + + .. configuration-block:: + + .. code-block:: yaml + + # app/config/routing.yml + _proxy: + resource: "@FrameworkBundle/Resources/config/routing/proxy.xml" + prefix: /proxy + + .. code-block:: xml + + + + + + + + + + .. code-block:: php + + // app/config/routing.php + use Symfony\Component\Routing\RouteCollection; + use Symfony\Component\Routing\Route; + + $collection->addCollection($loader->import('@FrameworkBundle/Resources/config/routing/proxy.xml', '/proxy')); + + return $collection; + Default content (while loading or if javascript is disabled) can be set globally in your application configuration: From 700f5291e512311d10970465da4513d60ec74d9d Mon Sep 17 00:00:00 2001 From: Javier Lopez Date: Sun, 20 Jan 2013 13:25:48 +0000 Subject: [PATCH 0081/2078] Update reference/configuration/framework.rst --- reference/configuration/framework.rst | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index aede5c5867a..61c9ca12a1a 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -126,12 +126,22 @@ Whether to enable or not the serializer service in the service container. If ena the serializer will be loaded along with two encoders (:class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder` and :class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`) but none normalizer. The :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer` is broken by design -so you are required to load it under your responsability. You can do creating a new service and tagging it appropiately. +so you are required to load it under your responsability. -You can add more normalizers and/or encoders by tagging them as ``serializer.encoder`` and +You can load more normalizers and/or encoders by tagging them as ``serializer.encoder`` and ``serializer.normalizer``. It's also possible to set the priority of the tag in order to decide the matching order. +Here an example on how to load the load +the :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`: + + # app/config/config.yml + services: + get_set_method_normalizer: + class: Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer + tags: + - { name: serializer.normalizer } + templating ~~~~~~~~~~ From 63fae5b639a0cde4b9fe1630a2579bb6e10473c9 Mon Sep 17 00:00:00 2001 From: Javier Lopez Date: Sun, 20 Jan 2013 13:28:33 +0000 Subject: [PATCH 0082/2078] Update reference/configuration/framework.rst --- reference/configuration/framework.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 61c9ca12a1a..8781dff2bc9 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -135,6 +135,8 @@ matching order. Here an example on how to load the load the :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`: +.. code-block:: yaml + # app/config/config.yml services: get_set_method_normalizer: From 52713f59615eb320a0738fa01b926ac4e0402fd4 Mon Sep 17 00:00:00 2001 From: Sebastiaan Stok Date: Mon, 21 Jan 2013 09:36:51 +0100 Subject: [PATCH 0083/2078] Update reference/constraints/Callback.rst addViolationAtSubPath() is deprecated since version 2.2 and will be removed in 2.3. Use addViolationAt() instead. --- reference/constraints/Callback.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/Callback.rst b/reference/constraints/Callback.rst index 2c5d0091f60..ef82a323f0a 100644 --- a/reference/constraints/Callback.rst +++ b/reference/constraints/Callback.rst @@ -105,7 +105,7 @@ those errors should be attributed:: // check if the name is actually a fake name if (in_array($this->getFirstName(), $fakeNames)) { - $context->addViolationAtSubPath('firstname', 'This name sounds totally fake!', array(), null); + $context->addViolationAt('firstname', 'This name sounds totally fake!', array(), null); } } } From 8420b022728a0cbd9628831bca25734d04058f03 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Mon, 21 Jan 2013 14:16:29 +0100 Subject: [PATCH 0084/2078] Fixes most pattern, _scheme or _method occurences --- book/controller.rst | 14 +-- book/from_flat_php_to_symfony2.rst | 4 +- book/http_fundamentals.rst | 4 +- book/page_creation.rst | 10 +- book/routing.rst | 107 ++++++++---------- book/templating.rst | 8 +- book/translation.rst | 6 +- components/routing/hostname_pattern.rst | 32 +++--- components/routing/introduction.rst | 49 ++++---- cookbook/routing/method_parameters.rst | 46 +++----- cookbook/routing/redirect_in_config.rst | 4 +- cookbook/routing/scheme.rst | 18 ++- .../routing/service_container_parameters.rst | 14 +-- cookbook/routing/slash_in_parameter.rst | 10 +- 14 files changed, 145 insertions(+), 181 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index efd310c8b33..ca6692b5565 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -141,7 +141,7 @@ Mapping a URL to a Controller ----------------------------- The new controller returns a simple HTML page. To actually view this page -in your browser, you need to create a route, which maps a specific URL pattern +in your browser, you need to create a route, which maps a specific URL path to the controller: .. configuration-block:: @@ -150,13 +150,13 @@ to the controller: # app/config/routing.yml hello: - pattern: /hello/{name} - defaults: { _controller: AcmeHelloBundle:Hello:index } + path: /hello/{name} + defaults: { _controller: AcmeHelloBundle:Hello:index } .. code-block:: xml - + AcmeHelloBundle:Hello:index @@ -229,13 +229,13 @@ example: # app/config/routing.yml hello: - pattern: /hello/{first_name}/{last_name} - defaults: { _controller: AcmeHelloBundle:Hello:index, color: green } + path: /hello/{first_name}/{last_name} + defaults: { _controller: AcmeHelloBundle:Hello:index, color: green } .. code-block:: xml - + AcmeHelloBundle:Hello:index green diff --git a/book/from_flat_php_to_symfony2.rst b/book/from_flat_php_to_symfony2.rst index 3796084c3e7..8476bc1d010 100644 --- a/book/from_flat_php_to_symfony2.rst +++ b/book/from_flat_php_to_symfony2.rst @@ -639,11 +639,11 @@ A routing configuration map provides this information in a readable format: # app/config/routing.yml blog_list: - pattern: /blog + path: /blog defaults: { _controller: AcmeBlogBundle:Blog:list } blog_show: - pattern: /blog/show/{id} + path: /blog/show/{id} defaults: { _controller: AcmeBlogBundle:Blog:show } Now that Symfony2 is handling all the mundane tasks, the front controller diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index c39d0889856..ff864cd9a4c 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -423,12 +423,12 @@ by adding an entry for ``/contact`` to your routing configuration file: # app/config/routing.yml contact: - pattern: /contact + path: /contact defaults: { _controller: AcmeDemoBundle:Main:contact } .. code-block:: xml - + AcmeBlogBundle:Main:contact diff --git a/book/page_creation.rst b/book/page_creation.rst index b07b7b43b96..e30f0c7d5d3 100644 --- a/book/page_creation.rst +++ b/book/page_creation.rst @@ -8,7 +8,7 @@ Creating a new page in Symfony2 is a simple two-step process: * *Create a route*: A route defines the URL (e.g. ``/about``) to your page and specifies a controller (which is a PHP function) that Symfony2 should - execute when the URL of an incoming request matches the route pattern; + execute when the URL of an incoming request matches the route path; * *Create a controller*: A controller is a PHP function that takes the incoming request and transforms it into the Symfony2 ``Response`` object that's @@ -147,7 +147,7 @@ the new route that defines the URL of the page that you're about to create: # src/Acme/HelloBundle/Resources/config/routing.yml hello: - pattern: /hello/{name} + path: /hello/{name} defaults: { _controller: AcmeHelloBundle:Hello:index } .. code-block:: xml @@ -159,7 +159,7 @@ the new route that defines the URL of the page that you're about to create: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeHelloBundle:Hello:index @@ -177,9 +177,9 @@ the new route that defines the URL of the page that you're about to create: return $collection; -The routing consists of two basic pieces: the ``pattern``, which is the URL +The routing consists of two basic pieces: the ``path``, which is the URL that this route will match, and a ``defaults`` array, which specifies the -controller that should be executed. The placeholder syntax in the pattern +controller that should be executed. The placeholder syntax in the path (``{name}``) is a wildcard. It means that ``/hello/Ryan``, ``/hello/Fabien`` or any other similar URL will match this route. The ``{name}`` placeholder parameter will also be passed to the controller so that you can use its value diff --git a/book/routing.rst b/book/routing.rst index f077111514c..d13d6118756 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -27,7 +27,7 @@ areas of your application. By the end of this chapter, you'll be able to: Routing in Action ----------------- -A *route* is a map from a URL pattern to a controller. For example, suppose +A *route* is a map from a URL path to a controller. For example, suppose you want to match any URL like ``/blog/my-post`` or ``/blog/all-about-symfony`` and send it to a controller that can look up and render that blog entry. The route is simple: @@ -38,7 +38,7 @@ The route is simple: # app/config/routing.yml blog_show: - pattern: /blog/{slug} + path: /blog/{slug} defaults: { _controller: AcmeBlogBundle:Blog:show } .. code-block:: xml @@ -49,7 +49,7 @@ The route is simple: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeBlogBundle:Blog:show @@ -67,7 +67,7 @@ The route is simple: return $collection; -The pattern defined by the ``blog_show`` route acts like ``/blog/*`` where +The path defined by the ``blog_show`` route acts like ``/blog/*`` where the wildcard is given the name ``slug``. For the URL ``/blog/my-blog-post``, the ``slug`` variable gets a value of ``my-blog-post``, which is available for you to use in your controller (keep reading). @@ -186,7 +186,7 @@ Basic Route Configuration ~~~~~~~~~~~~~~~~~~~~~~~~~ Defining a route is easy, and a typical application will have lots of routes. -A basic route consists of just two parts: the ``pattern`` to match and a +A basic route consists of just two parts: the ``path`` to match and a ``defaults`` array: .. configuration-block:: @@ -194,7 +194,7 @@ A basic route consists of just two parts: the ``pattern`` to match and a .. code-block:: yaml _welcome: - pattern: / + path: / defaults: { _controller: AcmeDemoBundle:Main:homepage } .. code-block:: xml @@ -205,7 +205,7 @@ A basic route consists of just two parts: the ``pattern`` to match and a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeDemoBundle:Main:homepage @@ -242,7 +242,7 @@ routes will contain one or more named "wildcard" placeholders: .. code-block:: yaml blog_show: - pattern: /blog/{slug} + path: /blog/{slug} defaults: { _controller: AcmeBlogBundle:Blog:show } .. code-block:: xml @@ -253,7 +253,7 @@ routes will contain one or more named "wildcard" placeholders: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeBlogBundle:Blog:show @@ -270,13 +270,13 @@ routes will contain one or more named "wildcard" placeholders: return $collection; -The pattern will match anything that looks like ``/blog/*``. Even better, +The path will match anything that looks like ``/blog/*``. Even better, the value matching the ``{slug}`` placeholder will be available inside your controller. In other words, if the URL is ``/blog/hello-world``, a ``$slug`` variable, with a value of ``hello-world``, will be available in the controller. This can be used, for example, to load the blog post matching that string. -The pattern will *not*, however, match simply ``/blog``. That's because, +The path will *not*, however, match simply ``/blog``. That's because, by default, all placeholders are required. This can be changed by adding a placeholder value to the ``defaults`` array. @@ -291,7 +291,7 @@ the available blog posts for this imaginary blog application: .. code-block:: yaml blog: - pattern: /blog + path: /blog defaults: { _controller: AcmeBlogBundle:Blog:index } .. code-block:: xml @@ -302,7 +302,7 @@ the available blog posts for this imaginary blog application: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeBlogBundle:Blog:index @@ -329,7 +329,7 @@ entries? Update the route to have a new ``{page}`` placeholder: .. code-block:: yaml blog: - pattern: /blog/{page} + path: /blog/{page} defaults: { _controller: AcmeBlogBundle:Blog:index } .. code-block:: xml @@ -340,7 +340,7 @@ entries? Update the route to have a new ``{page}`` placeholder: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeBlogBundle:Blog:index @@ -372,7 +372,7 @@ This is done by including it in the ``defaults`` collection: .. code-block:: yaml blog: - pattern: /blog/{page} + path: /blog/{page} defaults: { _controller: AcmeBlogBundle:Blog:index, page: 1 } .. code-block:: xml @@ -383,7 +383,7 @@ This is done by including it in the ``defaults`` collection: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeBlogBundle:Blog:index 1 @@ -433,11 +433,11 @@ Take a quick look at the routes that have been created so far: .. code-block:: yaml blog: - pattern: /blog/{page} + path: /blog/{page} defaults: { _controller: AcmeBlogBundle:Blog:index, page: 1 } blog_show: - pattern: /blog/{slug} + path: /blog/{slug} defaults: { _controller: AcmeBlogBundle:Blog:show } .. code-block:: xml @@ -448,12 +448,12 @@ Take a quick look at the routes that have been created so far: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeBlogBundle:Blog:index 1 - + AcmeBlogBundle:Blog:show @@ -475,7 +475,7 @@ Take a quick look at the routes that have been created so far: return $collection; -Can you spot the problem? Notice that both routes have patterns that match +Can you spot the problem? Notice that both routes have paths that match URL's that look like ``/blog/*``. The Symfony router will always choose the **first** matching route it finds. In other words, the ``blog_show`` route will *never* be matched. Instead, a URL like ``/blog/my-blog-post`` will match @@ -491,7 +491,7 @@ to the ``{page}`` parameter. +--------------------+-------+-----------------------+ The answer to the problem is to add route *requirements*. The routes in this -example would work perfectly if the ``/blog/{page}`` pattern *only* matched +example would work perfectly if the ``/blog/{page}`` path *only* matched URLs where the ``{page}`` portion is an integer. Fortunately, regular expression requirements can easily be added for each parameter. For example: @@ -500,7 +500,7 @@ requirements can easily be added for each parameter. For example: .. code-block:: yaml blog: - pattern: /blog/{page} + path: /blog/{page} defaults: { _controller: AcmeBlogBundle:Blog:index, page: 1 } requirements: page: \d+ @@ -513,7 +513,7 @@ requirements can easily be added for each parameter. For example: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeBlogBundle:Blog:index 1 \d+ @@ -570,7 +570,7 @@ URL: .. code-block:: yaml homepage: - pattern: /{culture} + path: /{culture} defaults: { _controller: AcmeDemoBundle:Main:homepage, culture: en } requirements: culture: en|fr @@ -583,7 +583,7 @@ URL: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeDemoBundle:Main:homepage en en|fr @@ -635,16 +635,14 @@ be accomplished with the following route configuration: .. code-block:: yaml contact: - pattern: /contact + path: /contact defaults: { _controller: AcmeDemoBundle:Main:contact } - requirements: - _method: GET + methods: [GET] contact_process: - pattern: /contact + path: /contact defaults: { _controller: AcmeDemoBundle:Main:contactProcess } - requirements: - _method: POST + methods: [POST] .. code-block:: xml @@ -654,14 +652,12 @@ be accomplished with the following route configuration: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeDemoBundle:Main:contact - GET - + AcmeDemoBundle:Main:contactProcess - POST @@ -673,29 +669,22 @@ be accomplished with the following route configuration: $collection = new RouteCollection(); $collection->add('contact', new Route('/contact', array( '_controller' => 'AcmeDemoBundle:Main:contact', - ), array( - '_method' => 'GET', - ))); + ), array(), array(), '', array(), array('GET'))); $collection->add('contact_process', new Route('/contact', array( '_controller' => 'AcmeDemoBundle:Main:contactProcess', - ), array( - '_method' => 'POST', - ))); + ), array(), array(), '', array(), array('POST'))); return $collection; -Despite the fact that these two routes have identical patterns (``/contact``), +Despite the fact that these two routes have identical paths (``/contact``), the first route will match only GET requests and the second route will match only POST requests. This means that you can display the form and submit the form via the same URL, while using distinct controllers for the two actions. .. note:: - If no ``_method`` requirement is specified, the route will match on - *all* methods. -Like the other requirements, the ``_method`` requirement is parsed as a regular -expression. To match ``GET`` *or* ``POST`` requests, you can use ``GET|POST``. + If no ``methods`` are specified, the route will match on *all* methods. Adding a Hostname Pattern ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -725,7 +714,7 @@ routing system can be: .. code-block:: yaml article_show: - pattern: /articles/{culture}/{year}/{title}.{_format} + path: /articles/{culture}/{year}/{title}.{_format} defaults: { _controller: AcmeDemoBundle:Article:show, _format: html } requirements: culture: en|fr @@ -740,7 +729,7 @@ routing system can be: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeDemoBundle:Article:show html en|fr @@ -961,7 +950,7 @@ like this: # src/Acme/HelloBundle/Resources/config/routing.yml acme_hello: - pattern: /hello/{name} + path: /hello/{name} defaults: { _controller: AcmeHelloBundle:Hello:index } .. code-block:: xml @@ -973,7 +962,7 @@ like this: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeHelloBundle:Hello:index @@ -998,7 +987,7 @@ Prefixing Imported Routes ~~~~~~~~~~~~~~~~~~~~~~~~~ You can also choose to provide a "prefix" for the imported routes. For example, -suppose you want the ``acme_hello`` route to have a final pattern of ``/admin/hello/{name}`` +suppose you want the ``acme_hello`` route to have a final path of ``/admin/hello/{name}`` instead of simply ``/hello/{name}``: .. configuration-block:: @@ -1032,8 +1021,8 @@ instead of simply ``/hello/{name}``: return $collection; -The string ``/admin`` will now be prepended to the pattern of each route -loaded from the new routing resource. +The string ``/admin`` will now be prepended to the path of each route loaded +from the new routing resource. .. tip:: @@ -1047,8 +1036,8 @@ Adding a Hostname Pattern to Imported Routes .. versionadded:: 2.2 Hostname matching support was added in Symfony 2.2 -You can set a hostname pattern on imported routes. For more information, -see :ref:`component-routing-hostname-imported`. +You can set the hostname on imported routes. For more information, see +:ref:`component-routing-hostname-imported`. .. index:: single: Routing; Debugging @@ -1118,8 +1107,8 @@ system. Take the ``blog_show`` example route from earlier:: // /blog/my-blog-post To generate a URL, you need to specify the name of the route (e.g. ``blog_show``) -and any wildcards (e.g. ``slug = my-blog-post``) used in the pattern for -that route. With this information, any URL can easily be generated:: +and any wildcards (e.g. ``slug = my-blog-post``) used in the path for that +route. With this information, any URL can easily be generated:: class MainController extends Controller { diff --git a/book/templating.rst b/book/templating.rst index 720befe4465..b13e5c4815e 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -781,12 +781,12 @@ configuration: .. code-block:: yaml _welcome: - pattern: / + path: / defaults: { _controller: AcmeDemoBundle:Welcome:index } .. code-block:: xml - + AcmeDemoBundle:Welcome:index @@ -819,12 +819,12 @@ route: .. code-block:: yaml article_show: - pattern: /article/{slug} + path: /article/{slug} defaults: { _controller: AcmeArticleBundle:Article:show } .. code-block:: xml - + AcmeArticleBundle:Article:show diff --git a/book/translation.rst b/book/translation.rst index 6c6ea3da1c2..efefdccd256 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -299,7 +299,7 @@ priority message files. The filename of the translations is also important as Symfony2 uses a convention to determine details about the translations. Each message file must be named -according to the following pattern: ``domain.locale.loader``: +according to the following path: ``domain.locale.loader``: * **domain**: An optional way to organize messages into groups (e.g. ``admin``, ``navigation`` or the default ``messages``) - see `Using Message Domains`_; @@ -571,14 +571,14 @@ by the routing system using the special ``_locale`` parameter: .. code-block:: yaml contact: - pattern: /{_locale}/contact + path: /{_locale}/contact defaults: { _controller: AcmeDemoBundle:Contact:index, _locale: en } requirements: _locale: en|fr|de .. code-block:: xml - + AcmeDemoBundle:Contact:index en en|fr|de diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst index f41f2db5414..488b000373e 100644 --- a/components/routing/hostname_pattern.rst +++ b/components/routing/hostname_pattern.rst @@ -14,12 +14,12 @@ You can also match on the HTTP *hostname* of the incoming request. .. code-block:: yaml mobile_homepage: - pattern: / - hostname_pattern: m.example.com + path: / + hostname: m.example.com defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } homepage: - pattern: / + path: / defaults: { _controller: AcmeDemoBundle:Main:homepage } .. code-block:: xml @@ -32,11 +32,11 @@ You can also match on the HTTP *hostname* of the incoming request. http://symfony.com/schema/routing/routing-1.0.xsd" > - + AcmeDemoBundle:Main:mobileHomepage - + AcmeDemoBundle:Main:homepage @@ -57,7 +57,7 @@ You can also match on the HTTP *hostname* of the incoming request. return $collection; -Both routes match the same pattern ``/``, however the first one will match +Both routes match the same path ``/``, however the first one will match only if the hostname is ``m.example.com``. Placeholders and Requirements in Hostname Patterns @@ -77,14 +77,14 @@ dependency injection container parameter. .. code-block:: yaml mobile_homepage: - pattern: / - hostname_pattern: m.{domain} + path: / + hostname: m.{domain} defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } requirements: domain: %domain% homepage: - pattern: / + path: / defaults: { _controller: AcmeDemoBundle:Main:homepage } .. code-block:: xml @@ -95,12 +95,12 @@ dependency injection container parameter. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeDemoBundle:Main:mobileHomepage %domain% - + AcmeDemoBundle:Main:homepage @@ -128,7 +128,7 @@ dependency injection container parameter. Adding a Hostname Pattern to Imported Routes -------------------------------------------- -You can set a hostname pattern on imported routes: +You can set a hostname on imported routes: .. configuration-block:: @@ -137,7 +137,7 @@ You can set a hostname pattern on imported routes: # app/config/routing.yml acme_hello: resource: "@AcmeHelloBundle/Resources/config/routing.yml" - hostname_pattern: "hello.example.com" + hostname: "hello.example.com" .. code-block:: xml @@ -148,7 +148,7 @@ You can set a hostname pattern on imported routes: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + .. code-block:: php @@ -161,5 +161,5 @@ You can set a hostname pattern on imported routes: return $collection; -The hostname pattern ``hello.example.com`` will be set on each route -loaded from the new routing resource. +The hostname ``hello.example.com`` will be set on each route loaded from the +new routing resource. diff --git a/components/routing/introduction.rst b/components/routing/introduction.rst index daf0facf1aa..39cdad0d975 100644 --- a/components/routing/introduction.rst +++ b/components/routing/introduction.rst @@ -70,9 +70,9 @@ which holds the name of the matched route. Defining routes ~~~~~~~~~~~~~~~ -A full route definition can contain up to five parts: +A full route definition can contain up to seven parts: -1. The URL pattern route. This is matched against the URL passed to the `RequestContext`, +1. The URL path route. This is matched against the URL passed to the `RequestContext`, and can contain named wildcard placeholders (e.g. ``{placeholders}``) to match dynamic parts in the URL. @@ -85,11 +85,16 @@ placeholders as regular expressions. 4. An array of options. These contain internal settings for the route and are the least commonly needed. -5. A hostname pattern. This is matched against the hostname of the request. -See :doc:`/components/routing/hostname_pattern` for more details. +5. A hostname. This is matched against the hostname of the request. See + :doc:`/components/routing/hostname_pattern` for more details. + +6. An array of schemes. These enforce a certain HTTP scheme (``http``, ``https``). + +7. An array of methods. These enforce a certain HTTP request method (``HEAD``, + ``GET``, ``POST``, ...). .. versionadded:: 2.2 - The hostname pattern was added in Symfony 2.2 + The hostname was added in Symfony 2.2 Take the following route, which combines several of these ideas:: @@ -98,7 +103,9 @@ Take the following route, which combines several of these ideas:: array('controller' => 'showArchive'), // default values array('month' => '[0-9]{4}-[0-9]{2}', 'subdomain' => 'www|m'), // requirements array(), // options - '{subdomain}.example.com' // hostname + '{subdomain}.example.com', // hostname + array(), // schemes + array() // methods ); // ... @@ -118,21 +125,6 @@ In this case, the route is matched by ``/archive/2012-01``, because the ``{month wildcard matches the regular expression wildcard given. However, ``/archive/foo`` does *not* match, because "foo" fails the month wildcard. -Besides the regular expression constraints there are two special requirements -you can define: - -* ``_method`` enforces a certain HTTP request method (``HEAD``, ``GET``, ``POST``, ...) -* ``_scheme`` enforces a certain HTTP scheme (``http``, ``https``) - -For example, the following route would only accept requests to /foo with -the POST method and a secure connection:: - - $route = new Route( - '/foo', - array(), - array('_method' => 'post', '_scheme' => 'https' ) - ); - .. tip:: If you want to match all urls which start with a certain path and end in an @@ -150,8 +142,7 @@ Using Prefixes You can add routes or other instances of :class:`Symfony\\Component\\Routing\\RouteCollection` to *another* collection. This way you can build a tree of routes. Additionally you can define a prefix, -default requirements, default options, and hostname pattern to all routes -of a subtree:: +default requirements, default options and hostname to all routes of a subtree:: $rootCollection = new RouteCollection(); @@ -162,10 +153,10 @@ of a subtree:: $rootCollection->addCollection( $subCollection, '/prefix', // prefix - array('_scheme' => 'https'), // defaults array(), // requirements array(), // options 'admin.example.com', // hostname + array('https') // schemes ); Set the Request Parameters @@ -220,9 +211,9 @@ a certain route:: .. note:: - If you have defined the ``_scheme`` requirement, an absolute URL is generated - if the scheme of the current :class:`Symfony\\Component\\Routing\\RequestContext` - does not match the requirement. + If you have defined a scheme, an absolute URL is generated if the scheme + of the current :class:`Symfony\\Component\\Routing\\RequestContext` does + not match the requirement. Load Routes from a File ~~~~~~~~~~~~~~~~~~~~~~~ @@ -244,11 +235,11 @@ If you're using the ``YamlFileLoader``, then route definitions look like this: # routes.yml route1: - pattern: /foo + path: /foo defaults: { _controller: 'MyController::fooAction' } route2: - pattern: /foo/bar + path: /foo/bar defaults: { _controller: 'MyController::foobarAction' } To load this file, you can use the following code. This assumes that your diff --git a/cookbook/routing/method_parameters.rst b/cookbook/routing/method_parameters.rst index 26a614a121f..6499c7e79ff 100644 --- a/cookbook/routing/method_parameters.rst +++ b/cookbook/routing/method_parameters.rst @@ -1,37 +1,34 @@ .. index:: - single: Routing; _method + single: Routing; methods How to use HTTP Methods beyond GET and POST in Routes ===================================================== The HTTP method of a request is one of the requirements that can be checked when seeing if it matches a route. This is introduced in the routing chapter -of the book ":doc:`/book/routing`" with examples using GET and POST. You -can also use other HTTP verbs in this way. For example, if you have a blog -post entry then you could use the same URL pattern to show it, make changes -to it and delete it by matching on GET, PUT and DELETE. +of the book ":doc:`/book/routing`" with examples using GET and POST. You can +also use other HTTP verbs in this way. For example, if you have a blog post +entry then you could use the same URL path to show it, make changes to it and +delete it by matching on GET, PUT and DELETE. .. configuration-block:: .. code-block:: yaml blog_show: - pattern: /blog/{slug} + path: /blog/{slug} defaults: { _controller: AcmeDemoBundle:Blog:show } - requirements: - _method: GET + methods: [GET] blog_update: - pattern: /blog/{slug} + path: /blog/{slug} defaults: { _controller: AcmeDemoBundle:Blog:update } - requirements: - _method: PUT + methods: [PUT] blog_delete: - pattern: /blog/{slug} + path: /blog/{slug} defaults: { _controller: AcmeDemoBundle:Blog:delete } - requirements: - _method: DELETE + methods: [DELETE] .. code-block:: xml @@ -41,19 +38,16 @@ to it and delete it by matching on GET, PUT and DELETE. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeDemoBundle:Blog:show - GET - + AcmeDemoBundle:Blog:update - PUT - + AcmeDemoBundle:Blog:delete - DELETE @@ -65,21 +59,15 @@ to it and delete it by matching on GET, PUT and DELETE. $collection = new RouteCollection(); $collection->add('blog_show', new Route('/blog/{slug}', array( '_controller' => 'AcmeDemoBundle:Blog:show', - ), array( - '_method' => 'GET', - ))); + ), array(), array(), '', array(), array('GET'))); $collection->add('blog_update', new Route('/blog/{slug}', array( '_controller' => 'AcmeDemoBundle:Blog:update', - ), array( - '_method' => 'PUT', - ))); + ), array(), array(), '', array(), array('PUT'))); $collection->add('blog_delete', new Route('/blog/{slug}', array( '_controller' => 'AcmeDemoBundle:Blog:delete', - ), array( - '_method' => 'DELETE', - ))); + ), array(), array(), '', array('DELETE'))); return $collection; diff --git a/cookbook/routing/redirect_in_config.rst b/cookbook/routing/redirect_in_config.rst index 8b0945a0a06..4d6b7004e6e 100644 --- a/cookbook/routing/redirect_in_config.rst +++ b/cookbook/routing/redirect_in_config.rst @@ -20,7 +20,7 @@ Your configuration will look like this: prefix: /app root: - pattern: / + path: / defaults: _controller: FrameworkBundle:Redirect:urlRedirect path: /app @@ -37,4 +37,4 @@ for redirecting request: parameter with the *name* of the route you want to redirect to. The ``permanent`` switch tells both methods to issue a 301 HTTP status code -instead of the default ``302`` status code. \ No newline at end of file +instead of the default ``302`` status code. diff --git a/cookbook/routing/scheme.rst b/cookbook/routing/scheme.rst index ea4d3dfb90d..9786f7a0a27 100644 --- a/cookbook/routing/scheme.rst +++ b/cookbook/routing/scheme.rst @@ -6,17 +6,16 @@ How to force routes to always use HTTPS or HTTP Sometimes, you want to secure some routes and be sure that they are always accessed via the HTTPS protocol. The Routing component allows you to enforce -the URI scheme via the ``_scheme`` requirement: +the URI scheme via schemes: .. configuration-block:: .. code-block:: yaml secure: - pattern: /secure + path: /secure defaults: { _controller: AcmeDemoBundle:Main:secure } - requirements: - _scheme: https + schemes: [https] .. code-block:: xml @@ -26,9 +25,8 @@ the URI scheme via the ``_scheme`` requirement: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeDemoBundle:Main:secure - https @@ -40,9 +38,7 @@ the URI scheme via the ``_scheme`` requirement: $collection = new RouteCollection(); $collection->add('secure', new Route('/secure', array( '_controller' => 'AcmeDemoBundle:Main:secure', - ), array( - '_scheme' => 'https', - ))); + ), array(), array(), '', array('https'))); return $collection; @@ -65,8 +61,8 @@ The requirement is also enforced for incoming requests. If you try to access the ``/secure`` path with HTTP, you will automatically be redirected to the same URL, but with the HTTPS scheme. -The above example uses ``https`` for the ``_scheme``, but you can also force a -URL to always use ``http``. +The above example uses ``https`` for the scheme, but you can also force a URL +to always use ``http``. .. note:: diff --git a/cookbook/routing/service_container_parameters.rst b/cookbook/routing/service_container_parameters.rst index 37c855c588d..8b6d100e264 100644 --- a/cookbook/routing/service_container_parameters.rst +++ b/cookbook/routing/service_container_parameters.rst @@ -22,7 +22,7 @@ inside your routing configuration: .. code-block:: yaml contact: - pattern: /{_locale}/contact + path: /{_locale}/contact defaults: { _controller: AcmeDemoBundle:Main:contact } requirements: _locale: %acme_demo.locales% @@ -35,7 +35,7 @@ inside your routing configuration: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeDemoBundle:Main:contact %acme_demo.locales% @@ -78,15 +78,15 @@ in your container: # app/config/config.php $container->setParameter('acme_demo.locales', 'en|es'); -You can also use a parameter to define your route pattern (or part of your -pattern): +You can also use a parameter to define your route path (or part of your +path): .. configuration-block:: .. code-block:: yaml some_route: - pattern: /%acme_demo.route_prefix%/contact + path: /%acme_demo.route_prefix%/contact defaults: { _controller: AcmeDemoBundle:Main:contact } .. code-block:: xml @@ -97,7 +97,7 @@ pattern): xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeDemoBundle:Main:contact @@ -118,4 +118,4 @@ pattern): Just like in normal service container configuration files, if you actually need a ``%`` in your route, you can escape the percent sign by doubling - it, e.g. ``/score-50%%``, which would resolve to ``/score-50%``. \ No newline at end of file + it, e.g. ``/score-50%%``, which would resolve to ``/score-50%``. diff --git a/cookbook/routing/slash_in_parameter.rst b/cookbook/routing/slash_in_parameter.rst index 0c371f5e7ff..cc1532c16ee 100644 --- a/cookbook/routing/slash_in_parameter.rst +++ b/cookbook/routing/slash_in_parameter.rst @@ -16,18 +16,18 @@ Configure the Route ------------------- By default, the Symfony routing components requires that the parameters -match the following regex pattern: ``[^/]+``. This means that all characters +match the following regex path: ``[^/]+``. This means that all characters are allowed except ``/``. You must explicitly allow ``/`` to be part of your parameter by specifying -a more permissive regex pattern. +a more permissive regex path. .. configuration-block:: .. code-block:: yaml _hello: - pattern: /hello/{name} + path: /hello/{name} defaults: { _controller: AcmeDemoBundle:Demo:hello } requirements: name: ".+" @@ -40,7 +40,7 @@ a more permissive regex pattern. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeDemoBundle:Demo:hello .+ @@ -75,4 +75,4 @@ a more permissive regex pattern. } } -That's it! Now, the ``{name}`` parameter can contain the ``/`` character. \ No newline at end of file +That's it! Now, the ``{name}`` parameter can contain the ``/`` character. From 38e8dad6bcc86a5f6bb88dac7d6cc9ea0d7d9461 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Mon, 21 Jan 2013 14:19:05 +0100 Subject: [PATCH 0085/2078] Added use of addPrefix to define prefixes --- components/routing/introduction.rst | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/components/routing/introduction.rst b/components/routing/introduction.rst index 39cdad0d975..49e9b56b244 100644 --- a/components/routing/introduction.rst +++ b/components/routing/introduction.rst @@ -142,16 +142,16 @@ Using Prefixes You can add routes or other instances of :class:`Symfony\\Component\\Routing\\RouteCollection` to *another* collection. This way you can build a tree of routes. Additionally you can define a prefix, -default requirements, default options and hostname to all routes of a subtree:: +default requirements, default options and hostname to all routes of a subtree +with the :method:`Symfony\\Component\\Routing\\RouteCollection::addPrefix` +method:: $rootCollection = new RouteCollection(); $subCollection = new RouteCollection(); $subCollection->add(...); $subCollection->add(...); - - $rootCollection->addCollection( - $subCollection, + $subCollection->addPrefix( '/prefix', // prefix array(), // requirements array(), // options @@ -159,6 +159,12 @@ default requirements, default options and hostname to all routes of a subtree:: array('https') // schemes ); + $rootCollection->addCollection($subCollection); + +.. versionadded:: 2.2 + The ``addPrefixs`` method is added in Symfony2.2. This was part of the + ``addCollection`` method in older versions. + Set the Request Parameters ~~~~~~~~~~~~~~~~~~~~~~~~~~ From 75d6b4dd062e3790b980f3beb25d05637b9a264d Mon Sep 17 00:00:00 2001 From: WouterJ Date: Mon, 21 Jan 2013 14:22:33 +0100 Subject: [PATCH 0086/2078] Addes some versionadded blocks --- book/routing.rst | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/book/routing.rst b/book/routing.rst index d13d6118756..f0b5e77bc39 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -67,6 +67,10 @@ The route is simple: return $collection; +.. versionadded:: 2.2 + The ``path`` option is new in Symfony2.2, ``pattern`` is used in older + versions. + The path defined by the ``blog_show`` route acts like ``/blog/*`` where the wildcard is given the name ``slug``. For the URL ``/blog/my-blog-post``, the ``slug`` variable gets a value of ``my-blog-post``, which is available @@ -677,6 +681,10 @@ be accomplished with the following route configuration: return $collection; +.. versionadded:: + The ``methods`` option is added in Symfony2.2. Use the ``_method`` + requirement in older versions. + Despite the fact that these two routes have identical paths (``/contact``), the first route will match only GET requests and the second route will match only POST requests. This means that you can display the form and submit the @@ -686,8 +694,8 @@ form via the same URL, while using distinct controllers for the two actions. If no ``methods`` are specified, the route will match on *all* methods. -Adding a Hostname Pattern -~~~~~~~~~~~~~~~~~~~~~~~~~ +Adding a Hostname +~~~~~~~~~~~~~~~~~ .. versionadded:: 2.2 Hostname matching support was added in Symfony 2.2 From 73d24f92acb4cee31c3ce530a9d10c1a1fcf92ac Mon Sep 17 00:00:00 2001 From: John Kary Date: Mon, 21 Jan 2013 12:23:19 -0600 Subject: [PATCH 0087/2078] Grammar and syntax cleanup --- components/stopwatch.rst | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/components/stopwatch.rst b/components/stopwatch.rst index 3ba153457e5..f5d276fa03a 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -35,19 +35,19 @@ microtime by yourself. Instead, use the simple // ... some code goes here $event = $stopwatch->stop('eventName'); -You also can provide a category name to an event:: +You can also provide a category name to an event:: $stopwatch->start('eventName', 'categoryName'); -You can consider categories as a way of tagging events. The Symfony Profiler -tool, for example, uses categories to nicely color-code different events. +You can consider categories as a way of tagging events. For example, the +Symfony Profiler tool uses categories to nicely color-code different events. Periods ------- -As you know from the real world, all stopwatches come with two buttons. -One for starting and stopping the stopwatch, another to measure the lap time. -This is exactly what the :method:`Symfony\\Component\\Stopwatch\\Stopwatch::lap`` +As you know from the real world, all stopwatches come with two buttons: +one to start and stop the stopwatch, and another to measure the lap time. +This is exactly what the :method:``Symfony\\Component\\Stopwatch\\Stopwatch::lap`` method does:: $stopwatch = new Stopwatch(); @@ -60,28 +60,28 @@ method does:: // ... some other code goes here $event = $stopwatch->stop('foo'); -Lap information is stored in periods within the event. To get lap information -(aka periods) call:: +Lap information is stored as "periods" within the event. To get lap information +call:: $event->getPeriods(); -Besides getting periods, you can get other useful information from the event object. +In addition to periods, you can get other useful information from the event object. For example:: - $event->getCategory(); // Returns the category the evenent was started in - $event->getOrigin(); // Returns the start time of the Event in milliseconds - $event->ensureStopped(); // Stops all not-already-stopped periods - $event->getStartTime(); // Returns the start of the very first period + $event->getCategory(); // Returns the category the event was started in + $event->getOrigin(); // Returns the event start time in milliseconds + $event->ensureStopped(); // Stops all periods not already stopped + $event->getStartTime(); // Returns the start time of the very first period $event->getEndTime(); // Returns the end time of the very last period - $event->getDuration(); // Gets the duration (including all periods) of the event - $event->getMemory(); // Gets the max memory usage of all periods + $event->getDuration(); // Returns the event duration, including all periods + $event->getMemory(); // Returns the max memory usage of all periods Sections -------- Sections are a way to logically split the timeline into groups. You can see -how Symfony uses sections to nicely visualize framework lifecycle in the -Symfony Profiler tool. Here is a basic usage of sections:: +how Symfony uses sections to nicely visualize the framework lifecycle in the +Symfony Profiler tool. Here is a basic usage example using sections:: $stopwatch = new Stopwatch(); @@ -91,8 +91,8 @@ Symfony Profiler tool. Here is a basic usage of sections:: $events = $stopwatch->getSectionEvents('routing'); -You can reopen a closed section by calling the openSection method and specifying -an id of the section to be reopened:: +You can reopen a closed section by calling the :method:``Symfony\\Component\\Stopwatch\\Stopwatch::openSection`` +method and specifying the id of the section to be reopened:: $stopwatch->openSection('routing'); $stopwatch->start('building_config_tree'); From 4c48a4287a440aa66f02945d2909431e99dd5012 Mon Sep 17 00:00:00 2001 From: Tarjei Huse Date: Mon, 21 Jan 2013 20:54:44 +0100 Subject: [PATCH 0088/2078] Add comment on http_digest auth. I just thought it would be usefull to see what keys are needed to get HTTP Digest Auth working. --- reference/configuration/security.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index b02485800fc..9a2989424e5 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -284,3 +284,20 @@ A good configuration lies around at least 1000 iterations and sha512 for the hash algorithm. .. _`PBKDF2`: http://en.wikipedia.org/wiki/PBKDF2 + +HTTP-Digest Authentication +-------------------------- + +To use HTTP-Digest authentication you need to provide a realm and a key: +.. configuration-block:: + + .. code-block:: yaml + + # app/config/security.yml + security: + firewalls: + somename: + http_digest: + key: "a_random_string" + realm: "secure-api" + From b784172c093ef05fdaa4b80d925a7ce97bc338ba Mon Sep 17 00:00:00 2001 From: Tarjei Huse Date: Mon, 21 Jan 2013 21:11:12 +0100 Subject: [PATCH 0089/2078] Update reference/configuration/security.rst add empty line --- reference/configuration/security.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index 9a2989424e5..5f68ece0122 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -289,6 +289,7 @@ HTTP-Digest Authentication -------------------------- To use HTTP-Digest authentication you need to provide a realm and a key: + .. configuration-block:: .. code-block:: yaml From 0de81943335e49df960e80acf8de595d012f6756 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Mon, 21 Jan 2013 22:22:51 +0100 Subject: [PATCH 0090/2078] Changed hostname to host --- book/routing.rst | 18 +++++++------- components/routing/hostname_pattern.rst | 32 ++++++++++++------------- components/routing/introduction.rst | 13 +++++----- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/book/routing.rst b/book/routing.rst index f0b5e77bc39..d7052b53a39 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -694,13 +694,13 @@ form via the same URL, while using distinct controllers for the two actions. If no ``methods`` are specified, the route will match on *all* methods. -Adding a Hostname -~~~~~~~~~~~~~~~~~ +Adding a Host +~~~~~~~~~~~~~ .. versionadded:: 2.2 - Hostname matching support was added in Symfony 2.2 + Host matching support was added in Symfony 2.2 -You can also match on the HTTP *hostname* of the incoming request. For more +You can also match on the HTTP *host* of the incoming request. For more information, see :doc:`/components/routing/hostname_pattern` in the Routing component documentation. @@ -1038,14 +1038,14 @@ from the new routing resource. :doc:`FrameworkExtraBundle documentation` to see how. -Adding a Hostname Pattern to Imported Routes -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Adding a Host regex to Imported Routes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 2.2 - Hostname matching support was added in Symfony 2.2 + Host matching support was added in Symfony 2.2 -You can set the hostname on imported routes. For more information, see -:ref:`component-routing-hostname-imported`. +You can set the host regex on imported routes. For more information, see +:ref:`component-routing-host-imported`. .. index:: single: Routing; Debugging diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst index 488b000373e..38bc0f143eb 100644 --- a/components/routing/hostname_pattern.rst +++ b/components/routing/hostname_pattern.rst @@ -1,13 +1,13 @@ .. index:: single: Routing; Matching on Hostname -How to match a route based on the Hostname -========================================== +How to match a route based on the Host +====================================== .. versionadded:: 2.2 - Hostname matching support was added in Symfony 2.2 + Host matching support was added in Symfony 2.2 -You can also match on the HTTP *hostname* of the incoming request. +You can also match on the HTTP *host* of the incoming request. .. configuration-block:: @@ -15,7 +15,7 @@ You can also match on the HTTP *hostname* of the incoming request. mobile_homepage: path: / - hostname: m.example.com + host: m.example.com defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } homepage: @@ -32,7 +32,7 @@ You can also match on the HTTP *hostname* of the incoming request. http://symfony.com/schema/routing/routing-1.0.xsd" > - + AcmeDemoBundle:Main:mobileHomepage @@ -58,7 +58,7 @@ You can also match on the HTTP *hostname* of the incoming request. return $collection; Both routes match the same path ``/``, however the first one will match -only if the hostname is ``m.example.com``. +only if the host is ``m.example.com``. Placeholders and Requirements in Hostname Patterns -------------------------------------------------- @@ -78,7 +78,7 @@ dependency injection container parameter. mobile_homepage: path: / - hostname: m.{domain} + host: m.{domain} defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } requirements: domain: %domain% @@ -95,7 +95,7 @@ dependency injection container parameter. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeDemoBundle:Main:mobileHomepage %domain% @@ -123,12 +123,12 @@ dependency injection container parameter. return $collection; -.. _component-routing-hostname-imported: +.. _component-routing-host-imported: -Adding a Hostname Pattern to Imported Routes +Adding a Host Regex to Imported Routes -------------------------------------------- -You can set a hostname on imported routes: +You can set a host regex on imported routes: .. configuration-block:: @@ -137,7 +137,7 @@ You can set a hostname on imported routes: # app/config/routing.yml acme_hello: resource: "@AcmeHelloBundle/Resources/config/routing.yml" - hostname: "hello.example.com" + host: "hello.example.com" .. code-block:: xml @@ -148,7 +148,7 @@ You can set a hostname on imported routes: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + .. code-block:: php @@ -161,5 +161,5 @@ You can set a hostname on imported routes: return $collection; -The hostname ``hello.example.com`` will be set on each route loaded from the -new routing resource. +The host ``hello.example.com`` will be set on each route loaded from the new +routing resource. diff --git a/components/routing/introduction.rst b/components/routing/introduction.rst index 49e9b56b244..19ad9f19536 100644 --- a/components/routing/introduction.rst +++ b/components/routing/introduction.rst @@ -85,7 +85,7 @@ placeholders as regular expressions. 4. An array of options. These contain internal settings for the route and are the least commonly needed. -5. A hostname. This is matched against the hostname of the request. See +5. A host. This is matched against the host of the request. See :doc:`/components/routing/hostname_pattern` for more details. 6. An array of schemes. These enforce a certain HTTP scheme (``http``, ``https``). @@ -94,7 +94,7 @@ are the least commonly needed. ``GET``, ``POST``, ...). .. versionadded:: 2.2 - The hostname was added in Symfony 2.2 + Host matching support was added in Symfony 2.2 Take the following route, which combines several of these ideas:: @@ -103,7 +103,7 @@ Take the following route, which combines several of these ideas:: array('controller' => 'showArchive'), // default values array('month' => '[0-9]{4}-[0-9]{2}', 'subdomain' => 'www|m'), // requirements array(), // options - '{subdomain}.example.com', // hostname + '{subdomain}.example.com', // host array(), // schemes array() // methods ); @@ -142,9 +142,8 @@ Using Prefixes You can add routes or other instances of :class:`Symfony\\Component\\Routing\\RouteCollection` to *another* collection. This way you can build a tree of routes. Additionally you can define a prefix, -default requirements, default options and hostname to all routes of a subtree -with the :method:`Symfony\\Component\\Routing\\RouteCollection::addPrefix` -method:: +default requirements, default options and host to all routes of a subtree with +the :method:`Symfony\\Component\\Routing\\RouteCollection::addPrefix` method:: $rootCollection = new RouteCollection(); @@ -155,7 +154,7 @@ method:: '/prefix', // prefix array(), // requirements array(), // options - 'admin.example.com', // hostname + 'admin.example.com', // host array('https') // schemes ); From 4e5cca24b3b35c74185e50baea76db6070d79a30 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Mon, 21 Jan 2013 22:27:11 +0100 Subject: [PATCH 0091/2078] Fixed typo, thanks to @stof --- components/routing/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/routing/introduction.rst b/components/routing/introduction.rst index 19ad9f19536..b48f0be9172 100644 --- a/components/routing/introduction.rst +++ b/components/routing/introduction.rst @@ -161,7 +161,7 @@ the :method:`Symfony\\Component\\Routing\\RouteCollection::addPrefix` method:: $rootCollection->addCollection($subCollection); .. versionadded:: 2.2 - The ``addPrefixs`` method is added in Symfony2.2. This was part of the + The ``addPrefix`` method is added in Symfony2.2. This was part of the ``addCollection`` method in older versions. Set the Request Parameters From 95bf4da09d753fc98c945643ef99d6d055c5b18b Mon Sep 17 00:00:00 2001 From: Tarjei Huse Date: Tue, 22 Jan 2013 13:01:36 +0100 Subject: [PATCH 0092/2078] Update reference/configuration/security.rst Added PHP and XML examples. --- reference/configuration/security.rst | 37 ++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index 5f68ece0122..93c5ac94144 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -292,13 +292,30 @@ To use HTTP-Digest authentication you need to provide a realm and a key: .. configuration-block:: - .. code-block:: yaml - - # app/config/security.yml - security: - firewalls: - somename: - http_digest: - key: "a_random_string" - realm: "secure-api" - + .. code-block:: yaml + # app/config/security.yml + security: + firewalls: + somename: + http_digest: + key: "a_random_string" + realm: "secure-api" + + .. code-block:: xml + + + + + + + .. code-block:: php + $container->loadFromExtension('security', array( + 'firewalls' => array( + 'somename' => array( + 'http_digest' => array( + 'key' => 'a_random_string', + 'realm' => 'secure-api', + ), + ), + ), + )); From 96466b94cce3bede3b1274a403ee55d6132c55c3 Mon Sep 17 00:00:00 2001 From: Tarjei Huse Date: Tue, 22 Jan 2013 13:32:19 +0100 Subject: [PATCH 0093/2078] Update reference/configuration/security.rst Formatting fixes, added file comments. --- reference/configuration/security.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index 93c5ac94144..e55d2a676c6 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -293,6 +293,7 @@ To use HTTP-Digest authentication you need to provide a realm and a key: .. configuration-block:: .. code-block:: yaml + # app/config/security.yml security: firewalls: @@ -302,6 +303,7 @@ To use HTTP-Digest authentication you need to provide a realm and a key: realm: "secure-api" .. code-block:: xml + @@ -309,6 +311,8 @@ To use HTTP-Digest authentication you need to provide a realm and a key: .. code-block:: php + + // app/config/security.php $container->loadFromExtension('security', array( 'firewalls' => array( 'somename' => array( From 75a4f6185f4530dc635197d576f5682932dce02a Mon Sep 17 00:00:00 2001 From: Tarjei Huse Date: Tue, 22 Jan 2013 13:55:42 +0100 Subject: [PATCH 0094/2078] Update reference/configuration/security.rst fix newline --- reference/configuration/security.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index e55d2a676c6..f28e0ebe3e6 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -303,6 +303,7 @@ To use HTTP-Digest authentication you need to provide a realm and a key: realm: "secure-api" .. code-block:: xml + From 6dbbb3c5eca0b529ebae579825c880fc32effd01 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 22 Jan 2013 07:01:04 -0800 Subject: [PATCH 0095/2078] [#2165] Filling in a few more changes of pattern -> path --- book/security.rst | 4 ++-- cookbook/configuration/apache_router.rst | 2 +- cookbook/controller/service.rst | 2 +- cookbook/templating/PHP.rst | 2 +- cookbook/templating/render_without_controller.rst | 8 ++++---- quick_tour/the_big_picture.rst | 6 +++--- quick_tour/the_controller.rst | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/book/security.rst b/book/security.rst index cc9fcf59b31..e006f063631 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1709,7 +1709,7 @@ a route so that you can use it to generate the URL: # app/config/routing.yml logout: - pattern: /logout + path: /logout .. code-block:: xml @@ -1720,7 +1720,7 @@ a route so that you can use it to generate the URL: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + diff --git a/cookbook/configuration/apache_router.rst b/cookbook/configuration/apache_router.rst index c2e5d79a4c9..dcfcb77439f 100644 --- a/cookbook/configuration/apache_router.rst +++ b/cookbook/configuration/apache_router.rst @@ -37,7 +37,7 @@ To test that it's working, let's create a very basic route for demo bundle: # app/config/routing.yml hello: - pattern: /hello/{name} + path: /hello/{name} defaults: { _controller: AcmeDemoBundle:Demo:hello } diff --git a/cookbook/controller/service.rst b/cookbook/controller/service.rst index 3291ce3a1a2..8466bc802ab 100644 --- a/cookbook/controller/service.rst +++ b/cookbook/controller/service.rst @@ -22,7 +22,7 @@ value: .. code-block:: yaml my_controller: - pattern: / + path: / defaults: { _controller: my_controller:indexAction } To use a controller in this way, it must be defined in the service container diff --git a/cookbook/templating/PHP.rst b/cookbook/templating/PHP.rst index 635e08926b9..5765d3303b7 100644 --- a/cookbook/templating/PHP.rst +++ b/cookbook/templating/PHP.rst @@ -282,7 +282,7 @@ pattern: # src/Acme/HelloBundle/Resources/config/routing.yml hello: # The route name - pattern: /hello/{name} + path: /hello/{name} defaults: { _controller: AcmeHelloBundle:Hello:index } Using Assets: images, JavaScripts, and stylesheets diff --git a/cookbook/templating/render_without_controller.rst b/cookbook/templating/render_without_controller.rst index 2f2b63e6d52..f2a44f7e4e1 100644 --- a/cookbook/templating/render_without_controller.rst +++ b/cookbook/templating/render_without_controller.rst @@ -19,7 +19,7 @@ can do this without creating a controller: .. code-block:: yaml acme_privacy: - pattern: /privacy + path: /privacy defaults: _controller: FrameworkBundle:Template:template template: 'AcmeBundle:Static:privacy.html.twig' @@ -32,7 +32,7 @@ can do this without creating a controller: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + FrameworkBundle:Template:template AcmeBundle:Static:privacy.html.twig @@ -90,7 +90,7 @@ other variables in your route, you can control exactly how your page is cached: .. code-block:: yaml acme_privacy: - pattern: /privacy + path: /privacy defaults: _controller: FrameworkBundle:Template:template template: 'AcmeBundle:Static:privacy.html.twig' @@ -105,7 +105,7 @@ other variables in your route, you can control exactly how your page is cached: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + FrameworkBundle:Template:template AcmeBundle:Static:privacy.html.twig 86400 diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index 23c29f11239..b468167ef6b 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -179,7 +179,7 @@ Routing ~~~~~~~ Symfony2 routes the request to the code that handles it by trying to match the -requested URL against some configured patterns. By default, these patterns +requested URL against some configured paths. By default, these paths (called routes) are defined in the ``app/config/routing.yml`` configuration file. When you're in the ``dev`` :ref:`environment` - indicated by the app_**dev**.php front controller - the ``app/config/routing_dev.yml`` @@ -190,7 +190,7 @@ these "demo" pages are placed in that file: # app/config/routing_dev.yml _welcome: - pattern: / + path: / defaults: { _controller: AcmeDemoBundle:Welcome:index } _demo: @@ -331,7 +331,7 @@ file, routes are defined as annotations on action methods:: // ... } -The ``@Route()`` annotation defines a new route with a pattern of +The ``@Route()`` annotation defines a new route with a path of ``/hello/{name}`` that executes the ``helloAction`` method when matched. A string enclosed in curly brackets like ``{name}`` is called a placeholder. As you can see, its value can be retrieved through the ``$name`` method argument. diff --git a/quick_tour/the_controller.rst b/quick_tour/the_controller.rst index 7eb4c61b33b..51a160204be 100755 --- a/quick_tour/the_controller.rst +++ b/quick_tour/the_controller.rst @@ -41,7 +41,7 @@ automatically selects the right template, here ``hello.xml.twig``: That's all there is to it. For standard formats, Symfony2 will also automatically choose the best ``Content-Type`` header for the response. If you want to support different formats for a single action, use the ``{_format}`` -placeholder in the route pattern instead:: +placeholder in the route path instead:: // src/Acme/DemoBundle/Controller/DemoController.php use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; From 7ab8be5a9c8e9f36eedf0b3dd3b815f23b159c1f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 23 Jan 2013 13:55:07 +0100 Subject: [PATCH 0096/2078] replaced the proxy route with a listener --- book/http_cache.rst | 40 ++++++++++++++++------------------------ book/templating.rst | 37 +++++++++++++++---------------------- 2 files changed, 31 insertions(+), 46 deletions(-) diff --git a/book/http_cache.rst b/book/http_cache.rst index db6afebf919..fffc893a7e2 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -937,41 +937,33 @@ component cache will only last for 60 seconds. When using a controller reference, the ESI tag should reference the embedded action as an accessible URL so the gateway cache can fetch it independently of -the rest of the page. Of course, an action can't be accessed via a URL unless -it has a route that points to it. Symfony2 takes care of this via a generic -route. For the ESI include tag to work properly, you must define the ``_proxy`` -route: +the rest of the page. Symfony2 takes care of generating a unique URL for any +controller reference and it is able to route them properly thanks to a +listener that must be enabled in your configuration: .. configuration-block:: .. code-block:: yaml - # app/config/routing.yml - _proxy: - resource: "@FrameworkBundle/Resources/config/routing/proxy.xml" - prefix: /proxy + # app/config/config.yml + framework: + # ... + router_proxy: { path: /_proxy } .. code-block:: xml - - - - - - - + + + + .. code-block:: php - // app/config/routing.php - use Symfony\Component\Routing\RouteCollection; - use Symfony\Component\Routing\Route; - - $collection->addCollection($loader->import('@FrameworkBundle/Resources/config/routing/proxy.xml', '/proxy')); - - return $collection; + // app/config/config.php + $container->loadFromExtension('framework', array( + // ... + 'router_proxy' => array('path' => '/_proxy'), + )); One great advantage of this caching strategy is that you can make your application as dynamic as needed and at the same time, hit the application as diff --git a/book/templating.rst b/book/templating.rst index 9c64ed4b1d8..f7f9c6b30b6 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -690,39 +690,32 @@ Symfony2 uses the standard ``render`` helper to configure ``hinclude`` tags: .. note:: - When using a controller instead of an URL, you must enable the Symfony - ``proxy`` routing configuration: + When using a controller instead of a URL, you must enable the Symfony + ``router_proxy`` configuration: .. configuration-block:: .. code-block:: yaml - # app/config/routing.yml - _proxy: - resource: "@FrameworkBundle/Resources/config/routing/proxy.xml" - prefix: /proxy + # app/config/config.yml + framework: + # ... + router_proxy: { path: /_proxy } .. code-block:: xml - - - - - - - + + + + .. code-block:: php - // app/config/routing.php - use Symfony\Component\Routing\RouteCollection; - use Symfony\Component\Routing\Route; - - $collection->addCollection($loader->import('@FrameworkBundle/Resources/config/routing/proxy.xml', '/proxy')); - - return $collection; + // app/config/config.php + $container->loadFromExtension('framework', array( + // ... + 'router_proxy' => array('path' => '/_proxy'), + )); Default content (while loading or if javascript is disabled) can be set globally in your application configuration: From bbddf529f513e2e1d02bed659c03e65b5eb4076f Mon Sep 17 00:00:00 2001 From: Victor Date: Thu, 24 Jan 2013 09:05:57 +0100 Subject: [PATCH 0097/2078] [DI] PrependExtensionInterface sync doc with latest Sf2 changes --- components/dependency_injection/compilation.rst | 4 ++-- cookbook/bundles/prepend_extension.rst | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index 71ea7d90fbd..663692fbf7c 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -255,9 +255,9 @@ Prepending Configuration passed to the Extension The ability to prepend the configuration of a bundle is new in Symfony 2.2. An Extension can prepend the configuration of any Bundle before the ``load()`` -method is called by implementing :class:`Symfony\\Component\\DependencyInjection\\Compiler\\PrependExtensionInterface`:: +method is called by implementing :class:`Symfony\\Component\\DependencyInjection\\Extension\\PrependExtensionInterface`:: - use Symfony\Component\DependencyInjection\Compiler\PrependExtensionInterface; + use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; // ... class AcmeDemoExtension implements ExtensionInterface, PrependExtensionInterface diff --git a/cookbook/bundles/prepend_extension.rst b/cookbook/bundles/prepend_extension.rst index 27725542c2b..74f1500c8f4 100644 --- a/cookbook/bundles/prepend_extension.rst +++ b/cookbook/bundles/prepend_extension.rst @@ -23,13 +23,13 @@ multiple Bundles. Or it can be used to enable an optional feature that depends on another Bundle being loaded as well. To give an Extension the power to do this, it needs to implement -:class:`Symfony\\Component\\DependencyInjection\\Compiler\\PrependExtensionInterface`:: +:class:`Symfony\\Component\\DependencyInjection\\Extension\\PrependExtensionInterface`:: // src/Acme/HelloBundle/DependencyInjection/AcmeHelloExtension.php namespace Acme\HelloBundle\DependencyInjection; use Symfony\Component\HttpKernel\DependencyInjection\Extension; - use Symfony\Component\DependencyInjection\PrependExtensionInterface; + use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; class AcmeHelloExtension extends Extension implements PrependExtensionInterface @@ -42,7 +42,7 @@ To give an Extension the power to do this, it needs to implement } } -Inside the :method:`Symfony\\Component\\DependencyInjection\\Compiler\\PrependExtensionInterface::prepend` +Inside the :method:`Symfony\\Component\\DependencyInjection\\Extension\\PrependExtensionInterface::prepend` method, developers have full access to the :class:`Symfony\\Component\\DependencyInjection\\ContainerBuilder` instance just before the :method:`Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface::load` method is called on each of the registered Bundle Extensions. In order to From d318602609f6fb1aae62795ab8bff8e077b07f55 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 27 Jan 2013 10:25:09 -0800 Subject: [PATCH 0098/2078] [#2074] Minor tweaks for DialogHelper::select method --- components/console/helpers/dialoghelper.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index c82f957411f..90550bf6913 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -150,11 +150,12 @@ You can also ask and validate a hidden response:: If you want to allow the response to be visible if it cannot be hidden for some reason, pass true as the fifth argument. -Let the user choose from a list of answers +Let the user choose from a list of Answers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 2.2 - The ``select`` method was added in Symfony 2.2. + The :method:`Symfony\\Component\\Console\\Helper\\DialogHelper::select` method + was added in Symfony 2.2. If you have a predefined set of answers the user can choose from, you could use the ``ask`` method described above or, to make sure the user @@ -183,7 +184,7 @@ The option which should be selected by default is provided with the fourth parameter. The default is ``null``, which means that no option is the default one. If the user enters an invalid string, an error message is shown and the user -is asked to provide the answer another time, till he enters a valid string +is asked to provide the answer another time, until she enters a valid string or the maximum attempts is reached (which you can define in the fifth parameter). The default value for the attempts is ``false``, which means infinite attempts. You can define your own error message in the sixth parameter. From 9d3a9a23f58fd99fa77cebd15c7e09a74e6a2ed3 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Mon, 28 Jan 2013 15:30:21 +0000 Subject: [PATCH 0099/2078] sf2.2 note: _method override disabled by default --- cookbook/routing/method_parameters.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cookbook/routing/method_parameters.rst b/cookbook/routing/method_parameters.rst index 6499c7e79ff..1f95048f4e2 100644 --- a/cookbook/routing/method_parameters.rst +++ b/cookbook/routing/method_parameters.rst @@ -4,6 +4,11 @@ How to use HTTP Methods beyond GET and POST in Routes ===================================================== +.. versionadded:: 2.2 + This functionality is disabled by default in Symfony 2.2. To enable it, + you must call ``Request::enableHttpMethodParameterOverride()`` before you + handle the request. + The HTTP method of a request is one of the requirements that can be checked when seeing if it matches a route. This is introduced in the routing chapter of the book ":doc:`/book/routing`" with examples using GET and POST. You can From 61ac029f4d6455fd456f1533cfd1cd52a2ea324f Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Mon, 28 Jan 2013 15:56:34 +0000 Subject: [PATCH 0100/2078] Link method to docs as per @WouterJ suggestion --- cookbook/routing/method_parameters.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/routing/method_parameters.rst b/cookbook/routing/method_parameters.rst index 1f95048f4e2..e2c261cb0f5 100644 --- a/cookbook/routing/method_parameters.rst +++ b/cookbook/routing/method_parameters.rst @@ -6,8 +6,8 @@ How to use HTTP Methods beyond GET and POST in Routes .. versionadded:: 2.2 This functionality is disabled by default in Symfony 2.2. To enable it, - you must call ``Request::enableHttpMethodParameterOverride()`` before you - handle the request. + you must call :method:`Request::enableHttpMethodParameterOverride ` + before you handle the request. The HTTP method of a request is one of the requirements that can be checked when seeing if it matches a route. This is introduced in the routing chapter From 1b4086b07bd00fa0cb82cdc6222bf3563947ea9b Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 30 Jan 2013 17:52:13 -0600 Subject: [PATCH 0101/2078] [#2164] Removing one more reference to deprecated addViolationAtSubPath --- cookbook/validation/custom_constraint.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/validation/custom_constraint.rst b/cookbook/validation/custom_constraint.rst index 9ebab7a1669..f74063d7c2d 100644 --- a/cookbook/validation/custom_constraint.rst +++ b/cookbook/validation/custom_constraint.rst @@ -221,7 +221,7 @@ With this, the validator ``validate()`` method gets an object as its first argum public function validate($protocol, Constraint $constraint) { if ($protocol->getFoo() != $protocol->getBar()) { - $this->context->addViolationAtSubPath('foo', $constraint->message, array(), null); + $this->context->addViolationAt('foo', $constraint->message, array(), null); } } } From ac74a8e788d40f122f133ad3d9b42b00a4f24d29 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 1 Feb 2013 09:42:28 +0100 Subject: [PATCH 0102/2078] updated render usage --- book/http_cache.rst | 49 ++++++++++++++++++------------------ book/templating.rst | 16 ++++++------ reference/twig_reference.rst | 6 ++--- 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/book/http_cache.rst b/book/http_cache.rst index b52e94200fe..bb867029750 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -895,28 +895,28 @@ matter), Symfony2 uses the standard ``render`` helper to configure ESI tags: render( new ControllerReference('...:news', array('max' => 5)), - array('strategy' => 'esi')) + array('renderer' => 'esi')) ?> render( $view['router']->generate('latest_news', array('max' => 5), true), - array('strategy' => 'esi') + array('renderer' => 'esi') ) ?> -By using the ``esi`` rendering strategy (via the ``render_esi`` Twig -function), you tell Symfony2 that the action should be rendered as an ESI tag. -You might be wondering why you would want to use a helper instead of just -writing the ESI tag yourself. That's because using a helper makes your -application work even if there is no gateway cache installed. - -When using the default ``render`` function (or setting the strategy to -``default``), Symfony2 merges the included page content into the main one -before sending the response to the client. But if you use the ``esi`` strategy -(i.e. call ``render_esi``), *and* if Symfony2 detects that it's talking to -a gateway cache that supports ESI, it generates an ESI include tag. But if -there is no gateway cache or if it does not support ESI, Symfony2 will just -merge the included page content within the main one as it would have done -if you had used ``render``. +By using the ``esi`` renderer (via the ``render_esi`` Twig function), you +tell Symfony2 that the action should be rendered as an ESI tag. You might be +wondering why you would want to use a helper instead of just writing the ESI +tag yourself. That's because using a helper makes your application work even +if there is no gateway cache installed. + +When using the default ``render`` function (or setting the renderer to +``inline``), Symfony2 merges the included page content into the main one +before sending the response to the client. But if you use the ``esi`` renderer +(i.e. call ``render_esi``), *and* if Symfony2 detects that it's talking to a +gateway cache that supports ESI, it generates an ESI include tag. But if there +is no gateway cache or if it does not support ESI, Symfony2 will just merge +the included page content within the main one as it would have done if you had +used ``render``. .. note:: @@ -952,13 +952,13 @@ listener that must be enabled in your configuration: # app/config/config.yml framework: # ... - router_proxy: { path: /_proxy } + fragments: { path: /_fragment } .. code-block:: xml - + .. code-block:: php @@ -966,18 +966,17 @@ listener that must be enabled in your configuration: // app/config/config.php $container->loadFromExtension('framework', array( // ... - 'router_proxy' => array('path' => '/_proxy'), + 'fragments' => array('path' => '/_fragment'), )); -One great advantage of this caching strategy is that you can make your -application as dynamic as needed and at the same time, hit the application as -little as possible. +One great advantage of the ESI renderer is that you can make your application +as dynamic as needed and at the same time, hit the application as little as +possible. .. tip:: - The proxy route doesn't point to a real controller. Instead, it's handled - by an internal :class:`Symfony\\Component\\HttpKernel\\EventListener\\RouterProxyListener` - class. This listener only responds to local IP addresses or trusted proxies. + The listener listener only responds to local IP addresses or trusted + proxies. .. note:: diff --git a/book/templating.rst b/book/templating.rst index 839866ea203..1213a82b072 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -676,12 +676,12 @@ Symfony2 uses the standard ``render`` helper to configure ``hinclude`` tags: render( new ControllerReference('...'), - array('strategy' => 'hinclude') + array('renderer' => 'hinclude') ) ?> render( $view['router']->generate('...'), - array('strategy' => 'hinclude') + array('renderer' => 'hinclude') ) ?> .. note:: @@ -691,7 +691,7 @@ Symfony2 uses the standard ``render`` helper to configure ``hinclude`` tags: .. note:: When using a controller instead of a URL, you must enable the Symfony - ``router_proxy`` configuration: + ``fragments`` configuration: .. configuration-block:: @@ -700,13 +700,13 @@ Symfony2 uses the standard ``render`` helper to configure ``hinclude`` tags: # app/config/config.yml framework: # ... - router_proxy: { path: /_proxy } + fragments: { path: /_fragment } .. code-block:: xml - + .. code-block:: php @@ -714,7 +714,7 @@ Symfony2 uses the standard ``render`` helper to configure ``hinclude`` tags: // app/config/config.php $container->loadFromExtension('framework', array( // ... - 'router_proxy' => array('path' => '/_proxy'), + 'fragments' => array('path' => '/_fragment'), )); Default content (while loading or if javascript is disabled) can be set globally @@ -764,7 +764,7 @@ any global default template that is defined): render( new ControllerReference('...'), array( - 'strategy' => 'hinclude', + 'renderer' => 'hinclude', 'default' => 'AcmeDemoBundle:Default:content.html.twig', ) ) ?> @@ -782,7 +782,7 @@ Or you can also specify a string to display as the default content: render( new ControllerReference('...'), array( - 'strategy' => 'hinclude', + 'renderer' => 'hinclude', 'default' => 'Loading...', ) ) ?> diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 90076fcca20..37fa8aadc93 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -27,8 +27,8 @@ Functions +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | Function Syntax | Usage | +====================================================+============================================================================================+ -| ``render(uri, options = {})`` | This will render the Response Content for the given controller or | -| ``render(controller('B:C:a', {params}))`` | URL. For more information, see :ref:`templating-embedding-controller`. | +| ``render(uri, options = {})`` | This will render the fragment for the given controller or URL | +| ``render(controller('B:C:a', {params}))`` | For more information, see :ref:`templating-embedding-controller`. | | ``render(path('route', {params}))`` | | | ``render(url('route', {params}))`` | | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ @@ -40,7 +40,7 @@ Functions | ``render_hinclude(url('route', {params}))`` | For more information, see :ref:`templating-embedding-controller`. | | ``render_hinclude(path('route', {params}))`` | | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ -| ``controller(attributes = {}, query = {})`` | Used along with the ``render`` tag to refer to the controller that you want to render | +| ``controller(attributes = {}, query = {})`` | Used along with the ``render`` tag to refer to the controller that you want to render. | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``asset(path, packageName = null)`` | Get the public path of the asset, more information in | | | ":ref:`book-templating-assets`". | From eedcf385cf49f6ad786e331c6b75a97d078102c0 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 3 Feb 2013 07:21:34 -0600 Subject: [PATCH 0103/2078] Fixing syntax error --- reference/constraints/UniqueEntity.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index c2d1735839c..07b9fddb87e 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -11,7 +11,7 @@ using an email address that already exists in the system. | Options | - `fields`_ | | | - `message`_ | | | - `em`_ | -| | - `repositoryMethod`_ | +| | - `repositoryMethod`_ | +----------------+-------------------------------------------------------------------------------------+ | Class | :class:`Symfony\\Bridge\\Doctrine\\Validator\\Constraints\\UniqueEntity` | +----------------+-------------------------------------------------------------------------------------+ From 0eda298627f2fa1c1668522adb51bbe31356fa7b Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 3 Feb 2013 07:24:02 -0600 Subject: [PATCH 0104/2078] [#1786] Adding documentation for Twig namespaced paths support --- book/templating.rst | 5 ++ cookbook/map.rst.inc | 1 + cookbook/templating/index.rst | 1 + cookbook/templating/namespaced_paths.rst | 86 ++++++++++++++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 cookbook/templating/namespaced_paths.rst diff --git a/book/templating.rst b/book/templating.rst index 1213a82b072..5edf94b592a 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -376,6 +376,11 @@ When working with template inheritance, here are some tips to keep in mind: Template Naming and Locations ----------------------------- +.. versionadded:: 2.2 + Namespaced path support was added in 2.2, allowing for template names + like ``@AcmeDemoBundle/layout.html.twig``. See :doc:`/cookbook/templating/namespaced_paths` + for more details. + By default, templates can live in two different locations: * ``app/Resources/views/``: The applications ``views`` directory can contain diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index b6013df58be..9b0d8fd0779 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -134,6 +134,7 @@ * :doc:`/cookbook/templating/index` * :doc:`/cookbook/templating/global_variables` + * :doc:`/cookbook/templating/namespaced_paths` * :doc:`/cookbook/templating/PHP` * :doc:`/cookbook/templating/twig_extension` * :doc:`/cookbook/templating/render_without_controller` diff --git a/cookbook/templating/index.rst b/cookbook/templating/index.rst index 21ae6cda73c..46d6fe37012 100644 --- a/cookbook/templating/index.rst +++ b/cookbook/templating/index.rst @@ -5,6 +5,7 @@ Templating :maxdepth: 2 global_variables + namespaced_paths PHP twig_extension render_without_controller diff --git a/cookbook/templating/namespaced_paths.rst b/cookbook/templating/namespaced_paths.rst new file mode 100644 index 00000000000..bced0629f94 --- /dev/null +++ b/cookbook/templating/namespaced_paths.rst @@ -0,0 +1,86 @@ +.. index:: + single: Templating; Namespaced Twig Paths + +How to use and Register namespaced Twig Paths +============================================= + +.. versionadded:: 2.2 + Namespaced path support was added in 2.2. + +Usually, when you refer to a template, you'll use the ``MyBundle:Subdir:filename.html.twig`` +format (see :ref:`template-naming-locations`). + +Twig also natively offers a feature called "namespaced paths", and support +is built-in automatically for all of your bundles. + + +Take the following paths as an example: + +.. code-block:: jinja + + {% extends "AcmeDemoBundle::layout.html.twig" %} + {% include "AcmeDemoBundle:Foo:bar.html.twig" %} + +With namespaced paths, the following works as well: + +.. code-block:: jinja + + {% extends "@AcmeDemo/layout.html.twig" %} + {% include "@AcmeDemo/Foo/bar.html.twig" %} + +Both paths are valid and functional by default in Symfony2. + +.. tip:: + + As an added bonus, the namespaced syntax is faster. + +Registering your own namespaces +------------------------------- + +You can also register your own custom namespaces. Suppose that you're using +some third-party library that includes Twig templates that live in +``vendor/acme/foo-project/templates``. First, register a namespace for this +directory: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + twig: + # ... + paths: + "%kernel.root_dir%/../vendor/acme/foo-bar/templates": foo_bar + + .. code-block:: xml + + + + + + + + %kernel.root_dir%/../vendor/acme/foo-bar/templates + + + + + .. code-block:: php + + // app/config/config.php + $container->loadFromExtension('twig', array( + 'paths' => array( + '%kernel.root_dir%/../vendor/acme/foo-bar/templates' => 'foo_bar' + ); + )); + +The registered namespace is called ``foo_bar``, which refers to the +``vendor/acme/foo-project/templates`` directory. Assuming there's a file +called ``sidebar.twig`` in that directory, you can use it easily: + +.. code-block:: jinja + + {% include '@foo_bar/side.bar.twig` %} \ No newline at end of file From a7ce478ea3b1aacb047f04885e0f3f6fff421d06 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 8 Feb 2013 08:30:05 -1000 Subject: [PATCH 0105/2078] [#1786] Tweaks per @WouterJ on #2211 --- cookbook/templating/namespaced_paths.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cookbook/templating/namespaced_paths.rst b/cookbook/templating/namespaced_paths.rst index bced0629f94..8e33b38ef66 100644 --- a/cookbook/templating/namespaced_paths.rst +++ b/cookbook/templating/namespaced_paths.rst @@ -13,7 +13,6 @@ format (see :ref:`template-naming-locations`). Twig also natively offers a feature called "namespaced paths", and support is built-in automatically for all of your bundles. - Take the following paths as an example: .. code-block:: jinja @@ -55,25 +54,23 @@ directory: .. code-block:: xml - + > %kernel.root_dir%/../vendor/acme/foo-bar/templates - .. code-block:: php // app/config/config.php $container->loadFromExtension('twig', array( 'paths' => array( - '%kernel.root_dir%/../vendor/acme/foo-bar/templates' => 'foo_bar' + '%kernel.root_dir%/../vendor/acme/foo-bar/templates' => 'foo_bar', ); )); From ea17640a5036f0b733c174ddd007e4f2ef856754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A1bor=20Egyed?= Date: Sat, 16 Feb 2013 23:56:22 +0100 Subject: [PATCH 0106/2078] [Reference] updated framework config reference --- reference/configuration/framework.rst | 42 ++++++++++++++++++--------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index de8912b30be..17cb03be0d3 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -377,27 +377,33 @@ Full Default Configuration .. code-block:: yaml framework: - - # general configuration + charset: ~ + secret: ~ trust_proxy_headers: false - secret: ~ # Required + trusted_proxies: [] ide: ~ test: ~ default_locale: en # form configuration form: - enabled: true + enabled: false csrf_protection: - enabled: true + enabled: false field_name: _token # esi configuration esi: - enabled: true + enabled: false + + # fragments configuration + fragments: + enabled: false + path: /_fragment # profiler configuration profiler: + enabled: false only_exceptions: false only_master_requests: false dsn: file:%kernel.cache_dir%/profiler @@ -417,11 +423,17 @@ Full Default Configuration type: ~ http_port: 80 https_port: 443 - # if false, an empty URL will be generated if a route is missing required parameters - strict_requirements: %kernel.debug% + + # set to true to throw an exception when a parameter does not match the requirements + # set to false to disable exceptions when a parameter does not match the requirements (and return null instead) + # set to null to disable parameter checks against requirements + # 'true' is the preferred configuration in development mode, while 'false' or 'null' might be preferred in production + strict_requirements: true # session configuration session: + + # DEPRECATED! Session starts on demand auto_start: false storage_id: session.storage.native handler_id: session.handler.native_file @@ -472,8 +484,8 @@ Full Default Configuration loaders: [] packages: - # A collection of named packages - some_package_name: + # Prototype + name: version: ~ version_format: %%s?%%s base_urls: @@ -482,20 +494,22 @@ Full Default Configuration # translator configuration translator: - enabled: true + enabled: false fallback: en # validation configuration validation: - enabled: true + enabled: false cache: ~ enable_annotations: false + translation_domain: validators # annotation configuration annotations: cache: file - file_cache_dir: "%kernel.cache_dir%/annotations" - debug: true + file_cache_dir: %kernel.cache_dir%/annotations + debug: %kernel.debug% + .. _`protocol-relative`: http://tools.ietf.org/html/rfc3986#section-4.2 .. _`sprintf()`: http://php.net/manual/en/function.sprintf.php From f239002bcdb9a457e20910c48c1b31664367d40a Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 18 Feb 2013 19:30:34 -0600 Subject: [PATCH 0107/2078] [#2211] Fix thanks to @stof! --- book/templating.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/templating.rst b/book/templating.rst index 5edf94b592a..a62a716441d 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -378,7 +378,7 @@ Template Naming and Locations .. versionadded:: 2.2 Namespaced path support was added in 2.2, allowing for template names - like ``@AcmeDemoBundle/layout.html.twig``. See :doc:`/cookbook/templating/namespaced_paths` + like ``@AcmeDemo/layout.html.twig``. See :doc:`/cookbook/templating/namespaced_paths` for more details. By default, templates can live in two different locations: From 782c649f7bbb27e19a1281a84f422ec9b84ef616 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 18 Feb 2013 20:02:45 -0600 Subject: [PATCH 0108/2078] [#1936] Moving new BCrypt details into the reference section and touching up a few things --- book/security.rst | 68 +------------------------ reference/configuration/security.rst | 75 +++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 67 deletions(-) diff --git a/book/security.rst b/book/security.rst index e18a201ba32..6fee326ae88 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1336,72 +1336,8 @@ that the hashed password can't be decoded (i.e. you can't determine the password from the hashed password). .. versionadded:: 2.2 - As of Symfony 2.2 you can also use the PBKDF2 password encoder. - -Using the BCrypt Password Encoder -................................. - -.. versionadded:: 2.2 - The BCrypt password encoder was added in Symfony 2.2. - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/security.yml - security: - # ... - encoders: - Symfony\Component\Security\Core\User\User: - algorithm: bcrypt - cost: 15 - - .. code-block:: xml - - - - - - - - .. code-block:: php - - // app/config/security.php - $container->loadFromExtension('security', array( - // ... - 'encoders' => array( - 'Symfony\Component\Security\Core\User\User' => array( - 'algorithm' => 'bcrypt', - 'cost' => 15, - ), - ), - )); - -``cost`` can be in the range of ``4-31`` and determines how long a password -will be encoded. Each increment of ``cost`` *doubles* the time it takes to -encode a password. - -If you don't provide the ``cost`` option, the default cost of ``13`` is used. - -.. note:: - - You can change the cost at any time — even if you already have some - passwords encoded using a different cost. New passwords will be encoded - using the new cost, while the already encoded ones will be validated - using a cost that was used back when they were encoded. - -A salt for each new password is generated automatically and need not be -persisted. Since an encoded password contains the salt used to encode it, -persisting the encoded password alone is enough. - -.. note:: - - All the encoded passwords are ``60`` characters long, so make sure to - allocate enough space for them to be persisted. + As of Symfony 2.2 you can also use the :ref:`PBKDF2` + and :ref:`BCrypt` password encoders. Determining the Hashed Password ............................... diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index 1a017f6ff1d..318c7aeaa79 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -270,12 +270,19 @@ Redirecting after Login * ``target_path_parameter`` (type: ``string``, default: ``_target_path``) * ``use_referer`` (type: ``Boolean``, default: ``false``) +.. _reference-security-pbkdf2: + Using the PBKDF2 encoder: security and speed -------------------------------------------- +.. versionadded:: 2.2 + The PBKDF2 password encoder was added in Symfony 2.2. + The `PBKDF2`_ encoder provides a high level of Cryptographic security, as recommended by the National Institute of Standards and Technology (NIST). +You can see an example of the ``pbkdf2`` encoder in the YAML block on this page. + But using PBKDF2 also warrants a warning: using it (with a high number of iterations) slows down the process. Thus, PBKDF2 should be used with caution and care. @@ -283,7 +290,72 @@ caution and care. A good configuration lies around at least 1000 iterations and sha512 for the hash algorithm. -.. _`PBKDF2`: http://en.wikipedia.org/wiki/PBKDF2 +.. _reference-security-bcrypt: + +Using the BCrypt Password Encoder +--------------------------------- + +.. versionadded:: 2.2 + The BCrypt password encoder was added in Symfony 2.2. + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/security.yml + security: + # ... + encoders: + Symfony\Component\Security\Core\User\User: + algorithm: bcrypt + cost: 15 + + .. code-block:: xml + + + + + + + + .. code-block:: php + + // app/config/security.php + $container->loadFromExtension('security', array( + // ... + 'encoders' => array( + 'Symfony\Component\Security\Core\User\User' => array( + 'algorithm' => 'bcrypt', + 'cost' => 15, + ), + ), + )); + +The ``cost`` can be in the range of ``4-31`` and determines how long a password +will be encoded. Each increment of ``cost`` *doubles* the time it takes to +encode a password. + +If you don't provide the ``cost`` option, the default cost of ``13`` is used. + +.. note:: + + You can change the cost at any time — even if you already have some + passwords encoded using a different cost. New passwords will be encoded + using the new cost, while the already encoded ones will be validated + using a cost that was used back when they were encoded. + +A salt for each new password is generated automatically and need not be +persisted. Since an encoded password contains the salt used to encode it, +persisting the encoded password alone is enough. + +.. note:: + + All the encoded passwords are ``60`` characters long, so make sure to + allocate enough space for them to be persisted. HTTP-Digest Authentication -------------------------- @@ -325,3 +397,4 @@ To use HTTP-Digest authentication you need to provide a realm and a key: ), )); +.. _`PBKDF2`: http://en.wikipedia.org/wiki/PBKDF2 \ No newline at end of file From 5e5c93d6932f48239ea05ec9c9e6c0181e654e5e Mon Sep 17 00:00:00 2001 From: WouterJ Date: Mon, 14 Jan 2013 20:11:31 +0100 Subject: [PATCH 0109/2078] Created PropertyAccess component docs --- components/map.rst.inc | 4 + components/property_access/index.rst | 7 + components/property_access/introduction.rst | 264 ++++++++++++++++++++ 3 files changed, 275 insertions(+) create mode 100644 components/property_access/index.rst create mode 100644 components/property_access/introduction.rst diff --git a/components/map.rst.inc b/components/map.rst.inc index 930f87ee83f..61f858fd3a5 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -71,6 +71,10 @@ * :doc:`/components/process` +* :doc:`/components/property_access/index + + * :doc:`/components/property_access/introduction` + * :doc:`/components/routing/index` * :doc:`/components/routing/introduction` diff --git a/components/property_access/index.rst b/components/property_access/index.rst new file mode 100644 index 00000000000..c40373aaac1 --- /dev/null +++ b/components/property_access/index.rst @@ -0,0 +1,7 @@ +Property Access +=============== + +.. toctree:: + :maxdepth: 2 + + introduction diff --git a/components/property_access/introduction.rst b/components/property_access/introduction.rst new file mode 100644 index 00000000000..0b24c3401e3 --- /dev/null +++ b/components/property_access/introduction.rst @@ -0,0 +1,264 @@ +.. index:: + single: PropertyAccess + single: Components; PropertyAccess + +The PropertyAccess Component +============================ + + PropertyAccess component provides function to read and write from/to an + object or array using a simple string notation. + +.. versionadded:: 2.2 + The PropertyAccess Component is new to Symfony 2.2. Previously, the + ``PropertyPath`` class was located in the ``Form`` component. + +Installation +------------ + +You can install the component in two different ways: + +* Use the official Git repository (https://github.com/symfony/PropertyAccess); +* :doc:`Install it via Composer` * (``symfony/property-access`` on `Packagist`_). + +Usage +----- + +The entry point of this component is the +:method:`Symfony\\Component\\PropertyAccess\\PropertyAccess::getPropertyAccessor` +factory. This factory will create a new instance of the +:class:`Symfony\\Component\\PropertyAccess\PropertyAccessor` class with the +default configuration:: + + use Symfony\Component\PropertyAccess\PropertyAccess; + + $accessor = PropertyAccess:getPropertyAccessor(); + +Reading from arrays +------------------- + +You can read an array with the +:method:`Symfony\\Component\\PropertyAccess\PropertyAccessor::getValue` +method. This is done using the index notation that is used in PHP:: + + // ... + $person = array( + 'first_name' => 'Wouter', + ); + + echo $accessor->getValue($persons, '[first_name]'); // 'Wouter' + echo $accessor->getValue($person, '[age]'); // null + +As you can see, the method will return ``null`` if the index does not exists. + +You can also use multi dimensional arrays:: + + // ... + $persons = array( + array( + 'first_name' => 'Wouter', + ), + array( + 'first_name' => 'Ryan', + ) + ); + + echo $accessor->getValue($persons, '[0][first_name]'); // 'Wouter' + echo $accessor->getValue($persons, '[1][first_name]'); // 'Ryan' + +Reading from objects +-------------------- + +The ``getValue`` method is a very robust method. You can see all features if +you are working with objects. + +Using properties +~~~~~~~~~~~~~~~~ + +We can read properties without the index notation, instead we use the dot +notation:: + + // ... + $person = new Person(); + $person->firstName = 'Wouter'; + + echo $accessor->getValue($person, 'first_name'); // 'Wouter' + + $child = new Person(); + $child->firstName = 'Bar'; + $person->children = array($child); + + echo $accessor->getValue($person, 'children[0].first_name'); // 'Bar' + +.. caution:: + + This option is the last option used by the ``PropertyAccessor``. It tries + to find the other options before using the property. If you have a public + property that have a getter to, it will use the getter. + +Using getters +~~~~~~~~~~~~~ + +The ``getValue`` method also supports reading using getters. The method will +be created using common naming conventions for getters. It camelizes the +property name (``first_name`` becomes ``FirstName``) and prefixes it with +``get``. So the actual method becomes ``getFirstName``:: + + // ... + class Person + { + private $firstName = 'Wouter'; + + public function getFirstName() + { + return $this->firstName; + } + } + + $person = new Person(); + + echo $accessor->getValue($person, 'first_name'); // 'Wouter' + +Using hassers/issers +~~~~~~~~~~~~~~~~~~~~ + +And it doesn't even stop there. If there is no getter found, the accessor will +look for a isser or hasser. This method is created using the same way as +getters, this means that you can do something like this:: + + // ... + class Person + { + private $author = true; + private $children = array(); + + public function isAuthor() + { + return $this->author; + } + + public function hasChildren() + { + return 0 !== count($this->children); + } + } + + $person = new Person(); + + if ($accessor->getValue($person, 'author')) { + echo 'He is an author'; + } + if ($accessor->getValue($person, 'children')) { + echo 'He has children'; + } + +This will produce: ``He is an author`` + +Magic Methods +~~~~~~~~~~~~~ + +At last, the ``getValue`` can use the magic ``__get`` too:: + + // ... + class Person + { + private $children = array( + 'wouter' => array(...), + ); + + public function __get($id) + { + return $this->children[$id]; + } + } + + $person = new Person(); + + echo $accessor->getValue($person, 'Wouter'); // array(...) + +Writing to arrays +----------------- + +The ``PropertyAccessor`` class can do more than just reading an array, it can +also write to an array. This can be achieved using the +:method:`Symfony\\Component\\PropertyAccess\\PropertyAccessor::setValue` +method:: + + // ... + $person = array(); + + $accessor->setValue($person, '[first_name]', 'Wouter'); + + echo $accessor->getValue($person, '[first_name]'); // 'Wouter' + // or + // echo $person['first_name']; // 'Wouter' + +Writing to objects +------------------ + +The ``setValue`` method has the same features as the ``getValue`` method. You +can use setters, the magic ``__set`` or properties to set values:: + + // ... + class Person + { + public $firstName; + private $lastName; + private $children = array(); + + public function setLastName($name) + { + $this->lastName = $name; + } + + public function __set($property, $value) + { + $this->$property = $value; + } + + // ... + } + + $person = new Person(); + + $accessor->setValue($person, 'firstName', 'Wouter'); + $accessor->setValue($person, 'lastName', 'de Jong'); + $accessor->setValue($person, 'children', array(new Person())); + + echo $person->firstName; // 'Wouter' + echo $person->getLastName(); // 'de Jong' + echo $person->children; // array(Person()); + +Mixing objects and arrays +------------------------- + +You can also mix objects and arrays:: + + // ... + class Person + { + public $firstName; + private $children = array(); + + public function setChildren($children) + { + return $this->children; + } + + public function getChildren() + { + return $this->children; + } + } + + $person = new Person(); + + $accessor->setValue($person, 'children[0]', new Person); + // equal to $person->getChildren()[0] = new Person() + + $accessor->setValue($person, 'children[0].firstName', 'Wouter'); + // equal to $person->getChildren()[0]->firstName = 'Wouter' + + echo 'Hello '.$accessor->getValue($person, 'children[0].firstName'); // 'Wouter' + // equal to $person->getChildren()[0]->firstName + +.. _Packagist: https://packagist.org/packages/symfony/property-access From 24274f0bc94560616de65466ee3d85448a15b04d Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 24 Feb 2013 16:34:20 -0800 Subject: [PATCH 0110/2078] [#2130][2136] Proofreading the excellent new PropertyAccess component doc by @WouterJ --- components/index.rst | 1 + components/map.rst.inc | 2 +- components/property_access/introduction.rst | 56 ++++++++++----------- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/components/index.rst b/components/index.rst index 5f90831b927..8b4abe24f8d 100644 --- a/components/index.rst +++ b/components/index.rst @@ -18,6 +18,7 @@ The Components http_kernel/index locale process + property_access/index routing/index security/index serializer diff --git a/components/map.rst.inc b/components/map.rst.inc index f8b85bb89c0..776d72e3eb2 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -73,7 +73,7 @@ * :doc:`/components/process` -* :doc:`/components/property_access/index +* :doc:`/components/property_access/index` * :doc:`/components/property_access/introduction` diff --git a/components/property_access/introduction.rst b/components/property_access/introduction.rst index 0b24c3401e3..2079e5d4b89 100644 --- a/components/property_access/introduction.rst +++ b/components/property_access/introduction.rst @@ -5,7 +5,7 @@ The PropertyAccess Component ============================ - PropertyAccess component provides function to read and write from/to an + The PropertyAccess component provides function to read and write from/to an object or array using a simple string notation. .. versionadded:: 2.2 @@ -18,26 +18,26 @@ Installation You can install the component in two different ways: * Use the official Git repository (https://github.com/symfony/PropertyAccess); -* :doc:`Install it via Composer` * (``symfony/property-access`` on `Packagist`_). +* :doc:`Install it via Composer` (``symfony/property-access`` on `Packagist`_). Usage ----- The entry point of this component is the -:method:`Symfony\\Component\\PropertyAccess\\PropertyAccess::getPropertyAccessor` +:method:`PropertyAccess::getPropertyAccessor` factory. This factory will create a new instance of the -:class:`Symfony\\Component\\PropertyAccess\PropertyAccessor` class with the +:class:`Symfony\\Component\\PropertyAccess\\PropertyAccessor` class with the default configuration:: use Symfony\Component\PropertyAccess\PropertyAccess; - $accessor = PropertyAccess:getPropertyAccessor(); + $accessor = PropertyAccess::getPropertyAccessor(); -Reading from arrays +Reading from Arrays ------------------- You can read an array with the -:method:`Symfony\\Component\\PropertyAccess\PropertyAccessor::getValue` +:method:`PropertyAccessor::getValue` method. This is done using the index notation that is used in PHP:: // ... @@ -65,37 +65,37 @@ You can also use multi dimensional arrays:: echo $accessor->getValue($persons, '[0][first_name]'); // 'Wouter' echo $accessor->getValue($persons, '[1][first_name]'); // 'Ryan' -Reading from objects +Reading from Objects -------------------- -The ``getValue`` method is a very robust method. You can see all features if -you are working with objects. +The ``getValue`` method is a very robust method, and you can see all of its +features when working with objects. -Using properties -~~~~~~~~~~~~~~~~ +Accessing public Properties +~~~~~~~~~~~~~~~~~~~~~~~~~~~ -We can read properties without the index notation, instead we use the dot -notation:: +To read from properties, use the "dot" notation:: // ... $person = new Person(); $person->firstName = 'Wouter'; - echo $accessor->getValue($person, 'first_name'); // 'Wouter' + echo $accessor->getValue($person, 'firstName'); // 'Wouter' $child = new Person(); $child->firstName = 'Bar'; $person->children = array($child); - echo $accessor->getValue($person, 'children[0].first_name'); // 'Bar' + echo $accessor->getValue($person, 'children[0].firstName'); // 'Bar' .. caution:: - This option is the last option used by the ``PropertyAccessor``. It tries - to find the other options before using the property. If you have a public - property that have a getter to, it will use the getter. + Accessing public properties is the last option used by ``PropertyAccessor``. + It tries to access the value using the below methods first before using + the property directly. For example, if you have a public property that + has a getter method, it will use the getter. -Using getters +Using Getters ~~~~~~~~~~~~~ The ``getValue`` method also supports reading using getters. The method will @@ -118,11 +118,11 @@ property name (``first_name`` becomes ``FirstName``) and prefixes it with echo $accessor->getValue($person, 'first_name'); // 'Wouter' -Using hassers/issers +Using Hassers/Issers ~~~~~~~~~~~~~~~~~~~~ And it doesn't even stop there. If there is no getter found, the accessor will -look for a isser or hasser. This method is created using the same way as +look for an isser or hasser. This method is created using the same way as getters, this means that you can do something like this:: // ... @@ -156,7 +156,7 @@ This will produce: ``He is an author`` Magic Methods ~~~~~~~~~~~~~ -At last, the ``getValue`` can use the magic ``__get`` too:: +At last, ``getValue`` can use the magic ``__get`` method too:: // ... class Person @@ -175,12 +175,12 @@ At last, the ``getValue`` can use the magic ``__get`` too:: echo $accessor->getValue($person, 'Wouter'); // array(...) -Writing to arrays +Writing to Arrays ----------------- -The ``PropertyAccessor`` class can do more than just reading an array, it can +The ``PropertyAccessor`` class can do more than just read an array, it can also write to an array. This can be achieved using the -:method:`Symfony\\Component\\PropertyAccess\\PropertyAccessor::setValue` +:method:`PropertyAccessor::setValue` method:: // ... @@ -192,7 +192,7 @@ method:: // or // echo $person['first_name']; // 'Wouter' -Writing to objects +Writing to Objects ------------------ The ``setValue`` method has the same features as the ``getValue`` method. You @@ -228,7 +228,7 @@ can use setters, the magic ``__set`` or properties to set values:: echo $person->getLastName(); // 'de Jong' echo $person->children; // array(Person()); -Mixing objects and arrays +Mixing Objects and Arrays ------------------------- You can also mix objects and arrays:: From 5dc2b8b748e9f4f77f4415d79dfcfd0dd17a341e Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 7 Mar 2013 20:59:44 -0600 Subject: [PATCH 0111/2078] [2.2] Updating some URLs from 2.1/master to 2.2 --- book/forms.rst | 6 +++--- book/from_flat_php_to_symfony2.rst | 2 +- book/installation.rst | 10 +++++----- components/using_components.rst | 10 +++++----- cookbook/form/form_customization.rst | 2 +- quick_tour/the_big_picture.rst | 4 ++-- reference/dic_tags.rst | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/book/forms.rst b/book/forms.rst index 9f8f8a1b7ac..272eae5e86e 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -1603,7 +1603,7 @@ Learn more from the Cookbook .. _`Symfony2 Form Component`: https://github.com/symfony/Form .. _`DateTime`: http://php.net/manual/en/class.datetime.php -.. _`Twig Bridge`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bridge/Twig -.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/2.1/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +.. _`Twig Bridge`: https://github.com/symfony/symfony/tree/2.2/src/Symfony/Bridge/Twig +.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/2.2/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig .. _`Cross-site request forgery`: http://en.wikipedia.org/wiki/Cross-site_request_forgery -.. _`view on GitHub`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form +.. _`view on GitHub`: https://github.com/symfony/symfony/tree/2.2/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form diff --git a/book/from_flat_php_to_symfony2.rst b/book/from_flat_php_to_symfony2.rst index c7d32e273c7..ff684736571 100644 --- a/book/from_flat_php_to_symfony2.rst +++ b/book/from_flat_php_to_symfony2.rst @@ -433,7 +433,7 @@ content: { "require": { - "symfony/symfony": "2.1.*" + "symfony/symfony": "2.2.*" }, "autoload": { "files": ["model.php","controllers.php"] diff --git a/book/installation.rst b/book/installation.rst index 136af2c2526..b4505ce06a1 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -57,12 +57,12 @@ Distribution: .. code-block:: bash - php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony dev-master + php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.2.0 .. tip:: - For an exact version, replace `dev-master` with the latest Symfony version - (e.g. 2.1.1). For details, see the `Symfony Installation Page`_ + For an exact version, replace `2.2.0` with the latest Symfony version + (e.g. 2.2.1). For details, see the `Symfony Installation Page`_ .. tip:: @@ -110,10 +110,10 @@ one of the following commands (replacing ``###`` with your actual filename): .. code-block:: bash # for .tgz file - $ tar zxvf Symfony_Standard_Vendors_2.1.###.tgz + $ tar zxvf Symfony_Standard_Vendors_2.2.###.tgz # for a .zip file - $ unzip Symfony_Standard_Vendors_2.1.###.zip + $ unzip Symfony_Standard_Vendors_2.2.###.zip If you've downloaded "without vendors", you'll definitely need to read the next section. diff --git a/components/using_components.rst b/components/using_components.rst index c7f2f46ebe1..174b041facc 100644 --- a/components/using_components.rst +++ b/components/using_components.rst @@ -24,7 +24,7 @@ Using the Finder Component { "require": { - "symfony/finder": "2.1.*" + "symfony/finder": "2.2.*" } } @@ -69,9 +69,9 @@ immediately:: { "require": { - "symfony/finder": "2.1.*", - "symfony/dom-crawler": "2.1.*", - "symfony/css-selector": "2.1.*" + "symfony/finder": "2.2.*", + "symfony/dom-crawler": "2.2.*", + "symfony/css-selector": "2.2.*" } } @@ -81,7 +81,7 @@ immediately:: { "require": { - "symfony/symfony": "2.1.*" + "symfony/symfony": "2.2.*" } } diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index 3f752cfc5e4..a7589600275 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -965,4 +965,4 @@ customizations directly. Look at the following example: The array passed as the second argument contains form "variables". For more details about this concept in Twig, see :ref:`twig-reference-form-variables`. -.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/2.1/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/2.2/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index 23ab1b307ea..7a13463e430 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -76,12 +76,12 @@ have a ``Symfony/`` directory that looks like this: .. code-block:: bash - $ composer.phar create-project symfony/framework-standard-edition path/to/install dev-master + $ composer.phar create-project symfony/framework-standard-edition path/to/install 2.2.0 # remove the Git history $ rm -rf .git - For an exact version, replace `dev-master` with the latest Symfony version + For an exact version, replace `2.2.0` with the latest Symfony version (e.g. 2.1.1). For details, see the `Symfony Installation Page`_ .. tip:: diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index bddde097b48..910e229a870 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -808,6 +808,6 @@ For an example, see the ``EntityInitializer`` class inside the Doctrine Bridge. .. _`Twig's documentation`: http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension .. _`Twig official extension repository`: https://github.com/fabpot/Twig-extensions -.. _`KernelEvents`: https://github.com/symfony/symfony/blob/2.1/src/Symfony/Component/HttpKernel/KernelEvents.php +.. _`KernelEvents`: https://github.com/symfony/symfony/blob/2.2/src/Symfony/Component/HttpKernel/KernelEvents.php .. _`SwiftMailer's Plugin Documentation`: http://swiftmailer.org/docs/plugins.html .. _`Twig Loader`: http://twig.sensiolabs.org/doc/api.html#loaders From b38edbc71316a53993945de142ac73f33279680b Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 7 Mar 2013 21:29:58 -0600 Subject: [PATCH 0112/2078] [#2248] Changing pattern -> path after a merge per @WouterJ --- cookbook/configuration/apache_router.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/configuration/apache_router.rst b/cookbook/configuration/apache_router.rst index 6c33bc52185..beac6121416 100644 --- a/cookbook/configuration/apache_router.rst +++ b/cookbook/configuration/apache_router.rst @@ -60,13 +60,13 @@ To test that it's working, let's create a very basic route for demo bundle: # app/config/routing.yml hello: - pattern: /hello/{name} + path: /hello/{name} defaults: { _controller: AcmeDemoBundle:Demo:hello } .. code-block:: xml - + AcmeDemoBundle:Demo:hello From e478e243d8273fc24821765dbb0ee7df5dc73c3d Mon Sep 17 00:00:00 2001 From: Ricard Clau Date: Fri, 8 Mar 2013 10:48:49 +0100 Subject: [PATCH 0113/2078] add explicit profiler enabling, necessary on 2.2 --- cookbook/email/testing.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cookbook/email/testing.rst b/cookbook/email/testing.rst index 9b18d6c6a1e..7386618303d 100644 --- a/cookbook/email/testing.rst +++ b/cookbook/email/testing.rst @@ -41,6 +41,10 @@ to get information about the messages send on the previous request:: public function testMailIsSentAndContentIsOk() { $client = static::createClient(); + + // Enable the profiler for the next request (it does nothing if the profiler is not available) + $client->enableProfiler(); + $crawler = $client->request('POST', '/path/to/above/action'); $mailCollector = $client->getProfile()->getCollector('swiftmailer'); From 929bd1c26164a39af4e84e5a5847c17de3d48527 Mon Sep 17 00:00:00 2001 From: janschoenherr Date: Sun, 10 Mar 2013 22:35:07 +0100 Subject: [PATCH 0114/2078] Update introduction.rst --- components/property_access/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/property_access/introduction.rst b/components/property_access/introduction.rst index 2079e5d4b89..f4d4de5cb23 100644 --- a/components/property_access/introduction.rst +++ b/components/property_access/introduction.rst @@ -45,7 +45,7 @@ method. This is done using the index notation that is used in PHP:: 'first_name' => 'Wouter', ); - echo $accessor->getValue($persons, '[first_name]'); // 'Wouter' + echo $accessor->getValue($person, '[first_name]'); // 'Wouter' echo $accessor->getValue($person, '[age]'); // null As you can see, the method will return ``null`` if the index does not exists. From e6332ab6b0d6b1d4bc30ffa91c75935e8aa6c4be Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Mon, 11 Mar 2013 12:18:13 +0100 Subject: [PATCH 0115/2078] [Reference] Updated Callback to use interfaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use ExecutionContextInterface instead of ExecutionContext --- reference/constraints/Callback.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/reference/constraints/Callback.rst b/reference/constraints/Callback.rst index 5c35002b58b..93539cb7eb2 100644 --- a/reference/constraints/Callback.rst +++ b/reference/constraints/Callback.rst @@ -86,19 +86,19 @@ Setup The Callback Method ------------------- -The callback method is passed a special ``ExecutionContext`` object. You +The callback method is passed a special ``ExecutionContextInterface`` object. You can set "violations" directly on this object and determine to which field those errors should be attributed:: // ... - use Symfony\Component\Validator\ExecutionContext; + use Symfony\Component\Validator\ExecutionContextInterface; class Author { // ... private $firstName; - public function isAuthorValid(ExecutionContext $context) + public function isAuthorValid(ExecutionContextInterface $context) { // somehow you have an array of "fake names" $fakeNames = array(); @@ -125,7 +125,7 @@ process. Each method can be one of the following formats: If the name of a method is a simple string (e.g. ``isAuthorValid``), that method will be called on the same object that's being validated and the - ``ExecutionContext`` will be the only argument (see the above example). + ``ExecutionContextInterface`` will be the only argument (see the above example). 2) **Static array callback** @@ -189,16 +189,16 @@ process. Each method can be one of the following formats: In this case, the static method ``isAuthorValid`` will be called on the ``Acme\BlogBundle\MyStaticValidatorClass`` class. It's passed both the original - object being validated (e.g. ``Author``) as well as the ``ExecutionContext``:: + object being validated (e.g. ``Author``) as well as the ``ExecutionContextInterface``:: namespace Acme\BlogBundle; - use Symfony\Component\Validator\ExecutionContext; + use Symfony\Component\Validator\ExecutionContextInterface; use Acme\BlogBundle\Entity\Author; class MyStaticValidatorClass { - public static function isAuthorValid(Author $author, ExecutionContext $context) + public static function isAuthorValid(Author $author, ExecutionContextInterface $context) { // ... } From 405b15f5d33a16140092a8fe7f4ad03620291e8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Perrin?= Date: Mon, 11 Mar 2013 16:41:55 +0100 Subject: [PATCH 0116/2078] [Reference] [UserPassword] Use the non-deprecated class for Symfony 2.2 --- reference/constraints/UserPassword.rst | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/reference/constraints/UserPassword.rst b/reference/constraints/UserPassword.rst index af71b816e6d..3a34c4f6ebb 100644 --- a/reference/constraints/UserPassword.rst +++ b/reference/constraints/UserPassword.rst @@ -13,15 +13,15 @@ but needs to enter his old password for security. This should **not** be used to validate a login form, since this is done automatically by the security system. -+----------------+-------------------------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | -+----------------+-------------------------------------------------------------------------------------------+ -| Options | - `message`_ | -+----------------+-------------------------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraint\\UserPassword` | -+----------------+-------------------------------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraint\\UserPasswordValidator` | -+----------------+-------------------------------------------------------------------------------------------+ ++----------------+--------------------------------------------------------------------------------------------+ +| Applies to | :ref:`property or method` | ++----------------+--------------------------------------------------------------------------------------------+ +| Options | - `message`_ | ++----------------+--------------------------------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPassword` | ++----------------+--------------------------------------------------------------------------------------------+ +| Validator | :class:`Symfony\\Component\\Security\\Core\\Validator\\Constraints\\UserPasswordValidator` | ++----------------+--------------------------------------------------------------------------------------------+ Basic Usage ----------- @@ -39,16 +39,16 @@ password: Acme\UserBundle\Form\Model\ChangePassword: properties: oldPassword: - - Symfony\Component\Security\Core\Validator\Constraint\UserPassword: + - Symfony\Component\Security\Core\Validator\Constraints\UserPassword: message: "Wrong value for your current password" .. code-block:: php-annotations // src/Acme/UserBundle/Form/Model/ChangePassword.php namespace Acme\UserBundle\Form\Model; - - use Symfony\Component\Security\Core\Validator\Constraint as SecurityAssert; - + + use Symfony\Component\Security\Core\Validator\Constraints as SecurityAssert; + class ChangePassword { /** @@ -63,7 +63,7 @@ password: - + @@ -72,10 +72,10 @@ password: // src/Acme/UserBundle/Form/Model/ChangePassword.php namespace Acme\UserBundle\Form\Model; - + use Symfony\Component\Validator\Mapping\ClassMetadata; - use Symfony\Component\Security\Core\Validator\Constraint as SecurityAssert; - + use Symfony\Component\Security\Core\Validator\Constraints as SecurityAssert; + class ChangePassword { public static function loadValidatorData(ClassMetadata $metadata) From cb1315cf3b3177f9fc503a7f134a98532ed48885 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Perrin?= Date: Mon, 11 Mar 2013 17:19:44 +0100 Subject: [PATCH 0117/2078] [Reference] [UserPassword] Add a note concerning the namespace change --- reference/constraints/UserPassword.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/reference/constraints/UserPassword.rst b/reference/constraints/UserPassword.rst index 3a34c4f6ebb..7d013789f7c 100644 --- a/reference/constraints/UserPassword.rst +++ b/reference/constraints/UserPassword.rst @@ -4,6 +4,14 @@ UserPassword .. versionadded:: 2.1 This constraint is new in version 2.1. +.. note:: + + The `UserPassword` constraint class is defined in the + `Symfony\Component\Security\Core\Validator\Constraints` namespace since + Symfony 2.2. The `UserPassword` defined in the + `Symfony\Component\Security\Core\Validator\Constraint` namespace is + deprecated and will be removed in Symfony 2.3. + This validates that an input value is equal to the current authenticated user's password. This is useful in a form where a user can change his password, but needs to enter his old password for security. From 7fd28f2a0ba6fdd807542ac0f376162cece5aa35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Perrin?= Date: Mon, 11 Mar 2013 17:36:56 +0100 Subject: [PATCH 0118/2078] [Reference] [UserPassword] Updated deprecation note --- reference/constraints/UserPassword.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reference/constraints/UserPassword.rst b/reference/constraints/UserPassword.rst index 7d013789f7c..dc0dfcab277 100644 --- a/reference/constraints/UserPassword.rst +++ b/reference/constraints/UserPassword.rst @@ -6,11 +6,11 @@ UserPassword .. note:: - The `UserPassword` constraint class is defined in the - `Symfony\Component\Security\Core\Validator\Constraints` namespace since - Symfony 2.2. The `UserPassword` defined in the - `Symfony\Component\Security\Core\Validator\Constraint` namespace is - deprecated and will be removed in Symfony 2.3. + Since Symfony 2.2, the `UserPassword*` classes in the + `Symfony\Component\Security\Core\Validator\Constraint` namespace are + deprecated and will be removed in Symfony 2.3. Please use the + `UserPassword*` classes in the + `Symfony\Component\Security\Core\Validator\Constraints` namespace instead. This validates that an input value is equal to the current authenticated user's password. This is useful in a form where a user can change his password, From 8e3694944969891549760384095342795f82b230 Mon Sep 17 00:00:00 2001 From: Philipp Wahala Date: Thu, 14 Mar 2013 03:28:17 +0100 Subject: [PATCH 0119/2078] Update default exception_controller in TwigBundle Configuration Reference --- reference/configuration/twig.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst index 87515db26d2..5977ce092fb 100644 --- a/reference/configuration/twig.rst +++ b/reference/configuration/twig.rst @@ -9,7 +9,7 @@ TwigBundle Configuration Reference .. code-block:: yaml twig: - exception_controller: Symfony\Bundle\TwigBundle\Controller\ExceptionController::showAction + exception_controller: twig.controller.exception:showAction form: resources: @@ -86,7 +86,7 @@ Configuration exception_controller .................... -**type**: ``string`` **default**: ``Symfony\\Bundle\\TwigBundle\\Controller\\ExceptionController::showAction`` +**type**: ``string`` **default**: ``twig.controller.exception:showAction`` This is the controller that is activated after an exception is thrown anywhere in your application. The default controller From 678ab9356fafc80f740a268ed0c7c037a0d21aad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20L=C3=A9pine?= Date: Tue, 5 Mar 2013 17:05:06 +0100 Subject: [PATCH 0120/2078] Update twig_reference.rst | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | Fixes typo --- reference/twig_reference.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 2f3016b3a38..d2ff0dc9e31 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -20,7 +20,7 @@ Functions .. versionadded:: 2.1 The ``csrf_token``, ``logout_path`` and ``logout_url`` functions were added in Symfony2.1 -.. versionadded:: 2.3 +.. versionadded:: 2.2 The ``render`` and ``controller`` functions are new in Symfony 2.2. Prior, the ``{% render %}`` tag was used and had a different signature. From f3c431fc9dc6ab9a85846639c2cfa9d4ce3e6901 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 14 Mar 2013 21:00:00 -0500 Subject: [PATCH 0121/2078] [#2283] Updating URL from 2.1 to master on master branch --- reference/forms/twig_reference.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/forms/twig_reference.rst b/reference/forms/twig_reference.rst index d30c01015b7..845df8ee5be 100644 --- a/reference/forms/twig_reference.rst +++ b/reference/forms/twig_reference.rst @@ -277,4 +277,4 @@ object: | | (for example, a ``choice`` field, which is actually a group of checkboxes | +-----------------+-----------------------------------------------------------------------------------------+ -.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/2.1/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig From db4af6e52d65ba34cc65902ea954feb9beaf679b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Mon, 18 Feb 2013 21:14:40 +0100 Subject: [PATCH 0122/2078] Update components/config/definition.rst --- components/config/definition.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index 232f9b2fc34..e2548b7063c 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -270,7 +270,7 @@ has a certain value: Optional Sections ----------------- -.. versionadded:: 2.1 +.. versionadded:: 2.2 The ``canBeEnabled`` and ``canBeDisabled`` methods are new in Symfony 2.2 If you have entire sections which are optional and can be enabled/disabled, From d5000deffc1bd110efae32879e38474ba819922a Mon Sep 17 00:00:00 2001 From: Wouter J Date: Sun, 3 Mar 2013 17:19:28 +0100 Subject: [PATCH 0123/2078] Fixed minor format issue --- components/stopwatch.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/stopwatch.rst b/components/stopwatch.rst index f5d276fa03a..31ba53a3c54 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -47,7 +47,7 @@ Periods As you know from the real world, all stopwatches come with two buttons: one to start and stop the stopwatch, and another to measure the lap time. -This is exactly what the :method:``Symfony\\Component\\Stopwatch\\Stopwatch::lap`` +This is exactly what the :method:`Symfony\\Component\\Stopwatch\\Stopwatch::lap`` method does:: $stopwatch = new Stopwatch(); From 65399256d8d3befabee05b1b7f4bce25cfb5ac1b Mon Sep 17 00:00:00 2001 From: Wouter J Date: Sun, 3 Mar 2013 17:22:31 +0100 Subject: [PATCH 0124/2078] Another typo fix --- components/stopwatch.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/stopwatch.rst b/components/stopwatch.rst index 31ba53a3c54..af5f98e823b 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -91,7 +91,7 @@ Symfony Profiler tool. Here is a basic usage example using sections:: $events = $stopwatch->getSectionEvents('routing'); -You can reopen a closed section by calling the :method:``Symfony\\Component\\Stopwatch\\Stopwatch::openSection`` +You can reopen a closed section by calling the :method:`Symfony\\Component\\Stopwatch\\Stopwatch::openSection`` method and specifying the id of the section to be reopened:: $stopwatch->openSection('routing'); From eae1566ba5930179b2c69384c87cfac0560ad7c4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 23 Mar 2013 08:18:11 +0100 Subject: [PATCH 0125/2078] added a note about the new setCurrent method on the progress helper --- components/console/helpers/progresshelper.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/console/helpers/progresshelper.rst b/components/console/helpers/progresshelper.rst index 757091ba20d..f77c52490cf 100644 --- a/components/console/helpers/progresshelper.rst +++ b/components/console/helpers/progresshelper.rst @@ -7,6 +7,9 @@ Progress Helper .. versionadded:: 2.2 The ``progress`` helper was added in Symfony 2.2. +.. versionadded:: 2.3 + The ``setCurrent`` method was added in Symfony 2.3. + When executing longer-running commands, it may be helpful to show progress information, which updates as your command runs: @@ -28,6 +31,12 @@ pass it a total number of units, and advance the progress as your command execut $progress->finish(); +.. tip:: + + You can also set the current progress by calling the + :method:`Symfony\\Component\\Console\\Helper\\ProgressHelper::setCurrent` + method. + The appearance of the progress output can be customized as well, with a number of different levels of verbosity. Each of these displays different possible items - like percentage completion, a moving progress bar, or current/total @@ -70,4 +79,4 @@ To see other available options, check the API documentation for if ($i % 100 == 0) { $progress->advance(); } - } \ No newline at end of file + } From 441e766e4a1ff7392d23e187d4792237bbdf1909 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 23 Mar 2013 11:52:04 +0100 Subject: [PATCH 0126/2078] removed deprecated trust_proxy_headers docs --- reference/configuration/framework.rst | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index fe70e1f121c..4e2ac86965f 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -18,7 +18,7 @@ Configuration * `secret`_ * `ide`_ * `test`_ -* `trust_proxy_headers`_ +* `trusted_proxies`_ * `form`_ * enabled * `csrf_protection`_ @@ -117,23 +117,6 @@ see :doc:`/components/http_foundation/trusting_proxies`. 'trusted_proxies' => array('192.0.0.1'), )); -trust_proxy_headers -~~~~~~~~~~~~~~~~~~~ - -.. caution:: - - The ``trust_proxy_headers`` option is deprecated and will be removed in - Symfony 2.3. See `trusted_proxies`_ and :doc:`/components/http_foundation/trusting_proxies` - for details on how to properly trust proxy data. - -**type**: ``Boolean`` - -Configures if HTTP headers (like ``HTTP_X_FORWARDED_FOR``, ``X_FORWARDED_PROTO``, and -``X_FORWARDED_HOST``) are trusted as an indication for an SSL connection. By default, it is -set to ``false`` and only SSL_HTTPS connections are indicated as secure. - -You should enable this setting if your application is behind a reverse proxy. - .. _reference-framework-form: form @@ -379,7 +362,6 @@ Full Default Configuration framework: charset: ~ secret: ~ - trust_proxy_headers: false trusted_proxies: [] ide: ~ test: ~ From 74f9a1f338122505ce56618107fa8e21affb5eb4 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 23 Mar 2013 11:55:19 +0100 Subject: [PATCH 0127/2078] removed docs on PHP parsing in YAML files --- components/yaml/introduction.rst | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/components/yaml/introduction.rst b/components/yaml/introduction.rst index bd30aea820a..37bbf6eaeec 100644 --- a/components/yaml/introduction.rst +++ b/components/yaml/introduction.rst @@ -134,20 +134,6 @@ string or a file containing YAML. Internally, it calls the :method:`Symfony\\Component\\Yaml\\Parser::parse` method, but enhances the error if something goes wrong by adding the filename to the message. -Executing PHP Inside YAML Files -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 2.1 - The ``Yaml::enablePhpParsing()`` method is new to Symfony 2.1. Prior to 2.1, - PHP was *always* executed when calling the ``parse()`` function. - -By default, if you include PHP inside a YAML file, it will not be parsed. -If you do want PHP to be parsed, you must call ``Yaml::enablePhpParsing()`` -before parsing the file to activate this mode. If you only want to allow -PHP code for a single YAML file, be sure to disable PHP parsing after parsing -the single file by calling ``Yaml::$enablePhpParsing = false;`` (``$enablePhpParsing`` -is a public property). - Writing YAML Files ~~~~~~~~~~~~~~~~~~ From f886afcf668fd1a7ea30fdcd698922a1396aed3a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 23 Mar 2013 11:57:55 +0100 Subject: [PATCH 0128/2078] updated deprecated usage of flash bags --- book/controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/controller.rst b/book/controller.rst index 1f51d5ed4c5..eb028247aa9 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -686,7 +686,7 @@ the ``notice`` message: .. code-block:: php - getFlash('notice') as $message): ?> + getFlashBag()->get('notice') as $message): ?>
$message
" ?> From 6e7c0cdf51fa6a5a31d09d1fc8390f814790f70d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 23 Mar 2013 11:59:58 +0100 Subject: [PATCH 0129/2078] removed deprecated min/max/minlength/maxlength constraints --- reference/constraints.rst | 4 - reference/constraints/Max.rst | 111 --------------------------- reference/constraints/MaxLength.rst | 107 -------------------------- reference/constraints/Min.rst | 111 --------------------------- reference/constraints/MinLength.rst | 112 ---------------------------- reference/constraints/Valid.rst | 8 +- reference/constraints/map.rst.inc | 4 - 7 files changed, 6 insertions(+), 451 deletions(-) delete mode 100644 reference/constraints/Max.rst delete mode 100644 reference/constraints/MaxLength.rst delete mode 100644 reference/constraints/Min.rst delete mode 100644 reference/constraints/MinLength.rst diff --git a/reference/constraints.rst b/reference/constraints.rst index 1069b0ea3e0..1ed9b35649b 100644 --- a/reference/constraints.rst +++ b/reference/constraints.rst @@ -14,15 +14,11 @@ Validation Constraints Reference constraints/Type constraints/Email - constraints/MinLength - constraints/MaxLength constraints/Length constraints/Url constraints/Regex constraints/Ip - constraints/Max - constraints/Min constraints/Range constraints/Date diff --git a/reference/constraints/Max.rst b/reference/constraints/Max.rst deleted file mode 100644 index 5b19fe038c7..00000000000 --- a/reference/constraints/Max.rst +++ /dev/null @@ -1,111 +0,0 @@ -Max -=== - -.. caution:: - - The Max constraint is deprecated since version 2.1 and will be removed - in Symfony 2.3. Use :doc:`/reference/constraints/Range` with the ``max`` - option instead. - -Validates that a given number is *less* than some maximum number. - -+----------------+--------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | -+----------------+--------------------------------------------------------------------+ -| Options | - `limit`_ | -| | - `message`_ | -| | - `invalidMessage`_ | -+----------------+--------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Max` | -+----------------+--------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\MaxValidator` | -+----------------+--------------------------------------------------------------------+ - -Basic Usage ------------ - -To verify that the "age" field of a class is not greater than "50", you might -add the following: - -.. configuration-block:: - - .. code-block:: yaml - - # src/Acme/EventBundle/Resources/config/validation.yml - Acme\EventBundle\Entity\Participant: - properties: - age: - - Max: { limit: 50, message: You must be 50 or under to enter. } - - .. code-block:: php-annotations - - // src/Acme/EventBundle/Entity/Participant.php - namespace Acme\EventBundle\Entity; - - use Symfony\Component\Validator\Constraints as Assert; - - class Participant - { - /** - * @Assert\Max(limit = 50, message = "You must be 50 or under to enter.") - */ - protected $age; - } - - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php - - // src/Acme/EventBundle/Entity/Participant.php - namespace Acme\EventBundle\Entity; - - use Symfony\Component\Validator\Mapping\ClassMetadata; - use Symfony\Component\Validator\Constraints as Assert; - - class Participant - { - public static function loadValidatorMetadata(ClassMetadata $metadata) - { - $metadata->addPropertyConstraint('age', new Assert\Max(array( - 'limit' => 50, - 'message' => "You must be 50 or under to enter.", - ))); - } - } - -Options -------- - -limit -~~~~~ - -**type**: ``integer`` [:ref:`default option`] - -This required option is the "max" value. Validation will fail if the given -value is **greater** than this max value. - -message -~~~~~~~ - -**type**: ``string`` **default**: ``This value should be {{ limit }} or less`` - -The message that will be shown if the underlying value is greater than the -`limit`_ option. - -invalidMessage -~~~~~~~~~~~~~~ - -**type**: ``string`` **default**: ``This value should be a valid number`` - -The message that will be shown if the underlying value is not a number (per -the :phpfunction:`is_numeric` PHP function). diff --git a/reference/constraints/MaxLength.rst b/reference/constraints/MaxLength.rst deleted file mode 100644 index 54c6fd4d95d..00000000000 --- a/reference/constraints/MaxLength.rst +++ /dev/null @@ -1,107 +0,0 @@ -MaxLength -========= - -.. caution:: - - The MaxLength constraint is deprecated since version 2.1 and will be removed - in Symfony 2.3. Use :doc:`/reference/constraints/Length` with the ``max`` - option instead. - -Validates that the length of a string is not larger than the given limit. - -+----------------+-------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | -+----------------+-------------------------------------------------------------------------+ -| Options | - `limit`_ | -| | - `message`_ | -| | - `charset`_ | -+----------------+-------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\MaxLength` | -+----------------+-------------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\MaxLengthValidator` | -+----------------+-------------------------------------------------------------------------+ - -Basic Usage ------------ - -.. configuration-block:: - - .. code-block:: yaml - - # src/Acme/BlogBundle/Resources/config/validation.yml - Acme\BlogBundle\Entity\Blog: - properties: - summary: - - MaxLength: 100 - - .. code-block:: php-annotations - - // src/Acme/BlogBundle/Entity/Blog.php - namespace Acme\BlogBundle\Entity; - - use Symfony\Component\Validator\Constraints as Assert; - - class Blog - { - /** - * @Assert\MaxLength(100) - */ - protected $summary; - } - - .. code-block:: xml - - - - - - - - - - - .. code-block:: php - - // src/Acme/BlogBundle/Entity/Blog.php - namespace Acme\BlogBundle\Entity; - - use Symfony\Component\Validator\Mapping\ClassMetadata; - use Symfony\Component\Validator\Constraints as Assert; - - class Blog - { - public static function loadValidatorMetadata(ClassMetadata $metadata) - { - $metadata->addPropertyConstraint('summary', new Assert\MaxLength(array( - 'limit' => 100, - ))); - } - } - -Options -------- - -limit -~~~~~ - -**type**: ``integer`` [:ref:`default option`] - -This required option is the "max" value. Validation will fail if the length -of the give string is **greater** than this number. - -message -~~~~~~~ - -**type**: ``string`` **default**: ``This value is too long. It should have {{ limit }} characters or less`` - -The message that will be shown if the underlying string has a length that -is longer than the `limit`_ option. - -charset -~~~~~~~ - -**type**: ``charset`` **default**: ``UTF-8`` - -If the PHP extension "mbstring" is installed, then the PHP function :phpfunction:`mb_strlen` -will be used to calculate the length of the string. The value of the ``charset`` -option is passed as the second argument to that function. diff --git a/reference/constraints/Min.rst b/reference/constraints/Min.rst deleted file mode 100644 index 06f0ba2d332..00000000000 --- a/reference/constraints/Min.rst +++ /dev/null @@ -1,111 +0,0 @@ -Min -=== - -.. caution:: - - The Min constraint is deprecated since version 2.1 and will be removed - in Symfony 2.3. Use :doc:`/reference/constraints/Range` with the ``min`` - option instead. - -Validates that a given number is *greater* than some minimum number. - -+----------------+--------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | -+----------------+--------------------------------------------------------------------+ -| Options | - `limit`_ | -| | - `message`_ | -| | - `invalidMessage`_ | -+----------------+--------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Min` | -+----------------+--------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\MinValidator` | -+----------------+--------------------------------------------------------------------+ - -Basic Usage ------------ - -To verify that the "age" field of a class is "18" or greater, you might add -the following: - -.. configuration-block:: - - .. code-block:: yaml - - # src/Acme/EventBundle/Resources/config/validation.yml - Acme\EventBundle\Entity\Participant: - properties: - age: - - Min: { limit: 18, message: You must be 18 or older to enter. } - - .. code-block:: php-annotations - - // src/Acme/EventBundle/Entity/Participant.php - namespace Acme\EventBundle\Entity; - - use Symfony\Component\Validator\Constraints as Assert; - - class Participant - { - /** - * @Assert\Min(limit = "18", message = "You must be 18 or older to enter.") - */ - protected $age; - } - - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php - - // src/Acme/EventBundle/Entity/Participant.php - namespace Acme\EventBundle\Entity\Participant; - - use Symfony\Component\Validator\Mapping\ClassMetadata; - use Symfony\Component\Validator\Constraints as Assert; - - class Participant - { - public static function loadValidatorMetadata(ClassMetadata $metadata) - { - $metadata->addPropertyConstraint('age', new Assert\Min(array( - 'limit' => '18', - 'message' => 'You must be 18 or older to enter.', - )); - } - } - -Options -------- - -limit -~~~~~ - -**type**: ``integer`` [:ref:`default option`] - -This required option is the "min" value. Validation will fail if the given -value is **less** than this min value. - -message -~~~~~~~ - -**type**: ``string`` **default**: ``This value should be {{ limit }} or more`` - -The message that will be shown if the underlying value is less than the `limit`_ -option. - -invalidMessage -~~~~~~~~~~~~~~ - -**type**: ``string`` **default**: ``This value should be a valid number`` - -The message that will be shown if the underlying value is not a number (per -the :phpfunction:`is_numeric` PHP function). diff --git a/reference/constraints/MinLength.rst b/reference/constraints/MinLength.rst deleted file mode 100644 index b9ad5afd075..00000000000 --- a/reference/constraints/MinLength.rst +++ /dev/null @@ -1,112 +0,0 @@ -MinLength -========= - -.. caution:: - - The MinLength constraint is deprecated since version 2.1 and will be removed - in Symfony 2.3. Use :doc:`/reference/constraints/Length` with the ``min`` - option instead. - -Validates that the length of a string is at least as long as the given limit. - -+----------------+-------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | -+----------------+-------------------------------------------------------------------------+ -| Options | - `limit`_ | -| | - `message`_ | -| | - `charset`_ | -+----------------+-------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\MinLength` | -+----------------+-------------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\MinLengthValidator` | -+----------------+-------------------------------------------------------------------------+ - -Basic Usage ------------ - -.. configuration-block:: - - .. code-block:: yaml - - # src/Acme/BlogBundle/Resources/config/validation.yml - Acme\BlogBundle\Entity\Blog: - properties: - firstName: - - MinLength: { limit: 3, message: "Your name must have at least {{ limit }} characters." } - - .. code-block:: php-annotations - - // src/Acme/BlogBundle/Entity/Blog.php - namespace Acme\BlogBundle\Entity; - - use Symfony\Component\Validator\Constraints as Assert; - - class Blog - { - /** - * @Assert\MinLength( - * limit=3, - * message="Your name must have at least {{ limit }} characters." - * ) - */ - protected $summary; - } - - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php - - // src/Acme/BlogBundle/Entity/Blog.php - namespace Acme\BlogBundle\Entity; - - use Symfony\Component\Validator\Mapping\ClassMetadata; - use Symfony\Component\Validator\Constraints as Assert; - - class Blog - { - public static function loadValidatorMetadata(ClassMetadata $metadata) - { - $metadata->addPropertyConstraint('summary', new Assert\MinLength(array( - 'limit' => 3, - 'message' => 'Your name must have at least {{ limit }} characters.', - ))); - } - } - -Options -------- - -limit -~~~~~ - -**type**: ``integer`` [:ref:`default option`] - -This required option is the "min" value. Validation will fail if the length -of the give string is **less** than this number. - -message -~~~~~~~ - -**type**: ``string`` **default**: ``This value is too short. It should have {{ limit }} characters or more`` - -The message that will be shown if the underlying string has a length that -is shorter than the `limit`_ option. - -charset -~~~~~~~ - -**type**: ``charset`` **default**: ``UTF-8`` - -If the PHP extension "mbstring" is installed, then the PHP function :phpfunction:`mb_strlen` -will be used to calculate the length of the string. The value of the ``charset`` -option is passed as the second argument to that function. diff --git a/reference/constraints/Valid.rst b/reference/constraints/Valid.rst index b8a6f9978c6..f19942c0e46 100644 --- a/reference/constraints/Valid.rst +++ b/reference/constraints/Valid.rst @@ -115,14 +115,18 @@ an ``Address`` instance in the ``$address`` property. - 5 + + + - 4 + + + diff --git a/reference/constraints/map.rst.inc b/reference/constraints/map.rst.inc index 0482c4c5447..3d10d637ccf 100644 --- a/reference/constraints/map.rst.inc +++ b/reference/constraints/map.rst.inc @@ -16,8 +16,6 @@ String Constraints ~~~~~~~~~~~~~~~~~~ * :doc:`Email ` -* :doc:`MinLength ` -* :doc:`MaxLength ` * :doc:`Length ` * :doc:`Url ` * :doc:`Regex ` @@ -26,8 +24,6 @@ String Constraints Number Constraints ~~~~~~~~~~~~~~~~~~ -* :doc:`Max ` -* :doc:`Min ` * :doc:`Range ` Date Constraints From ac9fbcd13fb1939c727613f342f8e015cc73802b Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 23 Mar 2013 12:12:04 +0100 Subject: [PATCH 0130/2078] updated the way form errors are customized --- cookbook/form/form_customization.rst | 27 ++++------------------- cookbook/validation/custom_constraint.rst | 5 ----- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index 000ba292585..eb41d37ec1f 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -718,13 +718,9 @@ and customize the ``form_errors`` fragment. {% block form_errors %} {% spaceless %} {% if errors|length > 0 %} -
    +
      {% for error in errors %} -
    • {{ - error.messagePluralization is null - ? error.messageTemplate|trans(error.messageParameters, 'validators') - : error.messageTemplate|transchoice(error.messagePluralization, error.messageParameters, 'validators') - }}
    • +
    • {{ error.message }}
    • {% endfor %}
    {% endif %} @@ -735,28 +731,13 @@ and customize the ``form_errors`` fragment. -
      +
        -
      • getMessagePluralization()) { - echo $view['translator']->trans( - $error->getMessageTemplate(), - $error->getMessageParameters(), - 'validators' - ); - } else { - echo $view['translator']->transChoice( - $error->getMessageTemplate(), - $error->getMessagePluralization(), - $error->getMessageParameters(), - 'validators' - ); - }?>
      • +
      • getMessage() ?>
      - .. tip:: See :ref:`cookbook-form-theming-methods` for how to apply this customization. diff --git a/cookbook/validation/custom_constraint.rst b/cookbook/validation/custom_constraint.rst index f74063d7c2d..74859a3884b 100644 --- a/cookbook/validation/custom_constraint.rst +++ b/cookbook/validation/custom_constraint.rst @@ -79,11 +79,6 @@ The validator class is also simple, and only has one required method: ``validate The first parameter of the ``addViolation`` call is the error message to use for that violation. -.. versionadded:: 2.1 - The ``isValid`` method was renamed to ``validate`` in Symfony 2.1. The - ``setMessage`` method was also deprecated, in favor of calling ``addViolation`` - on the context. - Using the new Validator ----------------------- From 2521b05111bd5af839b4b1267225d72ef38caf62 Mon Sep 17 00:00:00 2001 From: marcosQuesada Date: Tue, 26 Feb 2013 21:07:01 +0100 Subject: [PATCH 0131/2078] Added documentation to cover PR #6951 on serializer component. --- components/serializer.rst | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/components/serializer.rst b/components/serializer.rst index e502845a126..6ab98e0da69 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -96,6 +96,22 @@ The first parameter of the :method:`Symfony\\Component\\Serializer\\Serializer:: is the object to be serialized and the second is used to choose the proper encoder, in this case :class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder`. +As an option, there's a way to ignore attributes from the origin object to be +serialized, to remove those attributes use +:method:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer::setIgnoredAttributes` +method on normalizer definition:: + + use Symfony\Component\Serializer\Serializer; + use Symfony\Component\Serializer\Encoder\JsonEncoder; + use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer; + + $normalizer = new GetSetMethodNormalizer(); + $normalizer->setIgnoredAttributes(array('age')); + $encoder = new JsonEncoder(); + + $serializer = new Serializer(array($normalizer), array($encoder)); + $serializer->serialize($person, 'json'); // Output: {"name":"foo"} + Deserializing an Object ~~~~~~~~~~~~~~~~~~~~~~~ @@ -118,6 +134,32 @@ needs three parameters: 2. The name of the class this information will be decoded to 3. The encoder used to convert that information into an array +Sometimes property names from the serialized content are underscored, in a +regular configuration those attributes will use get/set methods as +``getCamel_case``, when ``getCamelCase`` method is preferable. To change that +behavior use +:method:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer::setCamelizedAttributes` +on normalizer definition:: + + $encoder = new JsonEncoder(); + $normalizer = new GetSetMethodNormalizer(); + $normalizer->setCamelizedAttributes(array('camel_case')); + + $serializer = new Serializer(array($normalizer), array($encoder)); + + $json = <<deserialize($json, 'Acme\Person', 'json'); + +As a final result, Person object uses ``camelCase`` attribute for +``camel_case`` json parameter, the same applies on getters and setters. + JMSSerializer ------------- From d879786996b149845af872406a6627398324aed4 Mon Sep 17 00:00:00 2001 From: Philipp Wahala Date: Mon, 25 Mar 2013 07:30:16 +0100 Subject: [PATCH 0132/2078] Document new framework option http_method_override --- reference/configuration/framework.rst | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index fe70e1f121c..79f0d6c6e27 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -16,6 +16,7 @@ Configuration ------------- * `secret`_ +* `http_method_override`_ * `ide`_ * `test`_ * `trust_proxy_headers`_ @@ -49,6 +50,21 @@ it's used for generating the CSRF tokens, but it could be used in any other context where having a unique string is useful. It becomes the service container parameter named ``kernel.secret``. +http_method_override +~~~~~~ + +.. versionadded:: 2.3 + The ``http_method_override`` option is new in version 2.3 + +**type**: ``Boolean`` **default**: ``true`` + +This determines whether the '_method' request parameter is used as the intended +HTTP method on POST requests. If enabled, the +:method:`Request::enableHttpMethodParameterOverride ` +gets called automatically. It becomes the service container parameter named +``kernel.http_method_override``. For more information, see +:doc:`/cookbook/routing/method_parameters`. + ide ~~~ @@ -379,6 +395,7 @@ Full Default Configuration framework: charset: ~ secret: ~ + http_method_override: true trust_proxy_headers: false trusted_proxies: [] ide: ~ @@ -405,7 +422,7 @@ Full Default Configuration profiler: enabled: false only_exceptions: false - only_master_requests: false + only_master_requests: false dsn: file:%kernel.cache_dir%/profiler username: password: From 784b61153e3162ca9a891dbf6406326ba5a8c886 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 24 Mar 2013 11:39:46 +0100 Subject: [PATCH 0133/2078] added documentation for the dispatchable console application --- components/console/events.rst | 116 ++++++++++++++++++++++++++++++++++ components/console/index.rst | 2 +- 2 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 components/console/events.rst diff --git a/components/console/events.rst b/components/console/events.rst new file mode 100644 index 00000000000..af55b7f6a2e --- /dev/null +++ b/components/console/events.rst @@ -0,0 +1,116 @@ +.. index:: + single: Console; Events + +.. versionadded:: 2.3 + The feature described in this chapter was added in 2.3. + +Using Events +============ + +The Application class of the Console component allows you to optionally hook +into the lifecycle of a console application via events. Instead of reinventing +the wheel, it uses the Symfony EventDispatcher component to do the work:: + + use Symfony\Component\Console\Application; + use Symfony\Component\EventDispatcher\EventDispatcher; + + $application = new Application(); + $application->setDispatcher($dispatcher); + $application->run(); + +The ``ConsoleEvents::COMMAND`` event +------------------------------------ + +**Typical Purposes**: Doing something before any command is run (like logging +which command is going to be executed), or displaying something about the event +to be executed. + +Just before executing any command, the ``ConsoleEvents::COMMAND`` event is +dispatched. Listeners receive a +:class:`Symfony\\Component\\Console\\Event\\ConsoleCommandEvent` event:: + + use Symfony\Component\Console\Event\ConsoleCommandEvent; + use Symfony\Component\Console\ConsoleEvents; + + $dispatcher->addListener(ConsoleEvents::COMMAND, function (ConsoleCommandEvent $event) { + // get the input instance + $input = $event->getInput(); + + // get the output instance + $output = $event->getOutput(); + + // get the command to be executed + $command = $event->getCommand(); + + // write something about the command + $output->writeln(sprintf('Before running command %s', $command->getName())); + + // get the application + $application = $command->getApplication(); + }); + +The ``ConsoleEvents::TERMINATE`` event +-------------------------------------- + +**Typical Purposes**: To perform some cleanup actions after the command has +been executed. + +After the command has been executed, the ``ConsoleEvents::TERMINATE`` event is +dispatched. It can be used to do any actions that need to be executed for all +commands or to cleanup what you initiated in the ``ConsoleEvents::COMMAND`` +command (like sending logs, closing a database connection, sending emails, +...). A listener might also change the exit code. + +Listeners receive a +:class:`Symfony\\Component\\Console\\Event\\ConsoleTerminateEvent` event:: + + use Symfony\Component\Console\Event\ConsoleTerminateEvent; + use Symfony\Component\Console\ConsoleEvents; + + $dispatcher->addListener(ConsoleEvents::TERMINATE, function (ConsoleTerminateEvent $event) { + // get the output + $output = $event->getOutput(); + + // get the command that has been executed + $command = $event->getCommand(); + + // display something + $output->writeln(sprintf('After running command %s', $command->getName())); + + // change the exit code + $event->setExitCode(128); + }); + +.. tip:: + + This event is also dispatched when an exception is thrown by the command. + It is then dispatched just before the ``ConsoleEvents::EXCEPTION`` event. + The exit code received in this case is the exception code. + +The ``ConsoleEvents::EXCEPTION`` event +-------------------------------------- + +**Typical Purposes**: Handle exceptions thrown during the execution of a +command. + +Whenever an exception is thrown by a command, the ``ConsoleEvents::EXCEPTION`` +command is dispatched. A listener can wrap or change the exception or do +anything useful before the exception is thrown by the application. + +Listeners receive a +:class:`Symfony\\Component\\Console\\Event\\ConsoleForExceptionEvent` event:: + + use Symfony\Component\Console\Event\ConsoleForExceptionEvent; + use Symfony\Component\Console\ConsoleEvents; + + $dispatcher->addListener(ConsoleEvents::EXCEPTION, function (ConsoleForExceptionEvent $event) { + $output = $event->getOutput(); + + $output->writeln(sprintf('Oops, exception thrown while running command %s', $command->getName())); + + // get the current exit code (the exception code or the exit code set by a ConsoleEvents::TERMINATE event) + $exitCode = $event->getExitCode(); + + // change the exception to another one + $event->setException(new \LogicException('Caught exception', $exitCode, $event->getException())); + }); diff --git a/components/console/index.rst b/components/console/index.rst index 4d0a12e4d70..9b025d3a0a1 100644 --- a/components/console/index.rst +++ b/components/console/index.rst @@ -7,5 +7,5 @@ Console introduction usage single_command_tool - helpers/index + events From f9bbfcdee289df495f9fbb9b9ce73cd1d99abd64 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 23 Mar 2013 10:51:27 +0100 Subject: [PATCH 0134/2078] updated documentation for synchronized services --- cookbook/service_container/scopes.rst | 204 +++++++++++++++++++++----- 1 file changed, 171 insertions(+), 33 deletions(-) diff --git a/cookbook/service_container/scopes.rst b/cookbook/service_container/scopes.rst index aee6710636f..48e760ca1c6 100644 --- a/cookbook/service_container/scopes.rst +++ b/cookbook/service_container/scopes.rst @@ -21,13 +21,15 @@ scopes: - ``prototype``: A new instance is created each time you request the service. -The FrameworkBundle also defines a third scope: ``request``. This scope is -tied to the request, meaning a new instance is created for each subrequest -and is unavailable outside the request (for instance in the CLI). +The +:class:`Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel` +also defines a third scope: ``request``. This scope is tied to the request, +meaning a new instance is created for each subrequest and is unavailable +outside the request (for instance in the CLI). Scopes add a constraint on the dependencies of a service: a service cannot depend on services from a narrower scope. For example, if you create a generic -``my_foo`` service, but try to inject the ``request`` component, you'll receive +``my_foo`` service, but try to inject the ``request`` service, you will receive a :class:`Symfony\\Component\\DependencyInjection\\Exception\\ScopeWideningInjectionException` when compiling the container. Read the sidebar below for more details. @@ -69,10 +71,71 @@ when compiling the container. Read the sidebar below for more details. A service can of course depend on a service from a wider scope without any issue. -Setting the Scope in the Definition ------------------------------------ +Using a Service from a narrower Scope +------------------------------------- + +If your service has a dependency on a scoped service (like the ``request``), +you have three ways to deal with it: + +* Use setter injection if the dependency is "synchronized"; this is the + recommended way and the best solution for the ``request`` instance as it is + synchronized with the ``request`` scope (see + :ref:`using-synchronized-service`). + +* Put your service in the same scope as the dependency (or a narrower one). If + you depend on the ``request`` service, this means putting your new service + in the ``request`` scope (see :ref:`changing-service-scope`); + +* Pass the entire container to your service and retrieve your dependency from + the container each time you need it to be sure you have the right instance + -- your service can live in the default ``container`` scope (see + :ref:`passing-container`); + +Each scenario is detailed in the following sections. + +.. _using-synchronized-service: + +Using a synchronized Service +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The scope of a service is set in the definition of the service: +Injecting the container or setting your service to a narrower scope have +drawbacks. For synchronized services (like the ``request``), using setter +injection is the best option as it has no drawbacks and everything works +without any special code in your service or in your definition:: + + // src/Acme/HelloBundle/Mail/Mailer.php + namespace Acme\HelloBundle\Mail; + + use Symfony\Component\HttpFoundation\Request; + + class Mailer + { + protected $request; + + public function setRequest(Request $request = null) + { + $this->request = $request; + } + + public function sendEmail() + { + if (null === $this->request) { + // throw an error? + } + + // ... do something using the request here + } + } + +Whenever the ``request`` is entered or leaved, the service container will +automatically call the ``setRequest()`` method with the current ``request`` +instance. + +You might have noticed that the ``setRequest()`` method accepts ``null`` as a +valid value for the ``request`` argument. That's because when leaving the +``request`` scope, the ``request`` instance can be ``null`` (for the master +request for instance). Of course, you should take care of this possibility in +your code. This should also be taken into account when declaring your service: .. configuration-block:: @@ -82,42 +145,117 @@ The scope of a service is set in the definition of the service: services: greeting_card_manager: class: Acme\HelloBundle\Mail\GreetingCardManager - scope: request + calls: + - [setRequest, ['@?request']] .. code-block:: xml - + + + + .. code-block:: php // src/Acme/HelloBundle/Resources/config/services.php use Symfony\Component\DependencyInjection\Definition; + use Symfony\Component\DependencyInjection\ContainerInterface; - $container->setDefinition( + $definition = $container->setDefinition( 'greeting_card_manager', new Definition('Acme\HelloBundle\Mail\GreetingCardManager') - )->setScope('request'); + ) + ->addMethodCall('setRequest', array( + new Reference('request', ContainerInterface::NULL_ON_INVALID_REFERENCE, false) + )); -If you don't specify the scope, it defaults to ``container``, which is what -you want most of the time. Unless your service depends on another service -that's scoped to a narrower scope (most commonly, the ``request`` service), -you probably don't need to set the scope. +.. tip:: -Using a Service from a narrower Scope -------------------------------------- + You can declare your own ``synchronized`` services very easily; here is + the declaration of the ``request`` service for reference: + + .. configuration-block:: + + .. code-block:: yaml -If your service depends on a scoped service, the best solution is to put -it in the same scope (or a narrower one). Usually, this means putting your -new service in the ``request`` scope. + services: + request: + scope: request + synthetic: true + synchronized: true -But this is not always possible (for instance, a twig extension must be in -the ``container`` scope as the Twig environment needs it as a dependency). -In these cases, you should pass the entire container into your service and -retrieve your dependency from the container each time you need it to be sure -you have the right instance:: + .. code-block:: xml + + + + + + .. code-block:: php + + use Symfony\Component\DependencyInjection\Definition; + use Symfony\Component\DependencyInjection\ContainerInterface; + + $definition = $container->setDefinition('request') + ->setScope('request') + ->setSynthetic(true) + ->setSynchronized(true); + +.. _changing-service-scope: + +Changing the Scope of your Service +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Changing the scope of a service should be done set in its definition: + +.. configuration-block:: + + .. code-block:: yaml + + # src/Acme/HelloBundle/Resources/config/services.yml + services: + greeting_card_manager: + class: Acme\HelloBundle\Mail\GreetingCardManager + scope: request + arguments: [@request] + + .. code-block:: xml + + + + + + + + .. code-block:: php + + // src/Acme/HelloBundle/Resources/config/services.php + use Symfony\Component\DependencyInjection\Definition; + + $definition = $container->setDefinition( + 'greeting_card_manager', + new Definition( + 'Acme\HelloBundle\Mail\GreetingCardManager', + array(new Reference('request'), + )) + )->setScope('request'); + +.. _passing-container: + +Passing the Container as a Dependency of your Service +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Setting the scope to a narrower one is not always possible (for instance, a +twig extension must be in the ``container`` scope as the Twig environment +needs it as a dependency). In these cases, you can pass the entire container +into your service:: // src/Acme/HelloBundle/Mail/Mailer.php namespace Acme\HelloBundle\Mail; @@ -160,8 +298,7 @@ The service config for this class would look something like this: services: my_mailer: class: "%my_mailer.class%" - arguments: - - "@service_container" + arguments: ["@service_container"] # scope: container can be omitted as it is the default .. code-block:: xml @@ -195,10 +332,11 @@ The service config for this class would look something like this: .. note:: Injecting the whole container into a service is generally not a good - idea (only inject what you need). In some rare cases, it's necessary - when you have a service in the ``container`` scope that needs a service - in the ``request`` scope. + idea (only inject what you need). + +.. tip:: -If you define a controller as a service then you can get the ``Request`` object -without injecting the container by having it passed in as an argument of your -action method. See :ref:`book-controller-request-argument` for details. + If you define a controller as a service then you can get the ``Request`` + object without injecting the container by having it passed in as an + argument of your action method. See + :ref:`book-controller-request-argument` for details. From 35fff77b0d6719ae1854de12d65b7884c5f8af8a Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 26 Mar 2013 12:52:37 -0500 Subject: [PATCH 0135/2078] [#2343] Minor tweaks to synchronized services section --- cookbook/service_container/scopes.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cookbook/service_container/scopes.rst b/cookbook/service_container/scopes.rst index 48e760ca1c6..e779bc933b9 100644 --- a/cookbook/service_container/scopes.rst +++ b/cookbook/service_container/scopes.rst @@ -98,6 +98,9 @@ Each scenario is detailed in the following sections. Using a synchronized Service ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. versionadded:: 2.3 + Synchronized services are new in Symfony 2.3. + Injecting the container or setting your service to a narrower scope have drawbacks. For synchronized services (like the ``request``), using setter injection is the best option as it has no drawbacks and everything works @@ -127,7 +130,7 @@ without any special code in your service or in your definition:: } } -Whenever the ``request`` is entered or leaved, the service container will +Whenever the ``request`` scope is entered or left, the service container will automatically call the ``setRequest()`` method with the current ``request`` instance. @@ -210,7 +213,7 @@ your code. This should also be taken into account when declaring your service: Changing the Scope of your Service ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Changing the scope of a service should be done set in its definition: +Changing the scope of a service should be done in its definition: .. configuration-block:: From bf4ce18dc658f4f02bcad20e4f42ee9802f6da38 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 23 Mar 2013 12:46:59 +0100 Subject: [PATCH 0136/2078] removed deprecated cookie config options --- .../configuration/pdo_session_storage.rst | 24 +++++++-------- reference/configuration/framework.rst | 30 ------------------- 2 files changed, 12 insertions(+), 42 deletions(-) diff --git a/cookbook/configuration/pdo_session_storage.rst b/cookbook/configuration/pdo_session_storage.rst index 6db15b4f520..9272b8c2d4b 100644 --- a/cookbook/configuration/pdo_session_storage.rst +++ b/cookbook/configuration/pdo_session_storage.rst @@ -54,7 +54,7 @@ configuration format of your choice): - + @@ -196,16 +196,16 @@ For MSSQL, the statement might look like the following: .. code-block:: sql CREATE TABLE [dbo].[session]( - [session_id] [nvarchar](255) NOT NULL, - [session_value] [ntext] NOT NULL, + [session_id] [nvarchar](255) NOT NULL, + [session_value] [ntext] NOT NULL, [session_time] [int] NOT NULL, - PRIMARY KEY CLUSTERED( - [session_id] ASC - ) WITH ( - PAD_INDEX = OFF, - STATISTICS_NORECOMPUTE = OFF, - IGNORE_DUP_KEY = OFF, - ALLOW_ROW_LOCKS = ON, - ALLOW_PAGE_LOCKS = ON - ) ON [PRIMARY] + PRIMARY KEY CLUSTERED( + [session_id] ASC + ) WITH ( + PAD_INDEX = OFF, + STATISTICS_NORECOMPUTE = OFF, + IGNORE_DUP_KEY = OFF, + ALLOW_ROW_LOCKS = ON, + ALLOW_PAGE_LOCKS = ON + ) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 4e2ac86965f..aef1bd6d053 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -131,9 +131,6 @@ session cookie_lifetime ............... -.. versionadded:: 2.1 - This option was formerly known as ``lifetime`` - **type**: ``integer`` **default**: ``0`` This determines the lifetime of the session - in seconds. By default it will use @@ -142,9 +139,6 @@ This determines the lifetime of the session - in seconds. By default it will use cookie_path ........... -.. versionadded:: 2.1 - This option was formerly known as ``path`` - **type**: ``string`` **default**: ``/`` This determines the path to set in the session cookie. By default it will use ``/``. @@ -152,9 +146,6 @@ This determines the path to set in the session cookie. By default it will use `` cookie_domain ............. -.. versionadded:: 2.1 - This option was formerly known as ``domain`` - **type**: ``string`` **default**: ``''`` This determines the domain to set in the session cookie. By default it's blank, @@ -164,9 +155,6 @@ to the cookie specification. cookie_secure ............. -.. versionadded:: 2.1 - This option was formerly known as ``secure`` - **type**: ``Boolean`` **default**: ``false`` This determines whether cookies should only be sent over secure connections. @@ -174,9 +162,6 @@ This determines whether cookies should only be sent over secure connections. cookie_httponly ............... -.. versionadded:: 2.1 - This option was formerly known as ``httponly`` - **type**: ``Boolean`` **default**: ``false`` This determines whether cookies should only accesible through the HTTP protocol. @@ -429,21 +414,6 @@ Full Default Configuration gc_maxlifetime: ~ save_path: %kernel.cache_dir%/sessions - # DEPRECATED! Please use: cookie_lifetime - lifetime: ~ - - # DEPRECATED! Please use: cookie_path - path: ~ - - # DEPRECATED! Please use: cookie_domain - domain: ~ - - # DEPRECATED! Please use: cookie_secure - secure: ~ - - # DEPRECATED! Please use: cookie_httponly - httponly: ~ - # templating configuration templating: assets_version: ~ From a78694102c8b0aa83cf760277d7686ff16219b75 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 23 Mar 2013 12:48:54 +0100 Subject: [PATCH 0137/2078] removed deprecated auto_start setting --- reference/configuration/framework.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index aef1bd6d053..a7ac54a321b 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -399,8 +399,6 @@ Full Default Configuration # session configuration session: - # DEPRECATED! Session starts on demand - auto_start: false storage_id: session.storage.native handler_id: session.handler.native_file name: ~ @@ -461,9 +459,4 @@ Full Default Configuration file_cache_dir: %kernel.cache_dir%/annotations debug: %kernel.debug% - -.. versionadded:: 2.1 - The ```framework.session.auto_start`` setting has been removed in Symfony2.1, - it will start on demand now. - .. _`protocol-relative`: http://tools.ietf.org/html/rfc3986#section-4.2 From 934531c41f5eea03bc7324c1faba3e3d49077d15 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 23 Mar 2013 12:49:47 +0100 Subject: [PATCH 0138/2078] removed deprecated charset setting --- reference/configuration/framework.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index a7ac54a321b..76e0429e357 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -345,7 +345,6 @@ Full Default Configuration .. code-block:: yaml framework: - charset: ~ secret: ~ trusted_proxies: [] ide: ~ From a9c8ed63303e05552adbc398eeb4bfd8ef3ff255 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 30 Mar 2013 08:40:23 -0500 Subject: [PATCH 0139/2078] [#1829] Moving serializer framework docs around - added a new cookbook and linked to that from everywhere else --- cookbook/index.rst | 1 + cookbook/map.rst.inc | 4 + cookbook/serializer.rst | 111 ++++++++++++++++++++++++++ reference/configuration/framework.rst | 52 +----------- reference/dic_tags.rst | 6 +- 5 files changed, 119 insertions(+), 55 deletions(-) create mode 100644 cookbook/serializer.rst diff --git a/cookbook/index.rst b/cookbook/index.rst index b2e6f87de0f..8131c58898a 100644 --- a/cookbook/index.rst +++ b/cookbook/index.rst @@ -12,6 +12,7 @@ The Cookbook form/index validation/index configuration/index + serializer service_container/index bundles/index email/index diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index 0ec091b14ca..569d3615900 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -122,6 +122,10 @@ * :doc:`/cookbook/security/custom_authentication_provider` * :doc:`/cookbook/security/target_path` +* **Serializer** + + * :doc:`/cookbook/serializer` + * :doc:`/cookbook/service_container/index` * :doc:`/cookbook/service_container/event_listener` diff --git a/cookbook/serializer.rst b/cookbook/serializer.rst new file mode 100644 index 00000000000..d4e9baeab00 --- /dev/null +++ b/cookbook/serializer.rst @@ -0,0 +1,111 @@ +.. index:: + single: Serializer + +How to use the Serializer +========================= + +Serializing and deserializing to and from objects and different formats (e.g. +JSON or XML) is a very complex topic. Symfony comes with a +:doc:`Serializer Component`, which gives you some +tools that you can leverage for your solution. + +In fact, before you start, get familiar with the serializer, normalizers +and encoders by reading the :doc:`Serializer Component`. +You should also check out the `JMSSerializerBundle`_, which expands on the +functionality offered by Symfony's core serializer. + +Activating the Serializer +------------------------- + +.. versionadded:: 2.3 + The Serializer has always existed in Symfony, but prior to Symfony 2.3, + you needed to build the ``serializer`` service yourself. + +The ``serializer`` service is not available by default. To turn it on, activate +it in your configuration: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + framework: + # ... + serializer: + enabled: true + + .. code-block:: xml + + + + + + + + .. code-block:: php + + // app/config/config.php + $container->loadFromExtension('framework', array( + // ... + 'serializer' => array( + 'enabled' => true + ), + )); + +Adding Normalizers and Encoders +------------------------------- + +Once enabled, the ``serializer`` service will be available in the container +and will be loaded with two :ref:`encoders` +(:class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder` and +:class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`) +but no :ref:`normalizers`, meaning you'll +need to load your own. + +You can load normalizers and/or encoders by tagging them as +:ref:`serializer.normalizer` and +:ref:`serializer.encoder`. It's also +possible to set the priority of the tag in order to decide the matching order. + +Here an example on how to load the load +the :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + services: + get_set_method_normalizer: + class: Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer + tags: + - { name: serializer.normalizer } + + .. code-block:: xml + + + + + + + + + .. code-block:: php + + // app/config/config.php + use Symfony\Component\DependencyInjection\Definition; + + $definition = new Definition( + 'Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer' + )); + $definition->addTag('serializer.normalizer'); + $container->setDefinition('get_set_method_normalizer', $definition); + +.. note:: + + The :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer` + is broken by design. As soon as you have a circular object graph, an + infinite loop is created when calling the getters. You're encouraged + to add your own normalizers that fit your use-case. + +.. _JMSSerializerBundle: http://jmsyst.com/bundles/JMSSerializerBundle \ No newline at end of file diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 77b4a2c8acb..76a8a33ad94 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -257,58 +257,8 @@ enabled **type**: ``boolean`` **default**: ``false`` Whether to enable the ``serializer`` service or not in the service container. -If enabled, the ``serializer`` service will be available in the container -and will be loaded with two :ref:`encoders` -(:class:`Symfony\\Component\\Serializer\\Encoder\\JsonEncoder` and -:class:`Symfony\\Component\\Serializer\\Encoder\\XmlEncoder`) -but no :ref:`normalizers`, meaning you'll -need to load your own. -You can load normalizers and/or encoders by tagging them as -:ref:`serializer.normalizer` and -:ref:`serializer.encoder`. It's also -possible to set the priority of the tag in order to decide the matching order. - -Here an example on how to load the load -the :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`: - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/config.yml - services: - get_set_method_normalizer: - class: Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer - tags: - - { name: serializer.normalizer } - - .. code-block:: xml - - - - - - - - - .. code-block:: php - - // app/config/config.php - use Symfony\Component\DependencyInjection\Definition; - - $definition = new Definition( - 'Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer' - )); - $definition->addTag('serializer.normalizer'); - $container->setDefinition('get_set_method_normalizer', $definition); - -.. note:: - - The :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer` - is broken by design. As soon as you have a circular object graph, an - infinite loop is created when calling the getters. You're encouraged - to add your own normalizers that fit your use-case. +For more details, see :doc:`/cookbook/serializer`. templating ~~~~~~~~~~ diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index a7c3670c845..79d44d66d8f 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -574,8 +574,7 @@ serializer.encoder The class that's tagged should implement the :class:`Symfony\\Component\\Serializer\\Encoder\\EncoderInterface` and :class:`Symfony\\Component\\Serializer\\Encoder\\DecoderInterface`. -You have to :ref:`enable the serializer service` -in order to use this tag. +For more details, see :doc:`/cookbook/serializer`. .. _reference-dic-tags-serializer-normalizer: @@ -587,8 +586,7 @@ serializer.normalizer The class that's tagged should implement the :class:`Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface` and :class:`Symfony\\Component\\Serializer\\Normalizer\\DenormalizerInterface`. -You have to :ref:`enable the serializer service` -in order to use this tag. +For more details, see :doc:`/cookbook/serializer`. swiftmailer.plugin ------------------ From 55e89b8036bb81380d687ac561022ca627e08391 Mon Sep 17 00:00:00 2001 From: John Bafford Date: Sat, 30 Mar 2013 11:57:14 -0400 Subject: [PATCH 0140/2078] Add documentation for the new BinaryFileResponse class (#1866) --- book/controller.rst | 7 ++++-- components/http_foundation/introduction.rst | 26 +++++++++++++++++++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 1f51d5ed4c5..92b97672cde 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -726,8 +726,11 @@ headers and content that's sent back to the client:: .. tip:: - There is also a special :class:`Symfony\\Component\\HttpFoundation\\JsonResponse` - class that helps return JSON responses. See :ref:`component-http-foundation-json-response`. + There are also special classes to make certain kinds of responses easier: + - For JSON, there is :class:`Symfony\\Component\\HttpFoundation\\JsonResponse`. + See :ref:`component-http-foundation-json-response`. + - For files, there is :class:`Symfony\\Component\\HttpFoundation\\JsonResponse`. + See :ref:`_component-http-foundation-serving-files .. index:: single: Controller; Request object diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 08ee28d970e..f8a529fe894 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -406,13 +406,15 @@ represented by a PHP callable instead of a string:: }); $response->send(); -Downloading Files +.. _component-http-foundation-serving-files: + +Serving Files ~~~~~~~~~~~~~~~~~ .. versionadded:: 2.1 The ``makeDisposition`` method was added in Symfony 2.1. -When uploading a file, you must add a ``Content-Disposition`` header to your +When sending a file, you must add a ``Content-Disposition`` header to your response. While creating this header for basic file downloads is easy, using non-ASCII filenames is more involving. The :method:`Symfony\\Component\\HttpFoundation\\Response::makeDisposition` @@ -424,6 +426,26 @@ abstracts the hard work behind a simple API:: $response->headers->set('Content-Disposition', $d); +.. versionadded:: 2.2 + The :class:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse` class was added in Symfony 2.2. + +Alternatively, if you are serving a static file, you can use a +:class:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse`:: + + use Symfony\Component\HttpFoundation\BinaryFileResponse + + $file = 'path/to/file.txt'; + $response = new BinaryFileResponse($file); + +The :class:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse` will +automatically handle ``Range`` and ``If-Range`` headers from the request. +You can also set the ``Content-Type`` of the sent file, or change its +``Content-Disposition``:: + + $response->headers->set('Content-Type', 'text/plain') + $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'filename.txt'); + + .. _component-http-foundation-json-response: Creating a JSON Response From 5e5faeb691034ef4017b73251a9f71574b01a902 Mon Sep 17 00:00:00 2001 From: John Bafford Date: Sat, 30 Mar 2013 12:07:42 -0400 Subject: [PATCH 0141/2078] Formatting fixes per WouterJ's comments --- book/controller.rst | 1 + components/http_foundation/introduction.rst | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 92b97672cde..086348a4e99 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -727,6 +727,7 @@ headers and content that's sent back to the client:: .. tip:: There are also special classes to make certain kinds of responses easier: + - For JSON, there is :class:`Symfony\\Component\\HttpFoundation\\JsonResponse`. See :ref:`component-http-foundation-json-response`. - For files, there is :class:`Symfony\\Component\\HttpFoundation\\JsonResponse`. diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index f8a529fe894..39cb290b627 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -409,7 +409,7 @@ represented by a PHP callable instead of a string:: .. _component-http-foundation-serving-files: Serving Files -~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~ .. versionadded:: 2.1 The ``makeDisposition`` method was added in Symfony 2.1. @@ -427,7 +427,8 @@ abstracts the hard work behind a simple API:: $response->headers->set('Content-Disposition', $d); .. versionadded:: 2.2 - The :class:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse` class was added in Symfony 2.2. + The :class:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse` + class was added in Symfony 2.2. Alternatively, if you are serving a static file, you can use a :class:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse`:: @@ -437,10 +438,9 @@ Alternatively, if you are serving a static file, you can use a $file = 'path/to/file.txt'; $response = new BinaryFileResponse($file); -The :class:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse` will -automatically handle ``Range`` and ``If-Range`` headers from the request. -You can also set the ``Content-Type`` of the sent file, or change its -``Content-Disposition``:: +The ``BinaryFileResponse`` will automatically handle ``Range`` and +``If-Range`` headers from the request. You can also set the ``Content-Type`` +of the sent file, or change its ``Content-Disposition``:: $response->headers->set('Content-Type', 'text/plain') $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'filename.txt'); @@ -464,7 +464,8 @@ right content and headers. A JSON response might look like this:: $response->headers->set('Content-Type', 'application/json'); .. versionadded:: 2.1 - The :class:`Symfony\\Component\\HttpFoundation\\JsonResponse` class was added in Symfony 2.1. + The :class:`Symfony\\Component\\HttpFoundation\\JsonResponse` + class was added in Symfony 2.1. There is also a helpful :class:`Symfony\\Component\\HttpFoundation\\JsonResponse` class, which can make this even easier:: From 8d6d6c33fa444b91b04ae5bee2dda3a6b240d67e Mon Sep 17 00:00:00 2001 From: marcusesa Date: Mon, 25 Mar 2013 10:14:40 -0300 Subject: [PATCH 0142/2078] Fix signature UserNotFoundException in entity_provider.rst. --- cookbook/security/entity_provider.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index a4700f20fdd..54708d9b544 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -446,7 +446,7 @@ The code below shows the implementation of the 'Unable to find an active admin AcmeUserBundle:User object identified by "%s".', $username ); - throw new UsernameNotFoundException($message,, 0, $e); + throw new UsernameNotFoundException($message, 0, $e); } return $user; From 5e502ea68d0cc4af16e526f50878f839881ad0af Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 30 Mar 2013 16:56:12 -0500 Subject: [PATCH 0143/2078] [#2352] Minor tweaks to new console events section --- components/console/events.rst | 14 +++++++------- components/console/index.rst | 2 +- components/map.rst.inc | 1 + 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/components/console/events.rst b/components/console/events.rst index af55b7f6a2e..7306aa50d06 100644 --- a/components/console/events.rst +++ b/components/console/events.rst @@ -1,12 +1,12 @@ .. index:: single: Console; Events -.. versionadded:: 2.3 - The feature described in this chapter was added in 2.3. - Using Events ============ +.. versionadded:: 2.3 + Console events were added in Symfony 2.3. + The Application class of the Console component allows you to optionally hook into the lifecycle of a console application via events. Instead of reinventing the wheel, it uses the Symfony EventDispatcher component to do the work:: @@ -18,7 +18,7 @@ the wheel, it uses the Symfony EventDispatcher component to do the work:: $application->setDispatcher($dispatcher); $application->run(); -The ``ConsoleEvents::COMMAND`` event +The ``ConsoleEvents::COMMAND`` Event ------------------------------------ **Typical Purposes**: Doing something before any command is run (like logging @@ -57,8 +57,8 @@ been executed. After the command has been executed, the ``ConsoleEvents::TERMINATE`` event is dispatched. It can be used to do any actions that need to be executed for all -commands or to cleanup what you initiated in the ``ConsoleEvents::COMMAND`` -command (like sending logs, closing a database connection, sending emails, +commands or to cleanup what you initiated in a ``ConsoleEvents::COMMAND`` +listener (like sending logs, closing a database connection, sending emails, ...). A listener might also change the exit code. Listeners receive a @@ -94,7 +94,7 @@ The ``ConsoleEvents::EXCEPTION`` event command. Whenever an exception is thrown by a command, the ``ConsoleEvents::EXCEPTION`` -command is dispatched. A listener can wrap or change the exception or do +event is dispatched. A listener can wrap or change the exception or do anything useful before the exception is thrown by the application. Listeners receive a diff --git a/components/console/index.rst b/components/console/index.rst index 9b025d3a0a1..c814942d018 100644 --- a/components/console/index.rst +++ b/components/console/index.rst @@ -7,5 +7,5 @@ Console introduction usage single_command_tool - helpers/index events + helpers/index diff --git a/components/map.rst.inc b/components/map.rst.inc index cb32c7bd7fa..c9084b6f897 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -16,6 +16,7 @@ * :doc:`/components/console/introduction` * :doc:`/components/console/usage` * :doc:`/components/console/single_command_tool` + * :doc:`/components/console/events` * :doc:`/components/console/helpers/index` * **CSS Selector** From 5345055205d92fe0b089aeee50b1f3b01cc4b321 Mon Sep 17 00:00:00 2001 From: John Bafford Date: Sun, 31 Mar 2013 09:15:11 -0400 Subject: [PATCH 0144/2078] Typo fix --- book/controller.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 086348a4e99..3a80b2fd059 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -730,8 +730,8 @@ headers and content that's sent back to the client:: - For JSON, there is :class:`Symfony\\Component\\HttpFoundation\\JsonResponse`. See :ref:`component-http-foundation-json-response`. - - For files, there is :class:`Symfony\\Component\\HttpFoundation\\JsonResponse`. - See :ref:`_component-http-foundation-serving-files + - For files, there is :class:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse`. + See :ref:`component-http-foundation-serving-files .. index:: single: Controller; Request object From 6f4fe27a1c3ade1b251052dbac18ee7a03c035d7 Mon Sep 17 00:00:00 2001 From: Denis Togbe Date: Sun, 31 Mar 2013 18:34:12 +0200 Subject: [PATCH 0145/2078] [#2347] Added missing 'kernel.fragment_renderer' DIC tag --- reference/dic_tags.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index 910e229a870..f984a6e0050 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -30,6 +30,8 @@ the AsseticBundle has several tags that aren't listed here. +-----------------------------------+---------------------------------------------------------------------------+ | `kernel.event_subscriber`_ | To subscribe to a set of different events/hooks in Symfony | +-----------------------------------+---------------------------------------------------------------------------+ +| `kernel.fragment_renderer`_ | Add new HTTP content rendering strategies | ++-----------------------------------+---------------------------------------------------------------------------+ | `monolog.logger`_ | Logging with a custom logging channel | +-----------------------------------+---------------------------------------------------------------------------+ | `monolog.processor`_ | Add a custom processor for logging | @@ -354,6 +356,13 @@ configuration, and tag it with ``kernel.event_subscriber``: If your service is created by a factory, you **MUST** correctly set the ``class`` parameter for this tag to work correctly. +.. _dic-tags-kernel-fragment-renderer: + +kernel.fragment_renderer +----------------------- + +**Purpose**: Add new HTTP content rendering strategies + .. _dic_tags-monolog: monolog.logger From 2f271a69e7b5cb983236dcb4ed39b7e6b5c6cb4d Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Sun, 31 Mar 2013 20:51:30 +0200 Subject: [PATCH 0146/2078] [Cookbook] Remove deprectated call to PropertyPath --- cookbook/form/create_form_type_extension.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cookbook/form/create_form_type_extension.rst b/cookbook/form/create_form_type_extension.rst index e6ac99b922d..e6cb3593508 100644 --- a/cookbook/form/create_form_type_extension.rst +++ b/cookbook/form/create_form_type_extension.rst @@ -194,7 +194,7 @@ it in the view:: use Symfony\Component\Form\AbstractTypeExtension; use Symfony\Component\Form\FormView; use Symfony\Component\Form\FormInterface; - use Symfony\Component\Form\Util\PropertyPath; + use Symfony\Component\PropertyAccess\PropertyAccess; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class ImageTypeExtension extends AbstractTypeExtension @@ -232,8 +232,8 @@ it in the view:: $parentData = $form->getParent()->getData(); if (null !== $parentData) { - $propertyPath = new PropertyPath($options['image_path']); - $imageUrl = $propertyPath->getValue($parentData); + $accessor = PropertyAccess::getPropertyAccessor(); + $imageUrl = $accessor->getValue($parentData, $options['image_path']); } else { $imageUrl = null; } From 5f0aba7acd2ec51220bdb4e812fa0171ac5a1641 Mon Sep 17 00:00:00 2001 From: Dan Finnie Date: Sun, 31 Mar 2013 15:33:49 -0400 Subject: [PATCH 0147/2078] [SecurityBundle] Document multiple IP matching in rules --- book/security.rst | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/book/security.rst b/book/security.rst index 12c7dfd998e..7d9ecf0ef63 100644 --- a/book/security.rst +++ b/book/security.rst @@ -770,7 +770,7 @@ access control should be used on this request. The following ``access_control`` options are used for matching: * ``path`` -* ``ip`` +* ``ip`` or ``ips`` * ``host`` * ``methods`` @@ -877,6 +877,11 @@ prevent any direct access to these resources from a web browser (by guessing the ESI URL pattern), the ESI route **must** be secured to be only visible from the trusted reverse proxy cache. +.. versionadded:: 2.3 + Version 2.3 allows multiple IP addresses in a single rule with the ``ips: [a, b]`` + construct. Prior to 2.3, users should create one rule per IP address to match and + use the ``ip`` key instead of ``ips``. + Here is an example of how you might secure all ESI routes that start with a given prefix, ``/esi``, from outside access: @@ -888,20 +893,20 @@ given prefix, ``/esi``, from outside access: security: # ... access_control: - - { path: ^/esi, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 } + - { path: ^/esi, roles: IS_AUTHENTICATED_ANONYMOUSLY, ips: [127.0.0.1, ::1] } - { path: ^/esi, roles: ROLE_NO_ACCESS } .. code-block:: xml - + .. code-block:: php 'access_control' => array( - array('path' => '^/esi', 'role' => 'IS_AUTHENTICATED_ANONYMOUSLY', 'ip' => '127.0.0.1'), + array('path' => '^/esi', 'role' => 'IS_AUTHENTICATED_ANONYMOUSLY', 'ips' => '127.0.0.1, ::1'), array('path' => '^/esi', 'role' => 'ROLE_NO_ACCESS'), ), @@ -909,7 +914,7 @@ Here is how it works when the path is ``/esi/something`` coming from the ``10.0.0.1`` IP: * The first access control rule is ignored as the ``path`` matches but the - ``ip`` does not; + ``ip`` does not match either of the IPs listed; * The second access control rule is enabled (the only restriction being the ``path`` and it matches): as the user cannot have the ``ROLE_NO_ACCESS`` @@ -917,7 +922,8 @@ Here is how it works when the path is ``/esi/something`` coming from the be anything that does not match an existing role, it just serves as a trick to always deny access). -Now, if the same request comes from ``127.0.0.1``: +Now, if the same request comes from ``127.0.0.1`` or ``::1`` (the IPv6 loopback +address): * Now, the first access control rule is enabled as both the ``path`` and the ``ip`` match: access is allowed as the user always has the From 97ac8eb0aafb751609d71b906f2939a7a6649eae Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 31 Mar 2013 16:20:43 -0500 Subject: [PATCH 0148/2078] [#2355] Moving message about the _method activation --- cookbook/routing/method_parameters.rst | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cookbook/routing/method_parameters.rst b/cookbook/routing/method_parameters.rst index e2c261cb0f5..5446b051f68 100644 --- a/cookbook/routing/method_parameters.rst +++ b/cookbook/routing/method_parameters.rst @@ -4,11 +4,6 @@ How to use HTTP Methods beyond GET and POST in Routes ===================================================== -.. versionadded:: 2.2 - This functionality is disabled by default in Symfony 2.2. To enable it, - you must call :method:`Request::enableHttpMethodParameterOverride ` - before you handle the request. - The HTTP method of a request is one of the requirements that can be checked when seeing if it matches a route. This is introduced in the routing chapter of the book ":doc:`/book/routing`" with examples using GET and POST. You can @@ -76,6 +71,15 @@ delete it by matching on GET, PUT and DELETE. return $collection; +Faking the Method with _method +------------------------------ + +.. note:: + + The ``_method`` functionality shown here is disabled by default in Symfony 2.2. + To enable it, you must call :method:`Request::enableHttpMethodParameterOverride ` + before you handle the request (e.g. in your front controller). + Unfortunately, life isn't quite this simple, since most browsers do not support sending PUT and DELETE requests. Fortunately Symfony2 provides you with a simple way of working around this limitation. By including a ``_method`` From 647fd97bee4e20620e818ed1e8de560cbd633852 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 31 Mar 2013 16:49:43 -0500 Subject: [PATCH 0149/2078] [#2355] Updating note about _method activation for 2.3 --- cookbook/routing/method_parameters.rst | 8 +++++--- reference/configuration/framework.rst | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cookbook/routing/method_parameters.rst b/cookbook/routing/method_parameters.rst index 5446b051f68..f0360e7e87f 100644 --- a/cookbook/routing/method_parameters.rst +++ b/cookbook/routing/method_parameters.rst @@ -76,9 +76,11 @@ Faking the Method with _method .. note:: - The ``_method`` functionality shown here is disabled by default in Symfony 2.2. - To enable it, you must call :method:`Request::enableHttpMethodParameterOverride ` - before you handle the request (e.g. in your front controller). + The ``_method`` functionality shown here is disabled by default in Symfony 2.2 + and enabled by default in Symfony 2.3. To control it in Symfony 2.2, you + must call :method:`Request::enableHttpMethodParameterOverride ` + before you handle the request (e.g. in your front controller). In Symfony + 2.3, use the :ref:`configuration-framework-http_method_override` option. Unfortunately, life isn't quite this simple, since most browsers do not support sending PUT and DELETE requests. Fortunately Symfony2 provides you diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 30f5f88c4ce..79ced25beba 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -52,6 +52,8 @@ it's used for generating the CSRF tokens, but it could be used in any other context where having a unique string is useful. It becomes the service container parameter named ``kernel.secret``. +.. _configuration-framework-http_method_override: + http_method_override ~~~~~~~~~~~~~~~~~~~~ From 224d01d66153262d34000ec7fa304590b717a7a0 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Mon, 1 Apr 2013 12:38:31 +0200 Subject: [PATCH 0150/2078] Fixed 'WARNING: unknown document: /components/dependency_injection/parameter' --- components/map.rst.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/map.rst.inc b/components/map.rst.inc index cb32c7bd7fa..00b04ee21e3 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -26,7 +26,7 @@ * :doc:`/components/dependency_injection/introduction` * :doc:`/components/dependency_injection/types` - * :doc:`/components/dependency_injection/parameter` + * :doc:`/components/dependency_injection/parameters` * :doc:`/components/dependency_injection/definitions` * :doc:`/components/dependency_injection/compilation` * :doc:`/components/dependency_injection/tags` From cf5683acfebc2223f9115cf44ecf5436c6b6a24b Mon Sep 17 00:00:00 2001 From: Max Beutel Date: Wed, 3 Apr 2013 10:25:23 +0200 Subject: [PATCH 0151/2078] [TwigBundle] document new autoescape features --- reference/configuration/twig.rst | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst index 5977ce092fb..13378f14e7a 100644 --- a/reference/configuration/twig.rst +++ b/reference/configuration/twig.rst @@ -31,14 +31,16 @@ TwigBundle Configuration Reference # set to service or leave blank type: ~ value: ~ - autoescape: ~ - base_template_class: ~ # Example: Twig_Template - cache: "%kernel.cache_dir%/twig" - charset: "%kernel.charset%" - debug: "%kernel.debug%" - strict_variables: ~ - auto_reload: ~ - optimizations: ~ + autoescape: ~ + autoescape_service: ~ # Example: @my_service + autoescape_service_method: ~ # use in combination with autoescape_service option + base_template_class: ~ # Example: Twig_Template + cache: "%kernel.cache_dir%/twig" + charset: "%kernel.charset%" + debug: "%kernel.debug%" + strict_variables: ~ + auto_reload: ~ + optimizations: ~ .. code-block:: xml From 615a7b3f32b374cf87c7e71deb200767bd92c790 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 3 Apr 2013 21:10:59 -0500 Subject: [PATCH 0152/2078] [#2416] Proofreading the new BinaryFileResponse and talking about X-Sendfile --- book/controller.rst | 2 +- components/http_foundation/introduction.rst | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 420b9bda487..c7c5a7fa3d8 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -731,7 +731,7 @@ headers and content that's sent back to the client:: - For JSON, there is :class:`Symfony\\Component\\HttpFoundation\\JsonResponse`. See :ref:`component-http-foundation-json-response`. - For files, there is :class:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse`. - See :ref:`component-http-foundation-serving-files + See :ref:`component-http-foundation-serving-files`. .. index:: single: Controller; Request object diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 39cb290b627..b1ebf89edd4 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -439,8 +439,15 @@ Alternatively, if you are serving a static file, you can use a $response = new BinaryFileResponse($file); The ``BinaryFileResponse`` will automatically handle ``Range`` and -``If-Range`` headers from the request. You can also set the ``Content-Type`` -of the sent file, or change its ``Content-Disposition``:: +``If-Range`` headers from the request. It also supports ``X-Sendfile`` +(see for `Nginx`_ and `Apache`_). To make use of it, you need to determine +whether or not the ``X-Sendfile-Type`` header should be trusted and call +:method:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse::trustXSendfileTypeHeader` +if it should:: + + $response::trustXSendfileTypeHeader(); + +You can still set the ``Content-Type`` of the sent file, or change its ``Content-Disposition``:: $response->headers->set('Content-Type', 'text/plain') $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'filename.txt'); @@ -496,3 +503,5 @@ Session The session information is in its own document: :doc:`/components/http_foundation/sessions`. .. _Packagist: https://packagist.org/packages/symfony/http-foundation +.. _Nginx: http://wiki.nginx.org/XSendfile +.. _Apache: https://tn123.org/mod_xsendfile/ From 8e66c0422eefa117dc97fd477b3b1b5af93cc3fc Mon Sep 17 00:00:00 2001 From: Kevin Weber Date: Sat, 30 Mar 2013 14:57:08 -0400 Subject: [PATCH 0153/2078] Missing version number on "versionadded" function. --- book/routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/routing.rst b/book/routing.rst index 8e77a607268..612e534b0c0 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -681,7 +681,7 @@ be accomplished with the following route configuration: return $collection; -.. versionadded:: +.. versionadded:: 2.2 The ``methods`` option is added in Symfony2.2. Use the ``_method`` requirement in older versions. From 4c9b68940214eb09cd7195787757bf5488598d99 Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Fri, 15 Mar 2013 18:28:15 +0100 Subject: [PATCH 0154/2078] Added documentation for the Intl component --- components/index.rst | 2 +- components/intl.rst | 517 +++++++++++++++++++++++++++++++++++++++++ components/locale.rst | 72 ------ components/map.rst.inc | 4 +- 4 files changed, 520 insertions(+), 75 deletions(-) create mode 100644 components/intl.rst delete mode 100644 components/locale.rst diff --git a/components/index.rst b/components/index.rst index 8b4abe24f8d..7eed4559c83 100644 --- a/components/index.rst +++ b/components/index.rst @@ -16,7 +16,7 @@ The Components finder http_foundation/index http_kernel/index - locale + intl process property_access/index routing/index diff --git a/components/intl.rst b/components/intl.rst new file mode 100644 index 00000000000..d5ceb76b6cb --- /dev/null +++ b/components/intl.rst @@ -0,0 +1,517 @@ +.. index:: + single: Intl + single: Components; Intl + +The Intl Component +================== + + A PHP replacement layer for the C `intl extension`_ that includes additional + data from the ICU library. + +.. note:: + + The replacement layer is limited to the locale "en". If you want to use + other locales, you should `install the intl extension`_ instead. + +Installation +------------ + +You can install the component in two different ways: + +* Using the official Git repository (https://github.com/symfony/Intl); +* :doc:`Install it via Composer` (``symfony/intl`` on `Packagist`_). + +If you install the component via Composer, the following classes and functions +of the intl extension will be automatically provided if the intl extension is +not loaded: + +* :phpclass:``Collator`` +* :phpclass:``IntlDateFormatter`` +* :phpclass:``Locale`` +* :phpclass:``NumberFormatter`` +* :phpfunction:``intl_error_name`` +* :phpfunction:``intl_is_failure`` +* :phpfunction:``intl_get_error_code`` +* :phpfunction:``intl_get_error_message`` + +If you don't use Composer but the Symfony ClassLoader component, you need to +load them manually by adding the following lines to your autoload code:: + + if (!function_exists('intl_is_failure')) { + require '/path/to/Icu/Resources/stubs/functions.php'; + + $loader->registerPrefixFallback('/path/to/Icu/Resources/stubs'); + } + +The component provides replacements for the following functions and classes: + +.. note:: + + The stub implementation only supports the locale ``en``. + +Stubbed Classes +--------------- + +The stubbed classes of the intl extension are limited to the locale "en" and +will throw an exception if you try to use a different locale. For using other +locales, `install the intl extension`_ instead. + +Locale +~~~~~~ + +The only method supported in the :phpclass:``Locale`` class is +:phpmethod:`Locale::getDefault`. This method will always return "en". All other +methods will throw an exception when used. + +NumberFormatter +~~~~~~~~~~~~~~~ + +Numbers can be formatted with the :phpclass:``NumberFormatter`` class. +The following methods are supported. All other methods are not supported and +will throw an exception when used. + +.. _`NumberFormatter::__construct()`: + +\__construct($locale = $style = null, $pattern = null) +...................................................... + +The only supported locale is "en". The supported styles are +``NumberFormatter::DECIMAL`` and ``NumberFormatter::CURRENCY``. The argument +``$pattern`` may not be used. + +::create($locale = $style = null, $pattern = null) +.................................................. + +See `NumberFormatter::__construct()`_. + +formatCurrency($value, $currency) +................................. + +Fully supported. + +format($value, $type = NumberFormatter::TYPE_DEFAULT) +..................................................... + +Only type ``NumberFormatter::TYPE_DEFAULT`` is supported. + +getAttribute($attr) +................... + +Fully supported. + +getErrorCode() +.............. + +Fully supported. + +getErrorMessage() +................. + +Fully supported. + +getLocale($type = Locale::ACTUAL_LOCALE) +........................................ + +The parameter ``$type`` is ignored. + +parse($value, $type = NumberFormatter::TYPE_DOUBLE, &$position = null) +...................................................................... + +The supported types are ``NumberFormatter::TYPE_DOUBLE``, +``NumberFormatter::TYPE_INT32`` and ``NumberFormatter::TYPE_INT64``. The +parameter ``$position`` must always be ``null``. + +setAttribute($attr, $value) +........................... + +The only supported attributes are ``NumberFormatter::FRACTION_DIGITS``, +``NumberFormatter::GROUPING_USED`` and ``NumberFormatter::ROUNDING_MODE``. + +The only supported rounding modes are ``NumberFormatter::ROUND_HALFEVEN``, +``NumberFormatter::ROUND_HALFDOWN`` and ``NumberFormatter::ROUND_HALFUP``. + +IntlDateFormatter +~~~~~~~~~~~~~~~~~ + +Dates can be formatted with the :phpclass:`IntlDateFormatter` class. The +following methods are supported. All other methods are not supported and will +throw an exception when used. + +.. _`IntlDateFormatter::__construct()`: + +\__construct($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null) +........................................................................................................................ + +The only supported locale is "en". The parameter ``$calendar`` can only be +``IntlDateFormatter::GREGORIAN``. + +::create($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null) +.................................................................................................................... + +See `IntlDateFormatter::__construct()`_. + +format($timestamp) +.................. + +Fully supported. + +getCalendar() +............. + +Fully supported. + +getDateType() +............. + +Fully supported. + +getErrorCode() +.............. + +Fully supported. + +getErrorMessage() +................. + +Fully supported. + +getLocale($type = Locale::ACTUAL_LOCALE) +........................................ + +The parameter ``$type`` is ignored. + +getPattern() +............ + +Fully supported. + +getTimeType() +............. + +Fully supported. + +getTimeZoneId() +............... + +Fully supported. + +isLenient() +........... + +Always returns ``false``. + +parse($value, &$position = null) +................................ + +The parameter ``$position`` must always be ``null``. + +setLenient($lenient) +.................... + +Only accepts ``false``. + +setPattern($pattern) +.................... + +Fully supported. + +setTimeZoneId($timeZoneId) +.......................... + +Fully supported. + +setTimeZone($timeZone) +...................... + +Fully supported. + +Collator +~~~~~~~~ + +Localized strings can be sorted with the :phpclass:`\Collator` class. The +following methods are supported. All other methods are not supported and will +throw an exception when used. + +.. _`Collator::__construct()`: + +\__construct($locale) +..................... + +The only supported locale is "en". + +create($locale) +............... + +See `Collator::__construct()`_. + +asort(&$array, $sortFlag = Collator::SORT_REGULAR) +.................................................. + +Fully supported. + +getErrorCode() +.............. + +Fully supported. + +getErrorMessage() +................. + +Fully supported. + +getLocale($type = Locale::ACTUAL_LOCALE) +........................................ + +The parameter ``$type`` is ignored. + +ResourceBundle +~~~~~~~~~~~~~~ + +The :phpclass:`ResourceBundle` class is not and will not be supported. Instead, +this component ships a set of readers and writers for reading and writing arrays +(or array-like objects) from/to resource bundle files. The following classes +are supported: + +TextBundleWriter +................ + +Writes an array or an array-like object to a plain text resource bundle. The +resulting .txt file can be converted to a binary .res file with the +:class:`Symfony\\Component\\Intl\\ResourceBundle\\Compiler\\BundleCompiler` +class:: + + use Symfony\Component\Intl\ResourceBundle\Writer\TextBundleWriter; + use Symfony\Component\Intl\ResourceBundle\Compiler\BundleCompiler; + + $writer = new TextBundleWriter(); + $writer->write('/path/to/bundle', 'en', array( + 'Data' => array( + 'entry1', + 'entry2', + ... + ), + )); + + $compiler = new BundleCompiler(); + $compiler->compile('/path/to/bundle', '/path/to/binary/bundle'); + +The command "genrb" must be available for the +:class:`Symfony\\Component\\Intl\\ResourceBundle\\Compiler\\BundleCompiler` to +work. If the command is located in a non-standard location, you can pass its +path to the +:class:`Symfony\\Component\\Intl\\ResourceBundle\\Compiler\\BundleCompiler` +constructor. + +PhpBundleWriter +~~~~~~~~~~~~~~~ + +Writes an array or an array-like object to a .php resource bundle:: + + use Symfony\Component\Intl\ResourceBundle\Writer\PhpBundleWriter; + + $writer = new PhpBundleWriter(); + $writer->write('/path/to/bundle', 'en', array( + 'Data' => array( + 'entry1', + 'entry2', + ... + ), + )); + +BinaryBundleReader +~~~~~~~~~~~~~~~~~~ + +Reads binary resource bundle files and returns an array or an array-like object. +This class currently only works with the `intl extension`_ installed:: + + use Symfony\Component\Intl\ResourceBundle\Reader\BinaryBundleReader; + + $reader = new BinaryBundleReader(); + $data = $reader->read('/path/to/bundle', 'en'); + + echo $data['Data']['entry1']; + +PhpBundleReader +~~~~~~~~~~~~~~~ + +Reads resource bundles from .php files and returns an array or an array-like +object:: + + use Symfony\Component\Intl\ResourceBundle\Reader\PhpBundleReader; + + $reader = new PhpBundleReader(); + $data = $reader->read('/path/to/bundle', 'en'); + + echo $data['Data']['entry1']; + +BufferedBundleReader +~~~~~~~~~~~~~~~~~~~~ + +Wraps another reader, but keeps the last N reads in a buffer, where N is a +buffer size passed to the constructor:: + + use Symfony\Component\Intl\ResourceBundle\Reader\BinaryBundleReader; + use Symfony\Component\Intl\ResourceBundle\Reader\BufferedBundleReader; + + $reader = new BufferedBundleReader(new BinaryBundleReader(), 10); + + // actually reads the file + $data = $reader->read('/path/to/bundle', 'en'); + + // returns data from the buffer + $data = $reader->read('/path/to/bundle', 'en'); + + // actually reads the file + $data = $reader->read('/path/to/bundle', 'fr'); + +StructuredBundleReader +~~~~~~~~~~~~~~~~~~~~~~ + +Wraps another reader and offers a +:method:`Symfony\\Component\\Intl\\ResourceBundle\\Reader\\StructuredBundleReaderInterface::readEntry` +method for reading an entry of the resource bundle without having to worry +whether array keys are set or not. If a path cannot be resolved, ``null`` is +returned:: + + use Symfony\Component\Intl\ResourceBundle\Reader\BinaryBundleReader; + use Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReader; + + $reader = new StructuredBundleReader(new BinaryBundleReader()); + + $data = $reader->read('/path/to/bundle', 'en'); + + // Produces an error if the key "Data" does not exist + echo $data['Data']['entry1']; + + // Returns null if the key "Data" does not exist + echo $reader->readEntry('/path/to/bundle', 'en', array('Data', 'entry1')); + +Additionally, the +:method:`Symfony\\Component\\Intl\\ResourceBundle\\Reader\\StructuredBundleReaderInterface::readEntry` +method resolves fallback locales. For example, the fallback locale of "en_GB" is +"en". For single-valued entries (strings, numbers etc.), the entry will be read +from the fallback locale if it cannot be found in the more specific locale. For +multi-valued entries (arrays), the values of the more specific and the fallback +locale will be merged. In order to suppress this behavior, the last parameter +``$fallback`` can be set to ``false``:: + + echo $reader->readEntry('/path/to/bundle', 'en', array('Data', 'entry1'), false); + +Included Resource Bundles +------------------------- + +The ICU data is located in several "resource bundles". You can access a PHP +wrapper of these bundles through the static +:class:`Symfony\\Component\\Intl\\Intl` class. + +Languages and Scripts +~~~~~~~~~~~~~~~~~~~~~ + +The translations of language and script names can be found in the language +bundle:: + + use Symfony\Component\Intl\Intl; + + \Locale::setDefault('en'); + + $languages = Intl::getLanguageBundle()->getLanguageNames(); + // => array('ab' => 'Abkhazian', ...) + + $language = Intl::getLanguageBundle()->getLanguageName('de'); + // => 'German' + + $language = Intl::getLanguageBundle()->getLanguageName('de', 'AT'); + // => 'Austrian German' + + $scripts = Intl::getLanguageBundle()->getScriptNames(); + // => array('Arab' => 'Arabic', ...) + + $script = Intl::getLanguageBundle()->getScriptName('Hans'); + // => 'Simplified' + +All methods accept the translation locale as last, optional parameter, which +defaults to the current default locale:: + + $languages = Intl::getLanguageBundle()->getLanguageNames('de'); + // => array('ab' => 'Abchasisch', ...) + +Countries +~~~~~~~~~ + +The translations of country names can be found in the region bundle:: + + use Symfony\Component\Intl\Intl; + + \Locale::setDefault('en'); + + $countries = Intl::getRegionBundle()->getCountryNames(); + // => array('AF' => 'Afghanistan', ...) + + $country = Intl::getRegionBundle()->getCountryName('GB'); + // => 'United Kingdom' + +All methods accept the translation locale as last, optional parameter, which +defaults to the current default locale:: + + $countries = Intl::getRegionBundle()->getCountryNames('de'); + // => array('AF' => 'Afghanistan', ...) + +Locales +~~~~~~~ + +The translations of locale names can be found in the locale bundle:: + + use Symfony\Component\Intl\Intl; + + \Locale::setDefault('en'); + + $locales = Intl::getLocaleBundle()->getLocaleNames(); + // => array('af' => 'Afrikaans', ...) + + $locale = Intl::getLocaleBundle()->getLocaleName('zh_Hans_MO'); + // => 'Chinese (Simplified, Macau SAR China)' + +All methods accept the translation locale as last, optional parameter, which +defaults to the current default locale:: + + $locales = Intl::getLocaleBundle()->getLocaleNames('de'); + // => array('af' => 'Afrikaans', ...) + +Currencies +~~~~~~~~~~ + +The translations of currency names and other currency-related information can +be found in the currency bundle:: + + use Symfony\Component\Intl\Intl; + + \Locale::setDefault('en'); + + $currencies = Intl::getCurrencyBundle()->getCurrencyNames(); + // => array('AFN' => 'Afghan Afghani', ...) + + $currency = Intl::getCurrencyBundle()->getCurrencyName('INR'); + // => 'Indian Rupee' + + $symbol = Intl::getCurrencyBundle()->getCurrencySymbol('INR'); + // => '₹' + + $fractionDigits = Intl::getCurrencyBundle()->getFractionDigits('INR'); + // => 2 + + $roundingIncrement = Intl::getCurrencyBundle()->getRoundingIncrement('INR'); + // => 0 + +All methods (except for +:method:`Symfony\\Component\\Intl\\ResourceBundle\\CurrencyBundleInterface::getFractionDigits` +and +:method:`Symfony\\Component\\Intl\\ResourceBundle\\CurrencyBundleInterface::getRoundingIncrement()`) +accept the translation locale as last, optional parameter, which defaults to the +current default locale:: + + $currencies = Intl::getCurrencyBundle()->getCurrencyNames('de'); + // => array('AFN' => 'Afghanische Afghani', ...) + +.. _Packagist: https://packagist.org/packages/symfony/locale +.. _intl extension: http://www.php.net/manual/en/book.intl.php +.. _install the intl extension: http://www.php.net/manual/en/intl.setup.php diff --git a/components/locale.rst b/components/locale.rst deleted file mode 100644 index 526a97221c8..00000000000 --- a/components/locale.rst +++ /dev/null @@ -1,72 +0,0 @@ -.. index:: - single: Locale - single: Components; Locale - -The Locale Component -==================== - - Locale component provides fallback code to handle cases when the ``intl`` extension is missing. - Additionally it extends the implementation of a native :phpclass:`Locale` class with several handy methods. - -Replacement for the following functions and classes is provided: - -* :phpfunction:`intl_is_failure` -* :phpfunction:`intl_get_error_code` -* :phpfunction:`intl_get_error_message` -* :phpclass:`Collator` -* :phpclass:`IntlDateFormatter` -* :phpclass:`Locale` -* :phpclass:`NumberFormatter` - -.. note:: - - Stub implementation only supports the ``en`` locale. - -Installation ------------- - -You can install the component in many different ways: - -* Use the official Git repository (https://github.com/symfony/Locale); -* :doc:`Install it via Composer` (``symfony/locale`` on `Packagist`_). - -Usage ------ - -Taking advantage of the fallback code includes requiring function stubs and adding class stubs to the autoloader. - -When using the ClassLoader component following code is sufficient to supplement missing ``intl`` extension: - -.. code-block:: php - - if (!function_exists('intl_get_error_code')) { - require __DIR__.'/path/to/src/Symfony/Component/Locale/Resources/stubs/functions.php'; - - $loader->registerPrefixFallbacks( - array(__DIR__.'/path/to/src/Symfony/Component/Locale/Resources/stubs') - ); - } - -:class:`Symfony\\Component\\Locale\\Locale` class enriches native :phpclass:`Locale` class with additional features: - -.. code-block:: php - - use Symfony\Component\Locale\Locale; - - // Get the country names for a locale or get all country codes - $countries = Locale::getDisplayCountries('pl'); - $countryCodes = Locale::getCountries(); - - // Get the language names for a locale or get all language codes - $languages = Locale::getDisplayLanguages('fr'); - $languageCodes = Locale::getLanguages(); - - // Get the locale names for a given code or get all locale codes - $locales = Locale::getDisplayLocales('en'); - $localeCodes = Locale::getLocales(); - - // Get ICU versions - $icuVersion = Locale::getIntlIcuVersion(); - $icuDataVersion = Locale::getIcuDataVersion(); - -.. _Packagist: https://packagist.org/packages/symfony/locale diff --git a/components/map.rst.inc b/components/map.rst.inc index f16a8e874b2..120831c3336 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -67,9 +67,9 @@ * :doc:`/components/http_kernel/introduction` -* **Locale** +* **Intl** - * :doc:`/components/locale` + * :doc:`/components/intl` * **Process** From cfea9507552cd1ac173c5cc98ad313566b6652b7 Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Sun, 17 Mar 2013 13:26:05 +0100 Subject: [PATCH 0155/2078] Fixed quirks in the Intl documentation --- components/intl.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/components/intl.rst b/components/intl.rst index d5ceb76b6cb..51a25a3ffa2 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -25,14 +25,14 @@ If you install the component via Composer, the following classes and functions of the intl extension will be automatically provided if the intl extension is not loaded: -* :phpclass:``Collator`` -* :phpclass:``IntlDateFormatter`` -* :phpclass:``Locale`` -* :phpclass:``NumberFormatter`` -* :phpfunction:``intl_error_name`` -* :phpfunction:``intl_is_failure`` -* :phpfunction:``intl_get_error_code`` -* :phpfunction:``intl_get_error_message`` +* :phpclass:`Collator` +* :phpclass:`IntlDateFormatter` +* :phpclass:`Locale` +* :phpclass:`NumberFormatter` +* :phpfunction:`intl_error_name` +* :phpfunction:`intl_is_failure` +* :phpfunction:`intl_get_error_code` +* :phpfunction:`intl_get_error_message` If you don't use Composer but the Symfony ClassLoader component, you need to load them manually by adding the following lines to your autoload code:: @@ -59,14 +59,14 @@ locales, `install the intl extension`_ instead. Locale ~~~~~~ -The only method supported in the :phpclass:``Locale`` class is +The only method supported in the :phpclass:`Locale` class is :phpmethod:`Locale::getDefault`. This method will always return "en". All other methods will throw an exception when used. NumberFormatter ~~~~~~~~~~~~~~~ -Numbers can be formatted with the :phpclass:``NumberFormatter`` class. +Numbers can be formatted with the :phpclass:`NumberFormatter` class. The following methods are supported. All other methods are not supported and will throw an exception when used. @@ -288,7 +288,7 @@ class:: 'Data' => array( 'entry1', 'entry2', - ... + // ... ), )); @@ -314,7 +314,7 @@ Writes an array or an array-like object to a .php resource bundle:: 'Data' => array( 'entry1', 'entry2', - ... + // ... ), )); From 5921a7b8783a5c3d99af90ed5a10d5f8f77ea07e Mon Sep 17 00:00:00 2001 From: Drak Date: Sat, 6 Apr 2013 18:59:10 +0100 Subject: [PATCH 0156/2078] Document PhpSessionStorage --- .../http_foundation/session_php_legacy.rst | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 components/http_foundation/session_php_legacy.rst diff --git a/components/http_foundation/session_php_legacy.rst b/components/http_foundation/session_php_legacy.rst new file mode 100644 index 00000000000..2cb19c7d2be --- /dev/null +++ b/components/http_foundation/session_php_legacy.rst @@ -0,0 +1,40 @@ +.. index:: + single: HTTP + single: HttpFoundation, Sessions + +Integrating with legacy sessions +================================ + +Sometimes it may be necessary to integrate Symfony into a legacy application +where you do not initially have the level of control you require. + +As stated elsewhere, Symfony Sessions are designed to replace the use of +PHP's native `session_*()` functions and use of the `$_SESSION` +superglobal. Additionally, it is mandatory for Symfony to start the session. + +However when there really are circumstances where this is not possible, it is possible +to use a special storage bridge +:class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\PhpSessionStorage` +which is designed to allow Symfony to work with a session started outside of +the Symfony Session framework. You are warned that things can interrupt this +use case unless you are careful: for example legacy application erases `$_SESSION`. + +Typical use of this might look as follows:: + + start(); + +This will allow you to start using the Symfony Session API and allow +migration of your application to Symfony Sessions. \ No newline at end of file From 043773381c07b7be0879c87cff8c0c24cc5a0fb4 Mon Sep 17 00:00:00 2001 From: Drak Date: Sat, 6 Apr 2013 19:13:33 +0100 Subject: [PATCH 0157/2078] Update index --- components/http_foundation/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/components/http_foundation/index.rst b/components/http_foundation/index.rst index 9937c960776..c638e784903 100644 --- a/components/http_foundation/index.rst +++ b/components/http_foundation/index.rst @@ -8,4 +8,5 @@ HTTP Foundation sessions session_configuration session_testing + session_php_legacy trusting_proxies From 5f415702c99c945a21810f8b36431874897babec Mon Sep 17 00:00:00 2001 From: Drak Date: Sat, 6 Apr 2013 19:50:03 +0100 Subject: [PATCH 0158/2078] Document start on demand feature. --- .../http_foundation/session_configuration.rst | 37 ++++++++++++++++++- reference/configuration/framework.rst | 4 ++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index f445f740b76..df0ab84ed6e 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -79,7 +79,7 @@ examples if you wish to write your own. Example usage:: use Symfony\Component\HttpFoundation\Session\Session; - use Symfony\Component\HttpFoundation\Session\Storage\SessionStorage; + use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler; $storage = new NativeSessionStorage(array(), new PdoSessionHandler()); @@ -217,6 +217,41 @@ particular cookie by reading the ``getLifetime()`` method:: The expiry time of the cookie can be determined by adding the created timestamp and the lifetime. +Session start-on-demand +~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 2.3 + Control over session "start-on-demand" was added in Symfony 2.3. + +In versions 2.1-2.2, Symfony Sessions automatically invoked `$session->start()` when +any attempt was made to access session data (effectively 'start on demand'). +From Symfony 2.3 this behaviour can be controlled. + +There are three modes defined by :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface` + +The settings are as follows: + + - `SessionStorageInterface::NO_START_ON_DEMAND_STRICT` - The session will not be started on demand + and any attempt to read or write session data will result in a `\RuntimeException` + - `SessionStorageInterface::START_ON_DEMAND` - The session will be started if it hasn't already been + when any attempt is made to read ro write session data. + - `SessionStorageInterface::NO_START_ON_DEMAND_LAX` - The sessions will not be started on demand + when session data is read or written to. It will allow access to the unitialized `BagInterface`. + If this session is subsequently started manually after data is written to a `BagInterface` will + be overwritten (by the session data read from persistence). + +You can configure these by injecting a configured storage engine into the session:: + + Date: Sat, 6 Apr 2013 20:02:49 +0100 Subject: [PATCH 0159/2078] Correct markup --- .../http_foundation/session_configuration.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index df0ab84ed6e..d92bd8fe300 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -223,7 +223,7 @@ Session start-on-demand .. versionadded:: 2.3 Control over session "start-on-demand" was added in Symfony 2.3. -In versions 2.1-2.2, Symfony Sessions automatically invoked `$session->start()` when +In versions 2.1-2.2, Symfony Sessions automatically invoked ``$session->start()`` when any attempt was made to access session data (effectively 'start on demand'). From Symfony 2.3 this behaviour can be controlled. @@ -231,13 +231,13 @@ There are three modes defined by :class:`Symfony\\Component\\HttpFoundation\\Ses The settings are as follows: - - `SessionStorageInterface::NO_START_ON_DEMAND_STRICT` - The session will not be started on demand - and any attempt to read or write session data will result in a `\RuntimeException` - - `SessionStorageInterface::START_ON_DEMAND` - The session will be started if it hasn't already been + - ``SessionStorageInterface::NO_START_ON_DEMAND_STRICT`` - The session will not be started on demand + and any attempt to read or write session data will result in a ``\RuntimeException`` + - ``SessionStorageInterface::START_ON_DEMAND`` - The session will be started if it hasn't already been when any attempt is made to read ro write session data. - - `SessionStorageInterface::NO_START_ON_DEMAND_LAX` - The sessions will not be started on demand - when session data is read or written to. It will allow access to the unitialized `BagInterface`. - If this session is subsequently started manually after data is written to a `BagInterface` will + - ``SessionStorageInterface::NO_START_ON_DEMAND_LAX`` - The sessions will not be started on demand + when session data is read or written to. It will allow access to the unitialized ``BagInterface``. + If this session is subsequently started manually after data is written to a ``BagInterface`` will be overwritten (by the session data read from persistence). You can configure these by injecting a configured storage engine into the session:: From 67a5ecde4ba541f82a222cd64bcf1a1a6629433e Mon Sep 17 00:00:00 2001 From: Drak Date: Sat, 6 Apr 2013 20:08:35 +0100 Subject: [PATCH 0160/2078] Added nortes as per @stof's recommendation. --- components/http_foundation/session_php_legacy.rst | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/components/http_foundation/session_php_legacy.rst b/components/http_foundation/session_php_legacy.rst index 2cb19c7d2be..1950785ab53 100644 --- a/components/http_foundation/session_php_legacy.rst +++ b/components/http_foundation/session_php_legacy.rst @@ -9,7 +9,7 @@ Sometimes it may be necessary to integrate Symfony into a legacy application where you do not initially have the level of control you require. As stated elsewhere, Symfony Sessions are designed to replace the use of -PHP's native `session_*()` functions and use of the `$_SESSION` +PHP's native ``session_*()`` functions and use of the ``$_SESSION`` superglobal. Additionally, it is mandatory for Symfony to start the session. However when there really are circumstances where this is not possible, it is possible @@ -17,7 +17,7 @@ to use a special storage bridge :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\PhpSessionStorage` which is designed to allow Symfony to work with a session started outside of the Symfony Session framework. You are warned that things can interrupt this -use case unless you are careful: for example legacy application erases `$_SESSION`. +use case unless you are careful: for example legacy application erases ``$_SESSION``. Typical use of this might look as follows:: @@ -37,4 +37,13 @@ Typical use of this might look as follows:: $session->start(); This will allow you to start using the Symfony Session API and allow -migration of your application to Symfony Sessions. \ No newline at end of file +migration of your application to Symfony Sessions. + +.. note:: + +Symfony Sessions store data like attributes in special 'Bags' which use a +key in the ``$_SESSION`` superglobal. This means that a Symfony Session +cannot access arbitary keys in ``$_SESSION`` that may be set by the legacy +application, although all the ``$_SESSION`` contents will be saved when +the session is saved. + From 793e5703ebf000353ee04bbb5f486bb3b18ddd6c Mon Sep 17 00:00:00 2001 From: Drak Date: Sat, 6 Apr 2013 22:20:21 +0100 Subject: [PATCH 0161/2078] Style fixes --- components/http_foundation/session_php_legacy.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/http_foundation/session_php_legacy.rst b/components/http_foundation/session_php_legacy.rst index 1950785ab53..69903ef7b0b 100644 --- a/components/http_foundation/session_php_legacy.rst +++ b/components/http_foundation/session_php_legacy.rst @@ -2,7 +2,7 @@ single: HTTP single: HttpFoundation, Sessions -Integrating with legacy sessions +Integrating with Legacy Sessions ================================ Sometimes it may be necessary to integrate Symfony into a legacy application @@ -41,9 +41,9 @@ migration of your application to Symfony Sessions. .. note:: -Symfony Sessions store data like attributes in special 'Bags' which use a -key in the ``$_SESSION`` superglobal. This means that a Symfony Session -cannot access arbitary keys in ``$_SESSION`` that may be set by the legacy -application, although all the ``$_SESSION`` contents will be saved when -the session is saved. + Symfony Sessions store data like attributes in special 'Bags' which use a + key in the ``$_SESSION`` superglobal. This means that a Symfony Session + cannot access arbitary keys in ``$_SESSION`` that may be set by the legacy + application, although all the ``$_SESSION`` contents will be saved when + the session is saved. From 6374b08e60bb48aa9e62da387713333a94ba15cc Mon Sep 17 00:00:00 2001 From: umpirsky Date: Sat, 6 Apr 2013 19:04:03 +0200 Subject: [PATCH 0162/2078] Console table helper --- components/console/helpers/index.rst | 1 + components/console/helpers/map.rst.inc | 1 + components/console/helpers/tablehelper.rst | 55 +++++++++++++++++++++ images/components/console/table.png | Bin 0 -> 67527 bytes 4 files changed, 57 insertions(+) create mode 100644 components/console/helpers/tablehelper.rst create mode 100644 images/components/console/table.png diff --git a/components/console/helpers/index.rst b/components/console/helpers/index.rst index adb2a4bbc8a..c922e732e64 100644 --- a/components/console/helpers/index.rst +++ b/components/console/helpers/index.rst @@ -10,6 +10,7 @@ The Console Helpers dialoghelper formatterhelper progresshelper + tablehelper The Console Components comes with some useful helpers. These helpers contain function to ease some common tasks. diff --git a/components/console/helpers/map.rst.inc b/components/console/helpers/map.rst.inc index cbc819ad832..60b32c03975 100644 --- a/components/console/helpers/map.rst.inc +++ b/components/console/helpers/map.rst.inc @@ -1,3 +1,4 @@ * :doc:`/components/console/helpers/dialoghelper` * :doc:`/components/console/helpers/formatterhelper` * :doc:`/components/console/helpers/progresshelper` +* :doc:`/components/console/helpers/tablehelper` diff --git a/components/console/helpers/tablehelper.rst b/components/console/helpers/tablehelper.rst new file mode 100644 index 00000000000..a41ad357ee7 --- /dev/null +++ b/components/console/helpers/tablehelper.rst @@ -0,0 +1,55 @@ +.. index:: + single: Console Helpers; Table Helper + +Table Helper +============ + +.. versionadded:: 2.3 + The ``table`` helper was added in Symfony 2.3. + +When building a console application it may be useful to display tabular data: + +.. image:: /images/components/console/table.png + +To display table, use the :class:`Symfony\\Component\\Console\\Helper\\TableHelper`, +set headers, rows and render:: + + $table = $app->getHelperSet()->get('table'); + $table + ->setHeaders(array('ISBN', 'Title', 'Author')) + ->setRows(array( + array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), + array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'), + array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'), + array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'), + )) + ; + $table->render($output); + +Table layout can be customized as well. There are two ways to customize table rendering: +using named layouts or by customizing rendering options. + +Customize Table Layout using Named Layouts +------------------------------------------ + +Table helper is shipped with two preconfigured table layouts: + +* ``TableHelper::LAYOUT_DEFAULT`` + +* ``TableHelper::LAYOUT_BORDERLESS`` + +Layout can be set using :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setLayout` method. + +Customize Table Layout using Rendering Options +---------------------------------------------- + +You can control table rendering by setting custom rendering option values: + +* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setPaddingChar` +* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setHorizontalBorderChar` +* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setVerticalBorderChar` +* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setVrossingChar` +* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setVellHeaderFormat` +* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setVellRowFormat` +* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setBorderFormat` +* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setPadType` diff --git a/images/components/console/table.png b/images/components/console/table.png new file mode 100644 index 0000000000000000000000000000000000000000..ba1e3ae79b9e4522818d0a44f7d356cdaf6c7528 GIT binary patch literal 67527 zcmV)fK&8KlP)JL&EukfDbVhIHVA5JX5Pkc0$O6h$0xxax-rKKIdk@8bX& z0Kw)cw=CWIY5RKtuo{rT`JBL=EzKaj47y zNI+PoiC5AlG;^4_5rE__nc)CHXyy&Q&`lKfPf-8)b+x90zfjt1nUxxV(}VLgz!0nE-#yC zk7QK}ma~j-D%qDMsnBLkC@>ohKCqe$D`L>H;x3LW(SfS{gtFAEjmnMoC>Kz6or=t8 zvd-uDHFFVFIa`;KqI%bKO|WJA{r&S;Nuo!R!CzNGHO_#a>gj^gU}eXMrvbZ z{>C2ZYXTC_7M6j?L7JyEP^UL!={P4DHkklF6H%gQ>pv36qyq($QxkMkog#d@MU_o? zWjXVHni%S-Yzjxw5w(!q%)2Qyqd;#N8kP$&m{G@uDv1}cw=N&65@L9gH1Cl0P{*Jw zifDRd#4GBmG|;}al*r#;G?-7ALxGJ|LZT*~kj5$iM643V*jiY$UT%eOaGIB~HuX=A z5rGt?d>!nsZpdMLVC?Dv}^X*5JLWeF+HE;REx-TW|Pr^IB6W46C_ z4@8i}P_o#7`xYBW|BL$@qeK2*!kh7W2jZ4S@H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8xvdK(QL)Wd<|*{emjKXf{rmw5wTg=TenAyYlP Date: Sat, 6 Apr 2013 22:31:27 +0100 Subject: [PATCH 0163/2078] Update values. --- reference/configuration/framework.rst | 39 +++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 3d15cf7cb53..461f0a1bcdf 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -26,6 +26,8 @@ Configuration * enabled * field_name * `session`_ + * `name`_ + * `mock_name`_ * `auto_start`_ * `on_demand`_ * `cookie_lifetime`_ @@ -150,6 +152,43 @@ csrf_protection session ~~~~~~~ +on_demand +......... + +**type**: ``string`` **default**: ``on`` + +Can be values + + - ``on`` - start automatically if not started upon session read/write + - ``off`` - do not start session automatically on data read/write, if an attempt is + make to do so, throw a ``\RuntimeException`` + - ``off_lax`` - do not start session automatically on data read/write, but if an attempt + is made to read or write to the session, allow access to the relevent bag. + If data is written to the bags and a session is subsequently started, it will be + overwritten. + +auto_start +.......... + +**type**: ``Boolean`` **default**: ``false`` + +This controls the ``SessionListener`` which will automatically start the session +during the Request cycle. + +name +.... + +**type**: ``string`` + +Sets the session cookie name + +mock_name +......... + +**type**: ``string`` + +Sets the mock session cookie name + cookie_lifetime ............... From bdc83783e88c5809cffad6dfe3608dced42f4567 Mon Sep 17 00:00:00 2001 From: Drak Date: Sat, 6 Apr 2013 22:32:46 +0100 Subject: [PATCH 0164/2078] formatting --- components/http_foundation/session_configuration.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index d92bd8fe300..9cae338e55a 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -248,7 +248,9 @@ You can configure these by injecting a configured storage engine into the sessio use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface; use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler; - $storage = new NativeSessionStorage(array(), new PdoSessionHandler(), SessionStorageInterface::NO_START_ON_DEMAND_STRICT); + $storage = new NativeSessionStorage(array(), + new PdoSessionHandler(), + SessionStorageInterface::NO_START_ON_DEMAND_STRICT); $session = new Session($storage); From 852a205bdcf82c3f3697759469a844ae5caa006a Mon Sep 17 00:00:00 2001 From: Drak Date: Sat, 6 Apr 2013 22:33:34 +0100 Subject: [PATCH 0165/2078] formatting --- components/http_foundation/session_configuration.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index 9cae338e55a..ec542980aed 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -227,7 +227,8 @@ In versions 2.1-2.2, Symfony Sessions automatically invoked ``$session->start()` any attempt was made to access session data (effectively 'start on demand'). From Symfony 2.3 this behaviour can be controlled. -There are three modes defined by :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface` +There are three modes defined by +:class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface` The settings are as follows: From df35697260d77bc6910818aea7654bf1923b6126 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 7 Apr 2013 18:08:21 +0200 Subject: [PATCH 0166/2078] added documentation for the new Debug component --- components/debug.rst | 75 ++++++++++++++++++++++++++++++++++++++++++ components/index.rst | 1 + components/map.rst.inc | 4 +++ 3 files changed, 80 insertions(+) create mode 100644 components/debug.rst diff --git a/components/debug.rst b/components/debug.rst new file mode 100644 index 00000000000..94f21514550 --- /dev/null +++ b/components/debug.rst @@ -0,0 +1,75 @@ +.. index:: + single: Debug + single: Components; Debug + +The Debug Component +=================== + + The Debug Component provides tools to ease debugging PHP code. + +.. versionadded:: 2.3 + The Debug Component is new to Symfony 2.3. Previously, the classes were + located in the ``HttpKernel`` component. + +Installation +------------ + +You can install the component in many different ways: + +* Use the official Git repository (https://github.com/symfony/Debug); +* :doc:`Install it via Composer ` (``symfony/debug`` on `Packagist`_). + +Usage +----- + +The Debug component provides several tools to help you debug PHP code. +Enabling them all is as easy as it can get:: + + use Symfony\Component\Debug\Debug; + + Debug::enable(); + +The :method:`Symfony\\Component\\Debug\\Debug::enable` method registers an +error handler and an exception handler. If the :doc:`ClassLoader component +` is available, a special class loader is also +registered. + +Read the following sections for more information about the different available +tools. + +.. caution:: + + You should never enable the debug tools in a production environment as + they might disclose sensitive information to the user. + +Enabling the Error Handler +-------------------------- + +The :class:`Symfony\\Component\\Debug\\ErrorHandler` class catches PHP errors +and converts them to exceptions (of class :phpclass:`ErrorException` or +:class:`Symfony\\Component\\Debug\\Exception\\FatalErrorException` for PHP +fatal errors):: + + use Symfony\Component\Debug\ErrorHandler; + + ErrorHandler::register(); + +Enabling the Exception Handler +------------------------------ + +The :class:`Symfony\\Component\\Debug\\ExceptionHandler` class catches +uncaught PHP exceptions and converts them to a nice PHP response. It is useful +in debug mode to replace the default PHP/XDebug output with something prettier +and more useful:: + + use Symfony\Component\Debug\ExceptionHandler; + + ExceptionHandler::register(); + +.. note:: + + If the :doc:`HttpFoundation component ` is + available, the handler uses a Symfony Response object; if not, it falls + back to a regular PHP response. + +.. _Packagist: https://packagist.org/packages/symfony/debug diff --git a/components/index.rst b/components/index.rst index 8b4abe24f8d..8f9b989cd11 100644 --- a/components/index.rst +++ b/components/index.rst @@ -9,6 +9,7 @@ The Components config/index console/index css_selector + debug dom_crawler dependency_injection/index event_dispatcher/index diff --git a/components/map.rst.inc b/components/map.rst.inc index f16a8e874b2..e2a0d317eb2 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -23,6 +23,10 @@ * :doc:`/components/css_selector` +* **Debug** + + * :doc:`/components/debug` + * :doc:`/components/dependency_injection/index` * :doc:`/components/dependency_injection/introduction` From 6e7864201db7213c40852882ef0ab4f4eb9a56cc Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 10 Apr 2013 07:37:07 -0500 Subject: [PATCH 0167/2078] [#2438] Minor additions to the kernel.fragment_renderer tag reference --- reference/dic_tags.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index a3c75a7707d..878f669a8d3 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -358,12 +358,15 @@ configuration, and tag it with ``kernel.event_subscriber``: If your service is created by a factory, you **MUST** correctly set the ``class`` parameter for this tag to work correctly. -.. _dic-tags-kernel-fragment-renderer: - kernel.fragment_renderer ------------------------ +------------------------ + +**Purpose**: Add a new HTTP content rendering strategy. -**Purpose**: Add new HTTP content rendering strategies +To add a new rendering strategy - in addition to the core strategies like +``EsiFragmentRenderer`` - create a class that implements +:class:`Symfony\\Component\\HttpKernel\\Fragment\\FragmentRendererInterface`, +register it as a service, then tag it with ``kernel.fragment_renderer``. .. _dic_tags-monolog: From 35513bc777f51ea66284b575fd9799d0d2aa9ede Mon Sep 17 00:00:00 2001 From: Drak Date: Thu, 11 Apr 2013 08:52:09 +0100 Subject: [PATCH 0168/2078] Fix type and clarify behaviour --- components/http_foundation/session_configuration.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index ec542980aed..e094ddd0b4f 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -235,7 +235,8 @@ The settings are as follows: - ``SessionStorageInterface::NO_START_ON_DEMAND_STRICT`` - The session will not be started on demand and any attempt to read or write session data will result in a ``\RuntimeException`` - ``SessionStorageInterface::START_ON_DEMAND`` - The session will be started if it hasn't already been - when any attempt is made to read ro write session data. + when any attempt is made to read or write session data. This setting reflects the default behaviour + since Symfony 2.1 - ``SessionStorageInterface::NO_START_ON_DEMAND_LAX`` - The sessions will not be started on demand when session data is read or written to. It will allow access to the unitialized ``BagInterface``. If this session is subsequently started manually after data is written to a ``BagInterface`` will From 64da9d77efbe808477f2fdc59581d7a2ef8a4f58 Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Thu, 11 Apr 2013 11:32:22 +0200 Subject: [PATCH 0169/2078] Improved Intl documentation based on the PR comments --- components/intl.rst | 241 ++++---------------------------------------- 1 file changed, 18 insertions(+), 223 deletions(-) diff --git a/components/intl.rst b/components/intl.rst index 51a25a3ffa2..46fe5c7e8bb 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -34,8 +34,20 @@ not loaded: * :phpfunction:`intl_get_error_code` * :phpfunction:`intl_get_error_message` -If you don't use Composer but the Symfony ClassLoader component, you need to -load them manually by adding the following lines to your autoload code:: +When the intl extension is not available, the following classes are used to +replace the intl classes: + +* :class:`Symfony\\Component\\Intl\\Collator\\Collator` +* :class:`Symfony\\Component\\Intl\\DateFormatter\\IntlDateFormatter` +* :class:`Symfony\\Component\\Intl\\Locale\\Locale` +* :class:`Symfony\\Component\\Intl\\NumberFormatter\\NumberFormatter` +* :class:`Symfony\\Component\\Intl\\Globals\\IntlGlobals` + +Composer automatically exposes these classes in the global namespace. + +If you don't use Composer but the +:doc:`Symfony ClassLoader component`, you need to +expose them manually by adding the following lines to your autoload code:: if (!function_exists('intl_is_failure')) { require '/path/to/Icu/Resources/stubs/functions.php'; @@ -43,229 +55,12 @@ load them manually by adding the following lines to your autoload code:: $loader->registerPrefixFallback('/path/to/Icu/Resources/stubs'); } -The component provides replacements for the following functions and classes: - .. note:: The stub implementation only supports the locale ``en``. -Stubbed Classes ---------------- - -The stubbed classes of the intl extension are limited to the locale "en" and -will throw an exception if you try to use a different locale. For using other -locales, `install the intl extension`_ instead. - -Locale -~~~~~~ - -The only method supported in the :phpclass:`Locale` class is -:phpmethod:`Locale::getDefault`. This method will always return "en". All other -methods will throw an exception when used. - -NumberFormatter -~~~~~~~~~~~~~~~ - -Numbers can be formatted with the :phpclass:`NumberFormatter` class. -The following methods are supported. All other methods are not supported and -will throw an exception when used. - -.. _`NumberFormatter::__construct()`: - -\__construct($locale = $style = null, $pattern = null) -...................................................... - -The only supported locale is "en". The supported styles are -``NumberFormatter::DECIMAL`` and ``NumberFormatter::CURRENCY``. The argument -``$pattern`` may not be used. - -::create($locale = $style = null, $pattern = null) -.................................................. - -See `NumberFormatter::__construct()`_. - -formatCurrency($value, $currency) -................................. - -Fully supported. - -format($value, $type = NumberFormatter::TYPE_DEFAULT) -..................................................... - -Only type ``NumberFormatter::TYPE_DEFAULT`` is supported. - -getAttribute($attr) -................... - -Fully supported. - -getErrorCode() -.............. - -Fully supported. - -getErrorMessage() -................. - -Fully supported. - -getLocale($type = Locale::ACTUAL_LOCALE) -........................................ - -The parameter ``$type`` is ignored. - -parse($value, $type = NumberFormatter::TYPE_DOUBLE, &$position = null) -...................................................................... - -The supported types are ``NumberFormatter::TYPE_DOUBLE``, -``NumberFormatter::TYPE_INT32`` and ``NumberFormatter::TYPE_INT64``. The -parameter ``$position`` must always be ``null``. - -setAttribute($attr, $value) -........................... - -The only supported attributes are ``NumberFormatter::FRACTION_DIGITS``, -``NumberFormatter::GROUPING_USED`` and ``NumberFormatter::ROUNDING_MODE``. - -The only supported rounding modes are ``NumberFormatter::ROUND_HALFEVEN``, -``NumberFormatter::ROUND_HALFDOWN`` and ``NumberFormatter::ROUND_HALFUP``. - -IntlDateFormatter -~~~~~~~~~~~~~~~~~ - -Dates can be formatted with the :phpclass:`IntlDateFormatter` class. The -following methods are supported. All other methods are not supported and will -throw an exception when used. - -.. _`IntlDateFormatter::__construct()`: - -\__construct($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null) -........................................................................................................................ - -The only supported locale is "en". The parameter ``$calendar`` can only be -``IntlDateFormatter::GREGORIAN``. - -::create($locale, $datetype, $timetype, $timezone = null, $calendar = IntlDateFormatter::GREGORIAN, $pattern = null) -.................................................................................................................... - -See `IntlDateFormatter::__construct()`_. - -format($timestamp) -.................. - -Fully supported. - -getCalendar() -............. - -Fully supported. - -getDateType() -............. - -Fully supported. - -getErrorCode() -.............. - -Fully supported. - -getErrorMessage() -................. - -Fully supported. - -getLocale($type = Locale::ACTUAL_LOCALE) -........................................ - -The parameter ``$type`` is ignored. - -getPattern() -............ - -Fully supported. - -getTimeType() -............. - -Fully supported. - -getTimeZoneId() -............... - -Fully supported. - -isLenient() -........... - -Always returns ``false``. - -parse($value, &$position = null) -................................ - -The parameter ``$position`` must always be ``null``. - -setLenient($lenient) -.................... - -Only accepts ``false``. - -setPattern($pattern) -.................... - -Fully supported. - -setTimeZoneId($timeZoneId) -.......................... - -Fully supported. - -setTimeZone($timeZone) -...................... - -Fully supported. - -Collator -~~~~~~~~ - -Localized strings can be sorted with the :phpclass:`\Collator` class. The -following methods are supported. All other methods are not supported and will -throw an exception when used. - -.. _`Collator::__construct()`: - -\__construct($locale) -..................... - -The only supported locale is "en". - -create($locale) -............... - -See `Collator::__construct()`_. - -asort(&$array, $sortFlag = Collator::SORT_REGULAR) -.................................................. - -Fully supported. - -getErrorCode() -.............. - -Fully supported. - -getErrorMessage() -................. - -Fully supported. - -getLocale($type = Locale::ACTUAL_LOCALE) -........................................ - -The parameter ``$type`` is ignored. - -ResourceBundle -~~~~~~~~~~~~~~ +Writing and Reading Resource Bundles +------------------------------------ The :phpclass:`ResourceBundle` class is not and will not be supported. Instead, this component ships a set of readers and writers for reading and writing arrays @@ -273,7 +68,7 @@ this component ships a set of readers and writers for reading and writing arrays are supported: TextBundleWriter -................ +~~~~~~~~~~~~~~~~ Writes an array or an array-like object to a plain text resource bundle. The resulting .txt file can be converted to a binary .res file with the @@ -397,7 +192,7 @@ locale will be merged. In order to suppress this behavior, the last parameter echo $reader->readEntry('/path/to/bundle', 'en', array('Data', 'entry1'), false); -Included Resource Bundles +Provided Resource Bundles ------------------------- The ICU data is located in several "resource bundles". You can access a PHP From 6c883642848c9aaf2a425774b8ddf13737159248 Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Thu, 11 Apr 2013 17:32:18 +0200 Subject: [PATCH 0170/2078] Added documentation for buttons in forms --- book/forms.rst | 128 ++++++++++++++++-- reference/forms/types.rst | 3 + reference/forms/types/button.rst | 34 +++++ reference/forms/types/map.rst.inc | 9 +- reference/forms/types/options/attr.rst.inc | 2 +- .../forms/types/options/button_attr.rst.inc | 15 ++ .../types/options/button_disabled.rst.inc | 9 ++ .../forms/types/options/button_label.rst.inc | 11 ++ .../options/button_translation_domain.rst.inc | 7 + reference/forms/types/reset.rst | 34 +++++ reference/forms/types/submit.rst | 43 ++++++ 11 files changed, 284 insertions(+), 11 deletions(-) create mode 100644 reference/forms/types/button.rst create mode 100644 reference/forms/types/options/button_attr.rst.inc create mode 100644 reference/forms/types/options/button_disabled.rst.inc create mode 100644 reference/forms/types/options/button_label.rst.inc create mode 100644 reference/forms/types/options/button_translation_domain.rst.inc create mode 100644 reference/forms/types/reset.rst create mode 100644 reference/forms/types/submit.rst diff --git a/book/forms.rst b/book/forms.rst index 272eae5e86e..e37423d9d56 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -101,6 +101,7 @@ from inside a controller:: $form = $this->createFormBuilder($task) ->add('task', 'text') ->add('dueDate', 'date') + ->add('save', 'submit') ->getForm(); return $this->render('AcmeTaskBundle:Default:new.html.twig', array( @@ -125,6 +126,11 @@ In this example, you've added two fields to your form - ``task`` and ``dueDate`` corresponding to the ``task`` and ``dueDate`` properties of the ``Task`` class. You've also assigned each a "type" (e.g. ``text``, ``date``), which, among other things, determines which HTML form tag(s) is rendered for that field. +At last, you added a submit button for submitting the form to the server. + +.. versionadded:: 2.3 + Support for submit buttons was added in Symfony 2.3. Before that, you had + to add buttons to the form's HTML manually. Symfony2 comes with many built-in types that will be discussed shortly (see :ref:`book-forms-type-reference`). @@ -147,8 +153,6 @@ helper functions: {# src/Acme/TaskBundle/Resources/views/Default/new.html.twig #}
      {{ form_widget(form) }} - -
      .. code-block:: html+php @@ -156,8 +160,6 @@ helper functions:
      enctype($form) ?> > widget($form) ?> - -
      .. image:: /images/book/form-simple.png @@ -194,7 +196,7 @@ it into a format that's suitable for being rendered in an HTML form. Support for "hasser" methods was added in Symfony 2.1. .. index:: - single: Forms; Handling form submission + single: Forms; Handling form submissions Handling Form Submissions ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -215,6 +217,7 @@ controller:: $form = $this->createFormBuilder($task) ->add('task', 'text') ->add('dueDate', 'date') + ->add('save', 'submit') ->getForm(); if ($request->isMethod('POST')) { @@ -265,6 +268,42 @@ possible paths: Redirecting a user after a successful form submission prevents the user from being able to hit "refresh" and re-post the data. +.. index:: + single: Forms; Multiple Submit Buttons + +.. _book-form-submitting-multiple-buttons: + +Submitting Forms with Multiple Buttons +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 2.3 + Support for buttons in forms was added in Symfony 2.3. + +When your form contains more than one submit button, you will want to check +which of the buttons was clicked to adapt the program flow in your controller. +Let's add a second button with the caption "Save and add" to our form:: + + $form = $this->createFormBuilder($task) + ->add('task', 'text') + ->add('dueDate', 'date') + ->add('save', 'submit') + ->add('saveAndAdd', 'submit') + ->getForm(); + +In your controller, use the button's +:method:`Symfony\\Component\\Form\\ClickableInterface\\isClicked` method for +querying if the "Save and add" button was clicked:: + + if ($form->isValid()) { + // perform some action, such as saving the task to the database + + $nextAction = $form->get('saveAndAdd')->isClicked() + ? 'task_new' + : 'task_success'; + + return $this->redirect($this->generateUrl($nextAction)); + } + .. index:: single: Forms; Validation @@ -408,8 +447,41 @@ method:: In both of these cases, *only* the ``registration`` validation group will be used to validate the underlying object. -Groups based on Submitted Data -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.. index:: + single: Forms; Disabling validation + +Disabling Validation +~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 2.3 + The ability to set ``validation_groups`` to false is new to version 2.3. + Setting it to an empty array was already supported before. + +Sometimes it is useful to suppress the validation of a form altogether. For +these cases, you can skip the call to :method:`Symfony\\Component\\Form\\FormInterface::isValid` +in your controller. If this is not possible, you can alternatively set the +``validation_groups`` option to ``false`` or an empty array:: + + use Symfony\Component\OptionsResolver\OptionsResolverInterface; + + public function setDefaultOptions(OptionsResolverInterface $resolver) + { + $resolver->setDefaults(array( + 'validation_groups' => false, + )); + } + +Note that when you do that, the form will still run basic integrity checks, +for example whether an uploaded file was too large or whether non-existing +fields were submitted. If you want to suppress validation completely, remove +the :method:`Symfony\\Component\\Form\\FormInterface::isValid` call from your +controller. + +.. index:: + single: Forms; Validation groups based on submitted data + +Groups based on the Submitted Data +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 2.1 The ability to specify a callback or Closure in ``validation_groups`` @@ -417,7 +489,7 @@ Groups based on Submitted Data If you need some advanced logic to determine the validation groups (e.g. based on submitted data), you can set the ``validation_groups`` option -to an array callback, or a ``Closure``:: +to an array callback:: use Symfony\Component\OptionsResolver\OptionsResolverInterface; @@ -431,7 +503,7 @@ to an array callback, or a ``Closure``:: This will call the static method ``determineValidationGroups()`` on the ``Client`` class after the form is bound, but before validation is executed. The Form object is passed as an argument to that method (see next example). -You can also define whole logic inline by using a Closure:: +You can also define whole logic inline by using a ``Closure``:: use Symfony\Component\Form\FormInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; @@ -450,6 +522,44 @@ You can also define whole logic inline by using a Closure:: )); } +.. index:: + single: Forms; Validation groups based on clicked button + +Groups based on the Clicked Button +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 2.3 + Support for buttons in forms was added in Symfony 2.3. + +When your form contains multiple submit buttons, you can change the validation +group depending on which button is used to submit the form. For example, +consider a form in a wizard that lets you advance to the next step or go back +to the previous step. Let's assume also that when returning to the previous +step, the data of the form should be saved, but not validated. + +First, we need to add the two buttons to the form:: + + $form = $this->createFormBuilder($task) + // ... + ->add('nextStep', 'submit') + ->add('previousStep', 'submit') + ->getForm(); + +Then, we configure the button for returning to the previous step to run +specific validation groups. In this example, we want it to suppress validation, +so we set its ``validation_groups`` options to false:: + + $form = $this->createFormBuilder($task) + // ... + ->add('previousStep', 'submit', array( + 'validation_groups' => false, + )) + ->getForm(); + +Now the form will skip your validation constraints. It will still validate +basic integrity constraints, such as checking whether an uploaded file was too +large or whether you tried to submit text in a number field. + .. index:: single: Forms; Built-in field types diff --git a/reference/forms/types.rst b/reference/forms/types.rst index 685c9007a7b..00d20926ada 100644 --- a/reference/forms/types.rst +++ b/reference/forms/types.rst @@ -9,6 +9,7 @@ Form Types Reference :hidden: types/birthday + types/button types/checkbox types/choice types/collection @@ -31,7 +32,9 @@ Form Types Reference types/percent types/radio types/repeated + types/reset types/search + types/submit types/text types/textarea types/time diff --git a/reference/forms/types/button.rst b/reference/forms/types/button.rst new file mode 100644 index 00000000000..ef755e1d4b5 --- /dev/null +++ b/reference/forms/types/button.rst @@ -0,0 +1,34 @@ +.. index:: + single: Forms; Fields; button + +button Field Type +================= + +.. versionadded:: 2.3 + The ``button`` type is new in version 2.3 + +A simple, non-responsive button. + ++----------------------+------------------------------------------------------------------------------------------------------------------------+ +| Rendered as | ``button`` tag | ++----------------------+------------------------------------------------------------------------------------------------------------------------+ +| Options | - `attr`_ | +| | - `disabled`_ | +| | - `label`_ | +| | - `translation_domain`_ | ++----------------------+------------------------------------------------------------------------------------------------------------------------+ +| Parent type | none | ++----------------------+------------------------------------------------------------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ButtonType` | ++----------------------+------------------------------------------------------------------------------------------------------------------------+ + +Options +------- + +.. include:: /reference/forms/types/options/button_attr.rst.inc + +.. include:: /reference/forms/types/options/button_disabled.rst.inc + +.. include:: /reference/forms/types/options/button_label.rst.inc + +.. include:: /reference/forms/types/options/button_translation_domain.rst.inc diff --git a/reference/forms/types/map.rst.inc b/reference/forms/types/map.rst.inc index fdf51a6a554..38690a7df04 100644 --- a/reference/forms/types/map.rst.inc +++ b/reference/forms/types/map.rst.inc @@ -49,8 +49,15 @@ Hidden Fields * :doc:`hidden` * :doc:`csrf` +Buttons +~~~~~~~ + +* :doc:`button` +* :doc:`reset` +* :doc:`submit` + Base Fields ~~~~~~~~~~~ * :doc:`field` -* :doc:`form` \ No newline at end of file +* :doc:`form` diff --git a/reference/forms/types/options/attr.rst.inc b/reference/forms/types/options/attr.rst.inc index 21b040843d5..7fcf2603e7c 100644 --- a/reference/forms/types/options/attr.rst.inc +++ b/reference/forms/types/options/attr.rst.inc @@ -3,7 +3,7 @@ attr **type**: array **default**: Empty array -If you want to add extra attributes to HTML field representation +If you want to add extra attributes to the HTML field representation, you can use ``attr`` option. It's an associative array with HTML attribute as a key. This can be useful when you need to set a custom class for some widget:: diff --git a/reference/forms/types/options/button_attr.rst.inc b/reference/forms/types/options/button_attr.rst.inc new file mode 100644 index 00000000000..39a2f6c35f4 --- /dev/null +++ b/reference/forms/types/options/button_attr.rst.inc @@ -0,0 +1,15 @@ +attr +~~~~ + +**type**: array **default**: Empty array + +If you want to add extra attributes to the HTML representation of the button, +you can use ``attr`` option. It's an associative array with HTML attribute +as a key. This can be useful when you need to set a custom class for the button:: + + $builder->add('save', 'button', array( + 'attr' => array('class' => 'save'), + )); + + + diff --git a/reference/forms/types/options/button_disabled.rst.inc b/reference/forms/types/options/button_disabled.rst.inc new file mode 100644 index 00000000000..3fee652ff68 --- /dev/null +++ b/reference/forms/types/options/button_disabled.rst.inc @@ -0,0 +1,9 @@ +disabled +~~~~~~~~ + +**type**: ``boolean`` **default**: ``false`` + +If you don't want a user to be able to click a button, you can set the disabled +option to true. It will not be possible to submit the form with this button, +not even when bypassing the browser and sending an request manually, for +example with cURL. diff --git a/reference/forms/types/options/button_label.rst.inc b/reference/forms/types/options/button_label.rst.inc new file mode 100644 index 00000000000..9926016a0f3 --- /dev/null +++ b/reference/forms/types/options/button_label.rst.inc @@ -0,0 +1,11 @@ +label +~~~~~ + +**type**: ``string`` **default**: The label is "guessed" from the field name + +Sets the label that will be displayed on the button. The label can also be +directly set inside the template: + +.. code-block:: jinja + + {{ form_widget(form.save, { 'label': 'Click me' }) }} diff --git a/reference/forms/types/options/button_translation_domain.rst.inc b/reference/forms/types/options/button_translation_domain.rst.inc new file mode 100644 index 00000000000..56c3453f5c1 --- /dev/null +++ b/reference/forms/types/options/button_translation_domain.rst.inc @@ -0,0 +1,7 @@ +translation_domain +~~~~~~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``messages`` + +This is the translation domain that will be used for any labels or options +that are rendered for this button. diff --git a/reference/forms/types/reset.rst b/reference/forms/types/reset.rst new file mode 100644 index 00000000000..418122fad24 --- /dev/null +++ b/reference/forms/types/reset.rst @@ -0,0 +1,34 @@ +.. index:: + single: Forms; Fields; reset + +reset Field Type +================ + +.. versionadded:: 2.3 + The ``submit`` type is new in version 2.3 + +A button that resets all fields to their original values. + ++----------------------+------------------------------------------------------------------------------------------------------------------------+ +| Rendered as | ``input`` ``reset`` tag | ++----------------------+------------------------------------------------------------------------------------------------------------------------+ +| Inherited | - `attr`_ | +| options | - `disabled`_ | +| | - `label`_ | +| | - `translation_domain`_ | ++----------------------+------------------------------------------------------------------------------------------------------------------------+ +| Parent type | :doc:`button` | ++----------------------+------------------------------------------------------------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ResetType` | ++----------------------+------------------------------------------------------------------------------------------------------------------------+ + +Inherited options +----------------- + +.. include:: /reference/forms/types/options/button_attr.rst.inc + +.. include:: /reference/forms/types/options/button_disabled.rst.inc + +.. include:: /reference/forms/types/options/button_label.rst.inc + +.. include:: /reference/forms/types/options/button_translation_domain.rst.inc diff --git a/reference/forms/types/submit.rst b/reference/forms/types/submit.rst new file mode 100644 index 00000000000..5b2dc8e370a --- /dev/null +++ b/reference/forms/types/submit.rst @@ -0,0 +1,43 @@ +.. index:: + single: Forms; Fields; submit + +submit Field Type +================= + +.. versionadded:: 2.3 + The ``submit`` type is new in version 2.3 + +A submit button. + ++----------------------+------------------------------------------------------------------------------------------------------------------------+ +| Rendered as | ``input`` ``submit`` tag | ++----------------------+------------------------------------------------------------------------------------------------------------------------+ +| Inherited | - `attr`_ | +| options | - `disabled`_ | +| | - `label`_ | +| | - `translation_domain`_ | ++----------------------+------------------------------------------------------------------------------------------------------------------------+ +| Parent type | :doc:`button` | ++----------------------+------------------------------------------------------------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\SubmitType` | ++----------------------+------------------------------------------------------------------------------------------------------------------------+ + +Submit buttons feature an additional method +:method:`Symfony\\Component\\Form\\ClickableInterface\\isClicked` that lets you +check whether this button was used to submit the forms. This is especially +useful when :ref:`a form has multiple submit buttons `:: + + if ($form->get('save')->isClicked()) { + // ... + } + +Inherited options +----------------- + +.. include:: /reference/forms/types/options/button_attr.rst.inc + +.. include:: /reference/forms/types/options/button_disabled.rst.inc + +.. include:: /reference/forms/types/options/button_label.rst.inc + +.. include:: /reference/forms/types/options/button_translation_domain.rst.inc From 1dcfe8df2c3a0edd28bc39968ce531e7e378c728 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 11 Apr 2013 16:31:27 -0500 Subject: [PATCH 0171/2078] [#2479] Minor tweak for new debug article --- components/debug.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/debug.rst b/components/debug.rst index 94f21514550..a718ba6ee74 100644 --- a/components/debug.rst +++ b/components/debug.rst @@ -68,7 +68,7 @@ and more useful:: .. note:: - If the :doc:`HttpFoundation component ` is + If the :doc:`HttpFoundation component ` is available, the handler uses a Symfony Response object; if not, it falls back to a regular PHP response. From 8899b9285c5373b1f89b65a15ee95203a4362646 Mon Sep 17 00:00:00 2001 From: Fred Jiles Date: Fri, 12 Apr 2013 12:20:11 -0400 Subject: [PATCH 0172/2078] Previous session options to security configuration Add documentation for option to set require_previous_session in form login. --- reference/configuration/security.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index 9d208d605e2..1b6039dfe7d 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -147,6 +147,10 @@ Each part will be explained in the next section. # by default, the login form *must* be a POST, not a GET post_only: true remember_me: false + + #by default, a session must exist before submitting an authentication request + require_previous_session: true + remember_me: token_provider: name key: someS3cretKey From beaf27c093a15dad502169d2d5cb56f7ead087b2 Mon Sep 17 00:00:00 2001 From: Fred Jiles Date: Fri, 12 Apr 2013 17:11:18 -0400 Subject: [PATCH 0173/2078] Add space after # --- reference/configuration/security.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index 1b6039dfe7d..dcff7d276e1 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -148,7 +148,7 @@ Each part will be explained in the next section. post_only: true remember_me: false - #by default, a session must exist before submitting an authentication request + # by default, a session must exist before submitting an authentication request require_previous_session: true remember_me: From 88b88e5bb47b0f39a634c6efc409902db3359a57 Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Sat, 13 Apr 2013 15:33:43 +0200 Subject: [PATCH 0174/2078] Fixed spelling and grammar errors --- book/forms.rst | 9 +++--- reference/forms/types/button.rst | 26 ++++++++--------- .../types/options/button_disabled.rst.inc | 2 +- .../forms/types/options/button_label.rst.inc | 12 ++++++-- reference/forms/types/reset.rst | 26 ++++++++--------- reference/forms/types/submit.rst | 28 +++++++++---------- 6 files changed, 55 insertions(+), 48 deletions(-) diff --git a/book/forms.rst b/book/forms.rst index e37423d9d56..568c4d52ad5 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -291,11 +291,11 @@ Let's add a second button with the caption "Save and add" to our form:: ->getForm(); In your controller, use the button's -:method:`Symfony\\Component\\Form\\ClickableInterface\\isClicked` method for +:method:`Symfony\\Component\\Form\\ClickableInterface::isClicked` method for querying if the "Save and add" button was clicked:: if ($form->isValid()) { - // perform some action, such as saving the task to the database + // ... perform some action, such as saving the task to the database $nextAction = $form->get('saveAndAdd')->isClicked() ? 'task_new' @@ -454,8 +454,9 @@ Disabling Validation ~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 2.3 - The ability to set ``validation_groups`` to false is new to version 2.3. - Setting it to an empty array was already supported before. + The ability to set ``validation_groups`` to false was added in Symfony 2.3, + although setting it to an empty array achieved the same result in previous + versions. Sometimes it is useful to suppress the validation of a form altogether. For these cases, you can skip the call to :method:`Symfony\\Component\\Form\\FormInterface::isValid` diff --git a/reference/forms/types/button.rst b/reference/forms/types/button.rst index ef755e1d4b5..6e8cce6ed57 100644 --- a/reference/forms/types/button.rst +++ b/reference/forms/types/button.rst @@ -5,22 +5,22 @@ button Field Type ================= .. versionadded:: 2.3 - The ``button`` type is new in version 2.3 + The ``button`` type was added in Symfony 2.3 A simple, non-responsive button. -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Rendered as | ``button`` tag | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Options | - `attr`_ | -| | - `disabled`_ | -| | - `label`_ | -| | - `translation_domain`_ | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Parent type | none | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ButtonType` | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ ++----------------------+----------------------------------------------------------------------+ +| Rendered as | ``button`` tag | ++----------------------+----------------------------------------------------------------------+ +| Options | - `attr`_ | +| | - `disabled`_ | +| | - `label`_ | +| | - `translation_domain`_ | ++----------------------+----------------------------------------------------------------------+ +| Parent type | none | ++----------------------+----------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ButtonType` | ++----------------------+----------------------------------------------------------------------+ Options ------- diff --git a/reference/forms/types/options/button_disabled.rst.inc b/reference/forms/types/options/button_disabled.rst.inc index 3fee652ff68..b08ebf3f35f 100644 --- a/reference/forms/types/options/button_disabled.rst.inc +++ b/reference/forms/types/options/button_disabled.rst.inc @@ -5,5 +5,5 @@ disabled If you don't want a user to be able to click a button, you can set the disabled option to true. It will not be possible to submit the form with this button, -not even when bypassing the browser and sending an request manually, for +not even when bypassing the browser and sending a request manually, for example with cURL. diff --git a/reference/forms/types/options/button_label.rst.inc b/reference/forms/types/options/button_label.rst.inc index 9926016a0f3..9cafe2fc8e4 100644 --- a/reference/forms/types/options/button_label.rst.inc +++ b/reference/forms/types/options/button_label.rst.inc @@ -5,7 +5,13 @@ label Sets the label that will be displayed on the button. The label can also be directly set inside the template: - -.. code-block:: jinja - {{ form_widget(form.save, { 'label': 'Click me' }) }} +.. configuration-block:: + + .. code-block:: html+jinja + + {{ form_widget(form.save, { 'label': 'Click me' }) }} + + .. code-block:: html+php + + widget($form['save'], array('label' => 'Click me')) ?> diff --git a/reference/forms/types/reset.rst b/reference/forms/types/reset.rst index 418122fad24..004657aaf55 100644 --- a/reference/forms/types/reset.rst +++ b/reference/forms/types/reset.rst @@ -5,22 +5,22 @@ reset Field Type ================ .. versionadded:: 2.3 - The ``submit`` type is new in version 2.3 + The ``reset`` type was added in Symfony 2.3 A button that resets all fields to their original values. -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Rendered as | ``input`` ``reset`` tag | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Inherited | - `attr`_ | -| options | - `disabled`_ | -| | - `label`_ | -| | - `translation_domain`_ | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Parent type | :doc:`button` | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ResetType` | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ ++----------------------+---------------------------------------------------------------------+ +| Rendered as | ``input`` ``reset`` tag | ++----------------------+---------------------------------------------------------------------+ +| Inherited | - `attr`_ | +| options | - `disabled`_ | +| | - `label`_ | +| | - `translation_domain`_ | ++----------------------+---------------------------------------------------------------------+ +| Parent type | :doc:`button` | ++----------------------+---------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ResetType` | ++----------------------+---------------------------------------------------------------------+ Inherited options ----------------- diff --git a/reference/forms/types/submit.rst b/reference/forms/types/submit.rst index 5b2dc8e370a..ce75fa3b116 100644 --- a/reference/forms/types/submit.rst +++ b/reference/forms/types/submit.rst @@ -5,25 +5,25 @@ submit Field Type ================= .. versionadded:: 2.3 - The ``submit`` type is new in version 2.3 + The ``submit`` type was added in Symfony 2.3 A submit button. -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Rendered as | ``input`` ``submit`` tag | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Inherited | - `attr`_ | -| options | - `disabled`_ | -| | - `label`_ | -| | - `translation_domain`_ | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Parent type | :doc:`button` | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\SubmitType` | -+----------------------+------------------------------------------------------------------------------------------------------------------------+ ++----------------------+----------------------------------------------------------------------+ +| Rendered as | ``input`` ``submit`` tag | ++----------------------+----------------------------------------------------------------------+ +| Inherited | - `attr`_ | +| options | - `disabled`_ | +| | - `label`_ | +| | - `translation_domain`_ | ++----------------------+----------------------------------------------------------------------+ +| Parent type | :doc:`button` | ++----------------------+----------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\SubmitType` | ++----------------------+----------------------------------------------------------------------+ Submit buttons feature an additional method -:method:`Symfony\\Component\\Form\\ClickableInterface\\isClicked` that lets you +:method:`Symfony\\Component\\Form\\ClickableInterface::isClicked` that lets you check whether this button was used to submit the forms. This is especially useful when :ref:`a form has multiple submit buttons `:: From 318ba888af1db81a2eb950c7270f3443afe76bfe Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Wed, 2 Jan 2013 15:51:02 +0100 Subject: [PATCH 0175/2078] Added information about the new form(), form_start() and form_end() helpers --- book/forms.rst | 126 +++++++++++++++++------- cookbook/doctrine/file_uploads.rst | 26 ----- cookbook/doctrine/registration_form.rst | 14 +-- cookbook/form/form_collections.rst | 16 +-- cookbook/routing/method_parameters.rst | 29 +----- reference/forms/twig_reference.rst | 74 ++++++++++++++ reference/forms/types/collection.rst | 4 +- reference/forms/types/file.rst | 7 +- reference/twig_reference.rst | 10 ++ 9 files changed, 194 insertions(+), 112 deletions(-) diff --git a/book/forms.rst b/book/forms.rst index 272eae5e86e..cc288096151 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -145,35 +145,27 @@ helper functions: .. code-block:: html+jinja {# src/Acme/TaskBundle/Resources/views/Default/new.html.twig #} -
      - {{ form_widget(form) }} - - -
      + {{ form(form) }} .. code-block:: html+php -
      enctype($form) ?> > - widget($form) ?> - - -
      + form($form) ?> .. image:: /images/book/form-simple.png :align: center .. note:: - This example assumes that you've created a route called ``task_new`` - that points to the ``AcmeTaskBundle:Default:new`` controller that - was created earlier. + This example assumes that you submit the form in a "POST" request and to + the same URL that it was displayed in. You will learn later how to + change the request method and the target URL of the form. -That's it! By printing ``form_widget(form)``, each field in the form is -rendered, along with a label and error message (if there is one). As easy -as this is, it's not very flexible (yet). Usually, you'll want to render each -form field individually so you can control how the form looks. You'll learn how -to do that in the ":ref:`form-rendering-template`" section. +That's it! By printing ``form(form)``, each field in the form is rendered, along +with a label and error message (if there is one). As easy as this is, it's not +very flexible (yet). Usually, you'll want to render each form field individually +so you can control how the form looks. You'll learn how to do that in the +":ref:`form-rendering-template`" section. Before moving on, notice how the rendered ``task`` input field has the value of the ``task`` property from the ``$task`` object (i.e. "Write a blog post"). @@ -605,35 +597,30 @@ of code. Of course, you'll usually need much more flexibility when rendering: .. code-block:: html+jinja {# src/Acme/TaskBundle/Resources/views/Default/new.html.twig #} -
      + {{ form_start(form) }} {{ form_errors(form) }} {{ form_row(form.task) }} {{ form_row(form.dueDate) }} - {{ form_rest(form) }} - -
      + {{ form_end(form) }} .. code-block:: html+php -
      enctype($form) ?>> + start($form) ?> errors($form) ?> row($form['task']) ?> row($form['dueDate']) ?> - rest($form) ?> - -
      + end($form) ?> Take a look at each part: -* ``form_enctype(form)`` - If at least one field is a file upload field, this - renders the obligatory ``enctype="multipart/form-data"``; +* ``form_start(form)`` - Renders the start tag of the form. * ``form_errors(form)`` - Renders any errors global to the whole form (field-specific errors are displayed next to each field); @@ -642,10 +629,8 @@ Take a look at each part: form widget for the given field (e.g. ``dueDate``) inside, by default, a ``div`` element; -* ``form_rest(form)`` - Renders any fields that have not yet been rendered. - It's usually a good idea to place a call to this helper at the bottom of - each form (in case you forgot to output a field or don't want to bother - manually rendering hidden fields). This helper is also useful for taking +* ``form_end()`` - Renders the end tag of the form and any fields that have not + yet been rendered. This is useful for rendering hidden fields and taking advantage of the automatic :ref:`CSRF Protection`. The majority of the work is done by the ``form_row`` helper, which renders @@ -740,7 +725,7 @@ field: .. code-block:: html+jinja - {{ form_widget(form.task, { 'attr': {'class': 'task_field'} }) }} + {{ form_widget(form.task, {'attr': {'class': 'task_field'}}) }} .. code-block:: html+php @@ -783,6 +768,75 @@ available in the :doc:`reference manual`. Read this to know everything about the helpers available and the options that can be used with each. +.. index:: + single: Forms; Changing the action and method + +.. _book-forms-changing-action-and-method: + +Changing the Action and Method of a Form +---------------------------------------- + +So far, we have used the ``form_start()`` helper to render the form's start tag +and assumed that each form is submitted to the same URL in a POST request. +Sometimes you want to change these parameters. You can do so in a few different +ways. If you build your form in the controller, you can use ``setAction()`` and +``setMethod()``:: + + $form = $this->createFormBuilder($task) + ->setAction($this->generateUrl('target_route')) + ->setMethod('GET') + ->add('task', 'text') + ->add('dueDate', 'date') + ->getForm(); + +.. note:: + + This example assumes that you've created a route called ``target_route`` + that points to the controller that processes the form. + +In :ref:`book-form-creating-form-classes` you will learn how to outsource the +form building code into separate classes. When using such a form class in the +controller, you can pass the action and method as form options:: + + $form = $this->createForm(new TaskType(), $task, array( + 'action' => $this->generateUrl('target_route'), + 'method' => 'GET', + )); + +At last, you can override the action and method in the template by passing them +to the ``form()`` or the ``form_start()`` helper: + +.. configuration-block:: + + .. code-block:: html+jinja + + {# src/Acme/TaskBundle/Resources/views/Default/new.html.twig #} + {{ form(form, {'action': path('target_route'), 'method': 'GET'}) }} + + {{ form_start(form, {'action': path('target_route'), 'method': 'GET'}) }} + + .. code-block:: html+php + + + form($form, array( + 'action' => $view['router']->generate('target_route'), + 'method' => 'GET', + )) ?> + + start($form, array( + 'action' => $view['router']->generate('target_route'), + 'method' => 'GET', + )) ?> + +.. note:: + + If the form's method is not GET or POST, but PUT, PATCH or DELETE, Symfony2 + will insert a hidden field with the name "_method" that stores this method. + The form will be submitted in a normal POST request, but Symfony2's router + is capable of detecting the "_method" parameter and will interpret the + request as PUT, PATCH or DELETE request. Read the cookbook chapter + ":doc:`/cookbook/routing/method_parameters`" for more information. + .. index:: single: Forms; Creating form classes @@ -1143,7 +1197,7 @@ renders the form: {% form_theme form 'AcmeTaskBundle:Form:fields.html.twig' 'AcmeTaskBundle:Form:fields2.html.twig' %} -
      + {{ form(form) }} .. code-block:: html+php @@ -1152,7 +1206,7 @@ renders the form: setTheme($form, array('AcmeTaskBundle:Form', 'AcmeTaskBundle:Form')) ?> - + form($form) ?> The ``form_theme`` tag (in Twig) "imports" the fragments defined in the given template and uses them when rendering the form. In other words, when the @@ -1231,7 +1285,7 @@ are 4 possible *parts* of a form that can be rendered: .. note:: - There are actually 3 other *parts* - ``rows``, ``rest``, and ``enctype`` - + There are actually 2 other *parts* - ``rows`` and ``rest`` - but you should rarely if ever need to worry about overriding them. By knowing the field type (e.g. ``textarea``) and which part you want to diff --git a/cookbook/doctrine/file_uploads.rst b/cookbook/doctrine/file_uploads.rst index 34778c3c0aa..f3ca3a05624 100644 --- a/cookbook/doctrine/file_uploads.rst +++ b/cookbook/doctrine/file_uploads.rst @@ -251,32 +251,6 @@ The following controller shows you how to handle the entire process:: return array('form' => $form->createView()); } -.. note:: - - When writing the template, don't forget to set the ``enctype`` attribute: - - .. configuration-block:: - - .. code-block:: html+jinja - -

      Upload File

      - - - {{ form_widget(form) }} - - -
      - - .. code-block:: html+php - -

      Upload File

      - -
      enctype($form) ?>> - widget($form) ?> - - -
      - The previous controller will automatically persist the ``Document`` entity with the submitted name, but it will do nothing about the file and the ``path`` property will be blank. diff --git a/cookbook/doctrine/registration_form.rst b/cookbook/doctrine/registration_form.rst index 9e735ee877a..a0665cba206 100644 --- a/cookbook/doctrine/registration_form.rst +++ b/cookbook/doctrine/registration_form.rst @@ -232,10 +232,10 @@ controller for displaying the registration form:: { public function registerAction() { - $form = $this->createForm( - new RegistrationType(), - new Registration() - ); + $registration = new Registration(); + $form = $this->createForm(new RegistrationType(), $registration, array( + 'action' => $this->generateUrl('create'), + )); return $this->render( 'AcmeAccountBundle:Account:register.html.twig', @@ -249,11 +249,7 @@ and its template: .. code-block:: html+jinja {# src/Acme/AccountBundle/Resources/views/Account/register.html.twig #} -
      - {{ form_widget(form) }} - - -
      + {{ form(form) }} Finally, create the controller which handles the form submission. This performs the validation and saves the data into the database:: diff --git a/cookbook/form/form_collections.rst b/cookbook/form/form_collections.rst index be64bb969b7..92dfbabf04a 100755 --- a/cookbook/form/form_collections.rst +++ b/cookbook/form/form_collections.rst @@ -205,7 +205,7 @@ zero tags when first created). {# ... #} -
      + {{ form_start(form) }} {# render the task's only field: description #} {{ form_row(form.description) }} @@ -216,10 +216,9 @@ zero tags when first created).
    • {{ form_row(tag.name) }}
    • {% endfor %}
    + {{ form_end(form) }} - {{ form_rest(form) }} - {# ... #} - + {# ... #} .. code-block:: html+php @@ -227,16 +226,17 @@ zero tags when first created). -
    + start($form) ?> + + row($form['description']) ?> +

    Tags

    • row($tag['name']) ?>
    - - rest($form) ?> -
    + end($form) ?> diff --git a/cookbook/routing/method_parameters.rst b/cookbook/routing/method_parameters.rst index f0360e7e87f..ecf152ecc47 100644 --- a/cookbook/routing/method_parameters.rst +++ b/cookbook/routing/method_parameters.rst @@ -86,28 +86,7 @@ Unfortunately, life isn't quite this simple, since most browsers do not support sending PUT and DELETE requests. Fortunately Symfony2 provides you with a simple way of working around this limitation. By including a ``_method`` parameter in the query string or parameters of an HTTP request, Symfony2 will -use this as the method when matching routes. This can be done easily in forms -with a hidden field. Suppose you have a form for editing a blog post: - -.. code-block:: html+jinja - -
    - - {{ form_widget(form) }} - -
    - -The submitted request will now match the ``blog_update`` route and the ``updateAction`` -will be used to process the form. - -Likewise the delete form could be changed to look like this: - -.. code-block:: html+jinja - -
    - - {{ form_widget(delete_form) }} - -
    - -It will then match the ``blog_delete`` route. +use this as the method when matching routes. Forms automatically include a +hidden field for this parameter if their submission method is not GET or POST. +See :ref:`the related chapter in the forms documentation` +for more information. diff --git a/reference/forms/twig_reference.rst b/reference/forms/twig_reference.rst index 7022dbf19be..6ad0aa55347 100644 --- a/reference/forms/twig_reference.rst +++ b/reference/forms/twig_reference.rst @@ -24,6 +24,75 @@ rendering forms. There are several different functions available, and each is responsible for rendering a different part of a form (e.g. labels, errors, widgets, etc). +.. _reference-forms-twig-form: + +form(view, variables) +--------------------- + +Renders the HTML of a complete form. + +.. code-block:: jinja + + {# render the form and change the submission method #} + {{ form(form, {'method': 'GET'}) }} + +You will mostly use this helper for prototyping and if you use custom form +themes. If you need more flexibility in rendering the form, you should use +the other helpers to render individual parts of the form instead: + +.. code-block:: jinja + + {{ form_start(form) }} + {{ form_errors(form) }} + + {{ form_row(form.name) }} + {{ form_row(form.dueDate) }} + + + {{ form_end(form) }} + +See ":ref:`twig-reference-form-variables`" to learn more about the ``variables`` +argument. + +.. _reference-forms-twig-start: + +form_start(view, variables) +--------------------------- + +Renders the start tag of a form. This helper takes care of printing the +configured method and target action of the form. It will also include the +correct ``enctype`` property if the form contains upload fields. + +.. code-block:: jinja + + {# render the start tag and change the submission method #} + {{ form_start(form, {'method': 'GET'}) }} + +See ":ref:`twig-reference-form-variables`" to learn more about the ``variables`` +argument. + +.. _reference-forms-twig-end: + +form_end(view, variables) +------------------------- + +Renders the end tag of a form. + +.. code-block:: jinja + + {{ form_end(form) }} + +This helper also outputs ``form_rest()`` unless you set ``render_rest`` to +false: + +.. code-block:: jinja + + {# don't render unrendered fields #} + {{ form_end(form, {'render_rest': false}) }} + +See ":ref:`twig-reference-form-variables`" to learn more about the ``variables`` +argument. + .. _reference-forms-twig-label: form_label(view, label, variables) @@ -119,6 +188,11 @@ obvious (since it'll render the field for you). form_enctype(view) ------------------ +.. note:: + + This helper was deprecated in Symfony 2.3 and will be removed in Symfony 3.0. + You should use ``form_start()`` instead. + If the form contains at least one file upload field, this will render the required ``enctype="multipart/form-data"`` form attribute. It's always a good idea to include this in your form tag: diff --git a/reference/forms/types/collection.rst b/reference/forms/types/collection.rst index ce4e438001f..b394e8bbb5a 100644 --- a/reference/forms/types/collection.rst +++ b/reference/forms/types/collection.rst @@ -151,7 +151,7 @@ you need is the JavaScript: .. code-block:: html+jinja -
    + {{ form_start(form) }} {# ... #} {# store the prototype on the data-prototype attribute #} @@ -167,7 +167,7 @@ you need is the JavaScript: Add another email {# ... #} -
    + {{ form_end(form) }} + {% endjavascripts %} + + .. code-block:: html+php + + javascripts( + array('@AcmeFooBundle/Resources/public/js/*'), + array('uglifyjs') + ) as $url): ?> + + + +.. note:: + + The above example assumes that you have a bundle called ``AcmeFooBundle`` + and your JavaScript files are in the ``Resources/public/js`` directory under + your bundle. This isn't important however - you can include your Javascript + files no matter where they are. + +With the addition of the ``uglifyjs`` filter to the asset tags above, you should +now see minified JavaScripts coming over the wire much faster. + +Disable Minification in Debug Mode +---------------------------------- + +Minified JavaScripts are very difficult to read, let alone +debug. Because of this, Assetic lets you disable a certain filter when your +application is in debug mode. You can do this by prefixing the filter name +in your template with a question mark: ``?``. This tells Assetic to only +apply this filter when debug mode is off. + +.. configuration-block:: + + .. code-block:: html+jinja + + {% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='?uglifyjs' %} + + {% endjavascripts %} + + .. code-block:: html+php + + javascripts( + array('@AcmeFooBundle/Resources/public/js/*'), + array('?uglifyjs') + ) as $url): ?> + + + + +.. tip:: + + Instead of adding the filter to the asset tags, you can also globally + enable it by adding the apply-to attribute to the filter configuration, for + example in the ``uglifyjs`` filter ``apply_to: "\.js$"``. To only have the filter + applied in production, add this to the config_prod file rather than the + common config file. For details on applying filters by file extension, + see :ref:`cookbook-assetic-apply-to`. + + +.. _`UglifyJs`: https://github.com/mishoo/UglifyJS +.. _`install node.js`: http://nodejs.org/ diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index 0bfc7b1c567..fad3ccb3564 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -2,6 +2,7 @@ * :doc:`/cookbook/assetic/asset_management` * :doc:`/cookbook/assetic/yuicompressor` + * :doc:`/cookbook/assetic/uglifyjs` * :doc:`/cookbook/assetic/jpeg_optimize` * :doc:`/cookbook/assetic/apply_to_option` From f6a032a4c86c2a67d89a35ef6c1b4cbc74fb1bfc Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Sat, 23 Mar 2013 13:33:13 +0100 Subject: [PATCH 0300/2078] Making minor changes suggested by @WouterJ --- cookbook/assetic/uglifyjs.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cookbook/assetic/uglifyjs.rst b/cookbook/assetic/uglifyjs.rst index 1480604ae7d..08b6c1575ed 100644 --- a/cookbook/assetic/uglifyjs.rst +++ b/cookbook/assetic/uglifyjs.rst @@ -2,17 +2,17 @@ single: Assetic; UglifyJs How to Minify JavaScripts with UglifyJs -============================================================= +======================================= `UglifyJs`_ is a javascript parser/compressor/beautifier toolkit. It can be used to combine and minify javascript assets so they need less HTTP requests and makes the website load faster. Install UglifyJs -------------------------------- +---------------- -UglifyJs is build as an node.js npm module and can be installed using npm. First, you -need to `install node.js`_. Afterwards you can install UglifyJs using npm: +UglifyJs is build as an node.js npm module and can be installed using npm. First, +you need to `install node.js`_. Afterwards you can install UglifyJs using npm: .. code-block:: bash @@ -25,13 +25,13 @@ need to `install node.js`_. Afterwards you can install UglifyJs using npm: .. code-block:: bash - $ npm install uglifyjs /path/to/symfony/app + $ npm install uglifyjs /path/to/symfony/app/Resources - It is recommended that you install uglifyjs in your app folder and add the ``node_modules`` - folder to version control. + It is recommended that you install UglifyJs in your ``app/Resources`` folder + and add the ``node_modules`` folder to version control. Configure the UglifyJs Filter -------------------------- +----------------------------- Now we need to configure symfony2 to use the UglifyJs Filter when processing your stylesheets: @@ -68,8 +68,8 @@ stylesheets: .. note:: - The path where uglifyjs is installed may vary depending on your system. - To find out where npm stores the bin folder, you can use the following + The path where UglifyJs is installed may vary depending on your system. + To find out where npm stores the ``bin`` folder, you can use the following command: .. code-block:: bash @@ -77,9 +77,9 @@ stylesheets: $ npm bin -g It should output a folder on your system, inside which you should find - the uglifyjs executable. + the UglifyJs executable. - If you installed uglifyjs locally, you can find the bin folder inside + If you installed UglifyJs locally, you can find the bin folder inside the ``node_modules`` folder. It's called ``.bin`` in this case. You now have access to the ``uglifyjs`` Filter in your application. @@ -149,7 +149,7 @@ apply this filter when debug mode is off. Instead of adding the filter to the asset tags, you can also globally enable it by adding the apply-to attribute to the filter configuration, for example in the ``uglifyjs`` filter ``apply_to: "\.js$"``. To only have the filter - applied in production, add this to the config_prod file rather than the + applied in production, add this to the ``config_prod`` file rather than the common config file. For details on applying filters by file extension, see :ref:`cookbook-assetic-apply-to`. From d9343495220b9f42f248ff11a9ff5f302df19a06 Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Sat, 30 Mar 2013 20:01:43 +0100 Subject: [PATCH 0301/2078] Fixing npm install for uglifyjs (wrong command, wrong version) --- cookbook/assetic/uglifyjs.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cookbook/assetic/uglifyjs.rst b/cookbook/assetic/uglifyjs.rst index 08b6c1575ed..54c1af2f6d3 100644 --- a/cookbook/assetic/uglifyjs.rst +++ b/cookbook/assetic/uglifyjs.rst @@ -16,7 +16,7 @@ you need to `install node.js`_. Afterwards you can install UglifyJs using npm: .. code-block:: bash - $ npm install -g uglifyjs + $ npm install -g uglify-js@1 .. note:: @@ -25,10 +25,16 @@ you need to `install node.js`_. Afterwards you can install UglifyJs using npm: .. code-block:: bash - $ npm install uglifyjs /path/to/symfony/app/Resources + $ npm install uglify-js@1 /path/to/symfony/app/Resources It is recommended that you install UglifyJs in your ``app/Resources`` folder and add the ``node_modules`` folder to version control. + +.. tip:: + + This cookbook uses UglifyJs 1 instead of the newer version 2 to be compatible + with old assetic versions. If you wantt to use UglifyJs version 2, make sure + to also use the assetic filter for this version and apply the correct configuration. Configure the UglifyJs Filter ----------------------------- From 520f468e9602f963bc8b343c30ea53a147821741 Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Sun, 12 May 2013 05:43:08 +0200 Subject: [PATCH 0302/2078] Fixing typo --- cookbook/assetic/uglifyjs.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/assetic/uglifyjs.rst b/cookbook/assetic/uglifyjs.rst index 54c1af2f6d3..06eae96a7f6 100644 --- a/cookbook/assetic/uglifyjs.rst +++ b/cookbook/assetic/uglifyjs.rst @@ -33,7 +33,7 @@ you need to `install node.js`_. Afterwards you can install UglifyJs using npm: .. tip:: This cookbook uses UglifyJs 1 instead of the newer version 2 to be compatible - with old assetic versions. If you wantt to use UglifyJs version 2, make sure + with old assetic versions. If you want to use UglifyJs version 2, make sure to also use the assetic filter for this version and apply the correct configuration. Configure the UglifyJs Filter From 07b3d2f3a67aa0d84aa670a4ba9eb9ac13508007 Mon Sep 17 00:00:00 2001 From: Sebastian Goettschkes Date: Sun, 12 May 2013 06:15:59 +0200 Subject: [PATCH 0303/2078] Adding UglifyCss and changing some wording --- cookbook/assetic/uglifyjs.rst | 78 ++++++++++++++++++++++++++++++++--- 1 file changed, 72 insertions(+), 6 deletions(-) diff --git a/cookbook/assetic/uglifyjs.rst b/cookbook/assetic/uglifyjs.rst index 06eae96a7f6..602c93b377d 100644 --- a/cookbook/assetic/uglifyjs.rst +++ b/cookbook/assetic/uglifyjs.rst @@ -1,12 +1,16 @@ .. index:: single: Assetic; UglifyJs -How to Minify JavaScripts with UglifyJs -======================================= +How to Minify CSS/JS Files (using UglifyJs and UglifyCss) +========================================================= `UglifyJs`_ is a javascript parser/compressor/beautifier toolkit. It can be used to combine and minify javascript assets so they need less HTTP requests and makes -the website load faster. +the website load faster. `UglifyCss`_ is a css compressor/beautifier much like +`UglifyJs`. + +In this cookbook, the installation, configuration and usage of `UglifyJs` is shown +in detail. `UglifyCss` works pretty much the same way and is only talked about briefly. Install UglifyJs ---------------- @@ -123,13 +127,75 @@ your assets are a part of the view layer, this work is done in your templates: With the addition of the ``uglifyjs`` filter to the asset tags above, you should now see minified JavaScripts coming over the wire much faster. +Install, configure and use UglifyCss +------------------------------------ + +The usage of `UglifyCss` works the same way as `UglifyJs`. First, make sure +the node package is installed: + +.. code-block:: bash + + $ npm install -g uglifycss + +Next, add the configuration for this filter: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + assetic: + filters: + uglifycss: + bin: /usr/local/bin/uglifycss + + .. code-block:: xml + + + + + + + .. code-block:: php + + // app/config/config.php + $container->loadFromExtension('assetic', array( + 'filters' => array( + 'uglifycss' => array( + 'bin' => '/usr/local/bin/uglifycss', + ), + ), + )); + +To use the filter for your css files, make sure to use the assetics helper in +your template: + +.. configuration-block:: + + .. code-block:: html+jinja + + {% javascripts '@AcmeFooBundle/Resources/public/css/*' filter='uglifycss' %} + + {% endjavascripts %} + + .. code-block:: html+php + + javascripts( + array('@AcmeFooBundle/Resources/public/css/*'), + array('uglifycss') + ) as $url): ?> + + + Disable Minification in Debug Mode ---------------------------------- Minified JavaScripts are very difficult to read, let alone -debug. Because of this, Assetic lets you disable a certain filter when your +debug. Because of this, Assetics lets you disable a certain filter when your application is in debug mode. You can do this by prefixing the filter name -in your template with a question mark: ``?``. This tells Assetic to only +in your template with a question mark: ``?``. This tells Assetics to only apply this filter when debug mode is off. .. configuration-block:: @@ -149,7 +215,6 @@ apply this filter when debug mode is off. - .. tip:: Instead of adding the filter to the asset tags, you can also globally @@ -161,4 +226,5 @@ apply this filter when debug mode is off. .. _`UglifyJs`: https://github.com/mishoo/UglifyJS +.. _`UglifyCss`: https://github.com/fmarcia/UglifyCSS .. _`install node.js`: http://nodejs.org/ From 28f4ae7fb040069e71422c2abffbbb6fb992711b Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 12 Jun 2013 10:47:25 -0500 Subject: [PATCH 0304/2078] [#2406] Proofreading new UglifyJs entry by @Sgoettschkes * Updating some language * Adding additional clarification details * Updating to use UglifyJS version 2, since this is merged into Symfony 2.2, which uses an AsseticBundle that supports this Uglify version --- book/page_creation.rst | 2 + cookbook/assetic/asset_management.rst | 2 + cookbook/assetic/index.rst | 2 +- cookbook/assetic/uglifyjs.rst | 170 +++++++++++++++----------- cookbook/assetic/yuicompressor.rst | 6 + cookbook/map.rst.inc | 2 +- 6 files changed, 109 insertions(+), 75 deletions(-) diff --git a/book/page_creation.rst b/book/page_creation.rst index f90ae6d4f48..33a91bdde80 100644 --- a/book/page_creation.rst +++ b/book/page_creation.rst @@ -245,6 +245,8 @@ application should greet you: http://localhost/app_dev.php/hello/Ryan +.. _book-page-creation-prod-cache-clear: + .. tip:: You can also view your app in the "prod" :ref:`environment` diff --git a/cookbook/assetic/asset_management.rst b/cookbook/assetic/asset_management.rst index 50955309379..8580c15cf67 100644 --- a/cookbook/assetic/asset_management.rst +++ b/cookbook/assetic/asset_management.rst @@ -359,6 +359,8 @@ by Symfony (as the asset files are in the ``dev`` environment). This is on purpose - letting Symfony generate these files dynamically in a production environment is just too slow. +.. _cookbook-asetic-dump-prod: + Instead, each time you use your app in the ``prod`` environment (and therefore, each time you deploy), you should run the following task: diff --git a/cookbook/assetic/index.rst b/cookbook/assetic/index.rst index cb29611970b..a4b084c22f0 100644 --- a/cookbook/assetic/index.rst +++ b/cookbook/assetic/index.rst @@ -5,7 +5,7 @@ Assetic :maxdepth: 2 asset_management - yuicompressor uglifyjs + yuicompressor jpeg_optimize apply_to_option diff --git a/cookbook/assetic/uglifyjs.rst b/cookbook/assetic/uglifyjs.rst index 602c93b377d..6f3809d6441 100644 --- a/cookbook/assetic/uglifyjs.rst +++ b/cookbook/assetic/uglifyjs.rst @@ -5,46 +5,60 @@ How to Minify CSS/JS Files (using UglifyJs and UglifyCss) ========================================================= `UglifyJs`_ is a javascript parser/compressor/beautifier toolkit. It can be used -to combine and minify javascript assets so they need less HTTP requests and makes -the website load faster. `UglifyCss`_ is a css compressor/beautifier much like -`UglifyJs`. +to combine and minify javascript assets so that they require less HTTP requests +and make your site load faster. `UglifyCss`_ is a css compressor/beautifier +that is very similar to UglifyJs. -In this cookbook, the installation, configuration and usage of `UglifyJs` is shown -in detail. `UglifyCss` works pretty much the same way and is only talked about briefly. +In this cookbook, the installation, configuration and usage of UglifyJs is +shown in detail. ``UglifyCss`` works pretty much the same way and is only +talked about briefly. Install UglifyJs ---------------- -UglifyJs is build as an node.js npm module and can be installed using npm. First, -you need to `install node.js`_. Afterwards you can install UglifyJs using npm: +UglifyJs is available as an `Node.js`_ npm module and can be installed using +npm. First, you need to `install node.js`_. Afterwards you can install UglifyJs +using npm: .. code-block:: bash - $ npm install -g uglify-js@1 - + $ npm install -g uglify-js + +This command will install UglifyJs globally and you may need to run it as +a root user. + .. note:: - It's also possible to install UglifyJs for your symfony project only. To do this, - install it without the ``-g`` option and specify the path where to put the module: - + It's also possible to install UglifyJs inside your project only. To do + this, install it without the ``-g`` option and specify the path where + to put the module: + .. code-block:: bash - - $ npm install uglify-js@1 /path/to/symfony/app/Resources - + + $ cd /path/to/symfony + $ mkdir app/Resources/node_modules + $ npm install uglify-js --prefix app/Resources + It is recommended that you install UglifyJs in your ``app/Resources`` folder - and add the ``node_modules`` folder to version control. - -.. tip:: - - This cookbook uses UglifyJs 1 instead of the newer version 2 to be compatible - with old assetic versions. If you want to use UglifyJs version 2, make sure - to also use the assetic filter for this version and apply the correct configuration. + and add the ``node_modules`` folder to version control. Alternatively, + you can create an npm `package.json`_ file and specify your dependencies + there. + +Depending on your installation method, you should either be able to execute +the ``uglifyjs`` executable globally, or execute the physical file that lives +in the ``node_modules`` directory: + +.. code-block:: bash + + $ uglifyjs --help -Configure the UglifyJs Filter ------------------------------ + $ ./app/Resources/node_modules/.bin/uglifyjs --help -Now we need to configure symfony2 to use the UglifyJs Filter when processing your -stylesheets: +Configure the uglifyjs2 Filter +------------------------------ + +Now we need to configure Symfony2 to use the ``uglifyjs2`` filter when processing +your javascripts: .. configuration-block:: @@ -53,7 +67,8 @@ stylesheets: # app/config/config.yml assetic: filters: - uglifyjs: + uglifyjs2: + # the path to the uglifyjs executable bin: /usr/local/bin/uglifyjs .. code-block:: xml @@ -61,7 +76,7 @@ stylesheets: @@ -70,7 +85,7 @@ stylesheets: // app/config/config.php $container->loadFromExtension('assetic', array( 'filters' => array( - 'uglifyjs' => array( + 'uglifyjs2' => array( 'bin' => '/usr/local/bin/uglifyjs', ), ), @@ -92,7 +107,7 @@ stylesheets: If you installed UglifyJs locally, you can find the bin folder inside the ``node_modules`` folder. It's called ``.bin`` in this case. -You now have access to the ``uglifyjs`` Filter in your application. +You now have access to the ``uglifyjs2`` filter in your application. Minify your Assets ------------------ @@ -104,7 +119,7 @@ your assets are a part of the view layer, this work is done in your templates: .. code-block:: html+jinja - {% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='uglifyjs' %} + {% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='uglifyjs2' %} {% endjavascripts %} @@ -112,7 +127,7 @@ your assets are a part of the view layer, this work is done in your templates: javascripts( array('@AcmeFooBundle/Resources/public/js/*'), - array('uglifyjs') + array('uglifyj2s') ) as $url): ?> @@ -121,16 +136,55 @@ your assets are a part of the view layer, this work is done in your templates: The above example assumes that you have a bundle called ``AcmeFooBundle`` and your JavaScript files are in the ``Resources/public/js`` directory under - your bundle. This isn't important however - you can include your Javascript + your bundle. This isn't important however - you can include your JavaScript files no matter where they are. -With the addition of the ``uglifyjs`` filter to the asset tags above, you should -now see minified JavaScripts coming over the wire much faster. +With the addition of the ``uglifyjs2`` filter to the asset tags above, you +should now see minified JavaScripts coming over the wire much faster. + +Disable Minification in Debug Mode +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Minified JavaScripts are very difficult to read, let alone debug. Because of +this, Assetic lets you disable a certain filter when your application is in +debug (e.g. ``app_dev.php``) mode. You can do this by prefixing the filter name +in your template with a question mark: ``?``. This tells Assetic to only +apply this filter when debug mode is off (e.g. ``app.php``): + +.. configuration-block:: + + .. code-block:: html+jinja + + {% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='?uglifyjs2' %} + + {% endjavascripts %} + + .. code-block:: html+php + + javascripts( + array('@AcmeFooBundle/Resources/public/js/*'), + array('?uglifyjs2') + ) as $url): ?> + + + +To try this out, switch to your ``prod`` environment (``app.php``). But before +you do, don't forget to :ref:`clear your cache` +and :ref:`dump your assetic assets`. + +.. tip:: + + Instead of adding the filter to the asset tags, you can also globally + enable it by adding the apply-to attribute to the filter configuration, for + example in the ``uglifyjs2`` filter ``apply_to: "\.js$"``. To only have + the filter applied in production, add this to the ``config_prod`` file + rather than the common config file. For details on applying filters by + file extension, see :ref:`cookbook-assetic-apply-to`. Install, configure and use UglifyCss ------------------------------------ -The usage of `UglifyCss` works the same way as `UglifyJs`. First, make sure +The usage of UglifyCss works the same way as UglifyJs. First, make sure the node package is installed: .. code-block:: bash @@ -169,8 +223,8 @@ Next, add the configuration for this filter: ), )); -To use the filter for your css files, make sure to use the assetics helper in -your template: +To use the filter for your css files, add the filter to the Assetic ``stylesheets`` +helper: .. configuration-block:: @@ -189,42 +243,12 @@ your template: -Disable Minification in Debug Mode ----------------------------------- - -Minified JavaScripts are very difficult to read, let alone -debug. Because of this, Assetics lets you disable a certain filter when your -application is in debug mode. You can do this by prefixing the filter name -in your template with a question mark: ``?``. This tells Assetics to only -apply this filter when debug mode is off. - -.. configuration-block:: - - .. code-block:: html+jinja - - {% javascripts '@AcmeFooBundle/Resources/public/js/*' filter='?uglifyjs' %} - - {% endjavascripts %} - - .. code-block:: html+php - - javascripts( - array('@AcmeFooBundle/Resources/public/js/*'), - array('?uglifyjs') - ) as $url): ?> - - - -.. tip:: - - Instead of adding the filter to the asset tags, you can also globally - enable it by adding the apply-to attribute to the filter configuration, for - example in the ``uglifyjs`` filter ``apply_to: "\.js$"``. To only have the filter - applied in production, add this to the ``config_prod`` file rather than the - common config file. For details on applying filters by file extension, - see :ref:`cookbook-assetic-apply-to`. - +Just like with the ``uglifyjs2`` filter, if you prefix the filter name with +``?`` (i.e. ``?uglifycss``), the minification will only happen when you're +not in debug mode. .. _`UglifyJs`: https://github.com/mishoo/UglifyJS .. _`UglifyCss`: https://github.com/fmarcia/UglifyCSS +.. _`Node.js`: http://nodejs.org/ .. _`install node.js`: http://nodejs.org/ +.. _`package.json`: http://package.json.nodejitsu.com/ \ No newline at end of file diff --git a/cookbook/assetic/yuicompressor.rst b/cookbook/assetic/yuicompressor.rst index 7524d6741da..b948da87b27 100644 --- a/cookbook/assetic/yuicompressor.rst +++ b/cookbook/assetic/yuicompressor.rst @@ -8,6 +8,11 @@ Yahoo! provides an excellent utility for minifying JavaScripts and stylesheets so they travel over the wire faster, the `YUI Compressor`_. Thanks to Assetic, you can take advantage of this tool very easily. +.. caution:: + + The YUI Compressor is going through a `deprecation process`_. But don't + worry! See :doc:`/cookbook/assetic/uglifyjs` for an alternative. + Download the YUI Compressor JAR ------------------------------- @@ -161,3 +166,4 @@ apply this filter when debug mode is off. .. _`YUI Compressor`: http://developer.yahoo.com/yui/compressor/ .. _`Download the JAR`: http://yuilibrary.com/projects/yuicompressor/ +.. _`deprecation process`: http://www.yuiblog.com/blog/2012/10/16/state-of-yui-compressor/ \ No newline at end of file diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index fad3ccb3564..ca5f6610a39 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -1,8 +1,8 @@ * :doc:`/cookbook/assetic/index` * :doc:`/cookbook/assetic/asset_management` - * :doc:`/cookbook/assetic/yuicompressor` * :doc:`/cookbook/assetic/uglifyjs` + * :doc:`/cookbook/assetic/yuicompressor` * :doc:`/cookbook/assetic/jpeg_optimize` * :doc:`/cookbook/assetic/apply_to_option` From 4b6a78dda6350a26956466689c02895796a8fc6e Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 13 Jun 2013 14:14:34 +0200 Subject: [PATCH 0305/2078] fixed wrong doc see symfony/symfony#7337 --- components/dom_crawler.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index 48a824a30c0..29a08890129 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -309,7 +309,7 @@ and uploading files:: // select an option $form['registration[birthday][year]']->select(1984); - // select many options from a "multiple" select or checkboxes + // select many options from a "multiple" select $form['registration[interests]']->select(array('symfony', 'cookies')); // even fake a file upload From 041df67bb77d42b05d6714f6d7694536ab29ff0d Mon Sep 17 00:00:00 2001 From: WouterJ Date: Thu, 13 Jun 2013 17:59:31 +0200 Subject: [PATCH 0306/2078] Fixed deprecated route methods --- book/routing.rst | 6 +++++- cookbook/routing/service_container_parameters.rst | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/book/routing.rst b/book/routing.rst index 09ebf2d94d8..dd69eb1ba9f 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -1026,7 +1026,11 @@ instead of simply ``/hello/{name}``: use Symfony\Component\Routing\RouteCollection; $collection = new RouteCollection(); - $collection->addCollection($loader->import("@AcmeHelloBundle/Resources/config/routing.php"), '/admin'); + + $acmeHello = $loader->import("@AcmeHelloBundle/Resources/config/routing.php"); + $acmeHello->setPrefix('/admin'); + + $collection->addCollection($acmeHello); return $collection; diff --git a/cookbook/routing/service_container_parameters.rst b/cookbook/routing/service_container_parameters.rst index 8b6d100e264..d7dbd5a6199 100644 --- a/cookbook/routing/service_container_parameters.rst +++ b/cookbook/routing/service_container_parameters.rst @@ -75,7 +75,7 @@ in your container: .. code-block:: php - # app/config/config.php + // app/config/config.php $container->setParameter('acme_demo.locales', 'en|es'); You can also use a parameter to define your route path (or part of your From bfad41882aacfc33320133d06619ff034e607b33 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 16 Jun 2013 13:27:00 +0200 Subject: [PATCH 0307/2078] Removed trailing whitespace --- book/doctrine.rst | 2 +- book/forms.rst | 12 ++--- book/from_flat_php_to_symfony2.rst | 8 +-- book/http_fundamentals.rst | 2 +- book/installation.rst | 16 +++--- book/internals.rst | 22 ++++---- book/page_creation.rst | 6 +-- book/service_container.rst | 2 +- book/templating.rst | 2 +- book/translation.rst | 4 +- components/config/definition.rst | 4 +- components/console/helpers/dialoghelper.rst | 50 +++++++++---------- .../console/helpers/formatterhelper.rst | 14 +++--- components/console/helpers/progresshelper.rst | 2 +- components/dependency_injection/advanced.rst | 2 +- components/dependency_injection/factories.rst | 18 +++---- .../dependency_injection/parentservices.rst | 2 +- components/dependency_injection/types.rst | 4 +- components/dom_crawler.rst | 2 +- components/http_foundation/introduction.rst | 4 +- components/http_kernel/introduction.rst | 10 ++-- components/map.rst.inc | 2 +- components/options_resolver.rst | 4 +- components/process.rst | 12 ++--- components/property_access/introduction.rst | 2 +- components/serializer.rst | 2 +- components/using_components.rst | 4 +- contributing/code/standards.rst | 2 +- contributing/documentation/format.rst | 4 +- contributing/map.rst.inc | 2 +- cookbook/assetic/uglifyjs.rst | 24 ++++----- cookbook/assetic/yuicompressor.rst | 6 +-- cookbook/bundles/inheritance.rst | 2 +- cookbook/cache/varnish.rst | 24 ++++----- cookbook/configuration/environments.rst | 4 +- .../configuration/pdo_session_storage.rst | 4 +- .../web_server_configuration.rst | 2 +- cookbook/console/sending_emails.rst | 18 +++---- cookbook/doctrine/file_uploads.rst | 2 +- cookbook/email/spool.rst | 2 +- cookbook/event_dispatcher/index.rst | 2 +- cookbook/form/data_transformers.rst | 2 +- cookbook/form/form_customization.rst | 2 +- cookbook/form/unit_testing.rst | 2 +- cookbook/form/use_virtuals_forms.rst | 2 +- cookbook/logging/monolog.rst | 12 ++--- cookbook/logging/monolog_email.rst | 26 +++++----- cookbook/routing/method_parameters.rst | 2 +- cookbook/routing/slash_in_parameter.rst | 10 ++-- .../custom_authentication_provider.rst | 4 +- cookbook/security/entity_provider.rst | 2 +- cookbook/security/force_https.rst | 6 +-- cookbook/security/form_login.rst | 16 +++--- cookbook/security/voters.rst | 16 +++--- cookbook/symfony1.rst | 8 +-- cookbook/testing/database.rst | 26 +++++----- cookbook/web_services/php_soap_extension.rst | 2 +- cookbook/workflow/new_project_git.rst | 2 +- quick_tour/the_big_picture.rst | 4 +- 59 files changed, 228 insertions(+), 228 deletions(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index e9d09d5b784..ba315aaa4d8 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -91,7 +91,7 @@ information. By convention, this information is usually configured in an .. code-block:: php - + // app/config/config.php $configuration->loadFromExtension('doctrine', array( 'dbal' => array( diff --git a/book/forms.rst b/book/forms.rst index 945fc177b7a..591967ca273 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -1610,7 +1610,7 @@ but here's a short example: The ``constraints`` option, which accepts a single constraint or an array of constraints (before 2.1, the option was called ``validation_constraint``, and only accepted a single constraint) is new to Symfony 2.1. - + .. code-block:: php use Symfony\Component\Validator\Constraints\Length; @@ -1630,15 +1630,15 @@ but here's a short example: .. tip:: - If you are using Validation Groups, you need to either reference the - ``Default`` group when creating the form, or set the correct group on + If you are using Validation Groups, you need to either reference the + ``Default`` group when creating the form, or set the correct group on the constraint you are adding. - + .. code-block:: php new NotBlank(array('groups' => array('create', 'update')) - - + + Final Thoughts -------------- diff --git a/book/from_flat_php_to_symfony2.rst b/book/from_flat_php_to_symfony2.rst index ff684736571..7fca407dd9a 100644 --- a/book/from_flat_php_to_symfony2.rst +++ b/book/from_flat_php_to_symfony2.rst @@ -422,8 +422,8 @@ Add a Touch of Symfony2 Symfony2 to the rescue. Before actually using Symfony2, you need to download it. This can be done by using Composer, which takes care of downloading the -correct version and all its dependencies and provides an autoloader. An -autoloader is a tool that makes it possible to start using PHP classes +correct version and all its dependencies and provides an autoloader. An +autoloader is a tool that makes it possible to start using PHP classes without explicitly including the file containing the class. In your root directory, create a ``composer.json`` file with the following @@ -439,7 +439,7 @@ content: "files": ["model.php","controllers.php"] } } - + Next, `download Composer`_ and then run the following command, which will download Symfony into a vendor/ directory: @@ -448,7 +448,7 @@ into a vendor/ directory: $ php composer.phar install Beside downloading your dependencies, Composer generates a ``vendor/autoload.php`` file, -which takes care of autoloading for all the files in the Symfony Framework as well as +which takes care of autoloading for all the files in the Symfony Framework as well as the files mentioned in the autoload section of your ``composer.json``. Core to Symfony's philosophy is the idea that an application's main job is diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index 16520777863..507eb697a94 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -358,7 +358,7 @@ Stay Organized ~~~~~~~~~~~~~~ Inside your front controller, you have to figure out which code should be -executed and what the content to return should be. To figure this out, you'll +executed and what the content to return should be. To figure this out, you'll need to check the incoming URI and execute different parts of your code depending on that value. This can get ugly quickly:: diff --git a/book/installation.rst b/book/installation.rst index e79fa0a172d..7da652ad2c4 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -188,7 +188,7 @@ Symfony itself - into the ``vendor/`` directory. When running ``php composer.phar install`` or ``php composer.phar update``, composer will execute post install/update commands to clear the cache and install assets. By default, the assets will be copied into your ``web`` - directory. + directory. Instead of copying your Symfony assets, you can create symlinks if your operating system supports it. To create symlinks, add an entry @@ -239,7 +239,7 @@ If there are any issues, correct them now before moving on. On a UNIX system, this can be done with one of the following commands: .. code-block:: bash - + $ ps aux | grep httpd or @@ -261,7 +261,7 @@ If there are any issues, correct them now before moving on. $ sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs $ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs - + **2. Using Acl on a system that does not support chmod +a** Some systems don't support ``chmod +a``, but do support another utility @@ -304,12 +304,12 @@ Symfony2 should welcome and congratulate you for your hard work so far! .. image:: /images/quick_tour/welcome.png .. tip:: - - To get nice and short urls you should point the document root of your - webserver or virtual host to the ``Symfony/web/`` directory. Though - this is not required for development it is recommended at the time your + + To get nice and short urls you should point the document root of your + webserver or virtual host to the ``Symfony/web/`` directory. Though + this is not required for development it is recommended at the time your application goes into production as all system and configuration files - become inaccessible to clients then. For information on configuring + become inaccessible to clients then. For information on configuring your specific web server document root, read :doc:`/cookbook/configuration/web_server_configuration` or consult the official documentation of your webserver: diff --git a/book/internals.rst b/book/internals.rst index d61951b86fb..ba608b79227 100644 --- a/book/internals.rst +++ b/book/internals.rst @@ -146,10 +146,10 @@ the Request attributes. Handling Requests ~~~~~~~~~~~~~~~~~ -The :method:`Symfony\\Component\\HttpKernel\\HttpKernel::handle` method -takes a ``Request`` and *always* returns a ``Response``. To convert the -``Request``, ``handle()`` relies on the Resolver and an ordered chain of -Event notifications (see the next section for more information about each +The :method:`Symfony\\Component\\HttpKernel\\HttpKernel::handle` method +takes a ``Request`` and *always* returns a ``Response``. To convert the +``Request``, ``handle()`` relies on the Resolver and an ordered chain of +Event notifications (see the next section for more information about each Event): #. Before doing anything else, the ``kernel.request`` event is notified -- if @@ -209,14 +209,14 @@ Each event thrown by the Kernel is a subclass of :class:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent`. This means that each event has access to the same basic information: -* :method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getRequestType` - - returns the *type* of the request (``HttpKernelInterface::MASTER_REQUEST`` +* :method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getRequestType` + - returns the *type* of the request (``HttpKernelInterface::MASTER_REQUEST`` or ``HttpKernelInterface::SUB_REQUEST``); -* :method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getKernel` +* :method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getKernel` - returns the Kernel handling the request; -* :method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getRequest` +* :method:`Symfony\\Component\\HttpKernel\\Event\\KernelEvent::getRequest` - returns the current ``Request`` being handled. ``getRequestType()`` @@ -513,7 +513,7 @@ HTTP header of the Response:: want to get the token for an Ajax request, use a tool like Firebug to get the value of the ``X-Debug-Token`` HTTP header. -Use the :method:`Symfony\\Component\\HttpKernel\\Profiler\\Profiler::find` +Use the :method:`Symfony\\Component\\HttpKernel\\Profiler\\Profiler::find` method to access tokens based on some criteria:: // get the latest 10 tokens @@ -526,8 +526,8 @@ method to access tokens based on some criteria:: $tokens = $container->get('profiler')->find('127.0.0.1', '', 10); If you want to manipulate profiling data on a different machine than the one -where the information were generated, use the -:method:`Symfony\\Component\\HttpKernel\\Profiler\\Profiler::export` and +where the information were generated, use the +:method:`Symfony\\Component\\HttpKernel\\Profiler\\Profiler::export` and :method:`Symfony\\Component\\HttpKernel\\Profiler\\Profiler::import` methods:: // on the production machine diff --git a/book/page_creation.rst b/book/page_creation.rst index 33a91bdde80..00c0e2b84b4 100644 --- a/book/page_creation.rst +++ b/book/page_creation.rst @@ -516,9 +516,9 @@ You'll learn more about each of these directories in later chapters. .. sidebar:: Autoloading - When Symfony is loading, a special file - ``vendor/autoload.php`` - is - included. This file is created by Composer and will autoload all - application files living in the `src/` folder as well as all + When Symfony is loading, a special file - ``vendor/autoload.php`` - is + included. This file is created by Composer and will autoload all + application files living in the `src/` folder as well as all third-party libraries mentioned in the ``composer.json`` file. Because of the autoloader, you never need to worry about using ``include`` diff --git a/book/service_container.rst b/book/service_container.rst index 1de05025ee0..c9b0b433d83 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -255,7 +255,7 @@ looks up the value of each parameter and uses it in the service definition. .. caution:: - You may receive a + You may receive a :class:`Symfony\\Component\\DependencyInjection\\Exception\\ScopeWideningInjectionException` when passing the ``request`` service as an argument. To understand this problem better and learn how to solve it, refer to the cookbook article diff --git a/book/templating.rst b/book/templating.rst index 04e420e3bc3..ec36f633c26 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -1346,7 +1346,7 @@ a variable that is trusted and contains markup that should not be escaped. Suppose that administrative users are able to write articles that contain HTML code. By default, Twig will escape the article body. -To render it normally, add the ``raw`` filter: +To render it normally, add the ``raw`` filter: .. code-block:: jinja diff --git a/book/translation.rst b/book/translation.rst index 16ea6db9eb7..e2b51c43729 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -512,7 +512,7 @@ via the ``request`` object:: .. index:: single: Translations; Fallback and default locale -It is also possible to store the locale in the session instead of on a per +It is also possible to store the locale in the session instead of on a per request basis. If you do this, each subsequent request will have this locale. .. code-block:: php @@ -556,7 +556,7 @@ by defining a ``default_locale`` for the framework: .. versionadded:: 2.1 The ``default_locale`` parameter was defined under the session key - originally, however, as of 2.1 this has been moved. This is because the + originally, however, as of 2.1 this has been moved. This is because the locale is now set on the request instead of the session. .. _book-translation-locale-url: diff --git a/components/config/definition.rst b/components/config/definition.rst index 2b9726a0de7..af13de4ec32 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -293,7 +293,7 @@ you can take advantage of the shortcut ->defaultFalse() ; -The ``canBeDisabled`` method looks about the same except that the section +The ``canBeDisabled`` method looks about the same except that the section would be enabled by default. Merging options @@ -384,7 +384,7 @@ make both of these ``auto_connect``. .. caution:: - The target key will not be altered if it's mixed like + The target key will not be altered if it's mixed like ``foo-bar_moo`` or if it already exists. Another difference between Yaml and XML is in the way arrays of values may diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index 927d8a80ebd..1c910d4106d 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -11,7 +11,7 @@ helper set, which you can get by calling $dialog = $this->getHelperSet()->get('dialog'); -All the methods inside the Dialog Helper have an +All the methods inside the Dialog Helper have an :class:`Symfony\\Component\\Console\\Output\\OutputInterface` as first the argument, the question as the second argument and the default value as last argument. @@ -19,7 +19,7 @@ argument. Asking the User for confirmation -------------------------------- -Suppose you want to confirm an action before actually executing it. Add +Suppose you want to confirm an action before actually executing it. Add the following to your command:: // ... @@ -32,8 +32,8 @@ the following to your command:: } In this case, the user will be asked "Continue with this action", and will return -``true`` if the user answers with ``y`` or false in any other case. The third -argument to ``askConfirmation`` is the default value to return if the user doesn't +``true`` if the user answers with ``y`` or false in any other case. The third +argument to ``askConfirmation`` is the default value to return if the user doesn't enter any input. Asking the User for Information @@ -82,8 +82,8 @@ Validating the Answer You can even validate the answer. For instance, in the last example you asked for the bundle name. Following the Symfony2 naming conventions, it should -be suffixed with ``Bundle``. You can validate that by using the -:method:`Symfony\\Component\\Console\\Helper\\DialogHelper::askAndValidate` +be suffixed with ``Bundle``. You can validate that by using the +:method:`Symfony\\Component\\Console\\Helper\\DialogHelper::askAndValidate` method:: // ... @@ -105,16 +105,16 @@ method:: This methods has 2 new arguments, the full signature is:: askAndValidate( - OutputInterface $output, - string|array $question, - callback $validator, - integer $attempts = false, + OutputInterface $output, + string|array $question, + callback $validator, + integer $attempts = false, string $default = null ) The ``$validator`` is a callback which handles the validation. It should throw an exception if there is something wrong. The exception message is displayed -in the console, so it is a good practice to put some useful information in it. The callback +in the console, so it is a good practice to put some useful information in it. The callback function should also return the value of the user's input if the validation was successful. You can set the max number of times to ask in the ``$attempts`` argument. @@ -162,24 +162,24 @@ could use the ``ask`` method described above or, to make sure the user provided a correct answer, the ``askAndValidate`` method. Both have the disadvantage that you need to handle incorrect values yourself. -Instead, you can use the +Instead, you can use the :method:`Symfony\\Component\\Console\\Helper\\DialogHelper::select` method, which makes sure that the user can only enter a valid string from a predefined list:: $dialog = $app->getHelperSet()->get('dialog'); $colors = array('red', 'blue', 'yellow'); - + $color = $dialog->select( - $output, - 'Please select your favorite color (default to red)', - $colors, + $output, + 'Please select your favorite color (default to red)', + $colors, 0 ); $output->writeln('You have just selected: ' . $colors[$color]); - + // ... do something with the color - + The option which should be selected by default is provided with the fourth parameter. The default is ``null``, which means that no option is the default one. @@ -197,23 +197,23 @@ from the command line, you need to overwrite the HelperSet used by the command:: use Symfony\Component\Console\Helper\DialogHelper; use Symfony\Component\Console\Helper\HelperSet; - + // ... public function testExecute() { // ... $commandTester = new CommandTester($command); - + $dialog = $command->getHelper('dialog'); - $dialog->setInputStream($this->getInputStream('Test\n')); + $dialog->setInputStream($this->getInputStream('Test\n')); // Equals to a user inputing "Test" and hitting ENTER // If you need to enter a confirmation, "yes\n" will work - + $commandTester->execute(array('command' => $command->getName())); - + // $this->assertRegExp('/.../', $commandTester->getDisplay()); } - + protected function getInputStream($input) { $stream = fopen('php://memory', 'r+', false); @@ -222,7 +222,7 @@ from the command line, you need to overwrite the HelperSet used by the command:: return $stream; } - + By setting the inputStream of the ``DialogHelper``, you imitate what the console would do internally with all user input through the cli. This way you can test any user interaction (even complex ones) by passing an appropriate diff --git a/components/console/helpers/formatterhelper.rst b/components/console/helpers/formatterhelper.rst index 6d69848bb00..cad14a16619 100644 --- a/components/console/helpers/formatterhelper.rst +++ b/components/console/helpers/formatterhelper.rst @@ -29,7 +29,7 @@ actual message to the right of this. Minus the color, it looks like this: [SomeSection] Here is some message related to that section -To reproduce this style, you can use the +To reproduce this style, you can use the :method:`Symfony\\Component\\Console\\Helper\\FormatterHelper::formatSection` method:: @@ -38,14 +38,14 @@ method:: 'Here is some message related to that section' ); $output->writeln($formattedLine); - + Print Messages in a Block ------------------------- Sometimes you want to be able to print a whole block of text with a background color. Symfony uses this when printing error messages. -If you print your error message on more than one line manually, you will +If you print your error message on more than one line manually, you will notice that the background is only as long as each individual line. Use the :method:`Symfony\\Component\\Console\\Helper\\FormatterHelper::formatBlock` to generate a block output:: @@ -53,13 +53,13 @@ to generate a block output:: $errorMessages = array('Error!', 'Something went wrong'); $formattedBlock = $formatter->formatBlock($errorMessages, 'error'); $output->writeln($formattedBlock); - -As you can see, passing an array of messages to the + +As you can see, passing an array of messages to the :method:`Symfony\\Component\\Console\\Helper\\FormatterHelper::formatBlock` -method creates the desired output. If you pass ``true`` as third parameter, the +method creates the desired output. If you pass ``true`` as third parameter, the block will be formatted with more padding (one blank line above and below the messages and 2 spaces on the left and right). The exact "style" you use in the block is up to you. In this case, you're using the pre-defined ``error`` style, but there are other styles, or you can create -your own. See :ref:`components-console-coloring`. \ No newline at end of file +your own. See :ref:`components-console-coloring`. diff --git a/components/console/helpers/progresshelper.rst b/components/console/helpers/progresshelper.rst index 73b008f91d6..f43f7caeaf2 100644 --- a/components/console/helpers/progresshelper.rst +++ b/components/console/helpers/progresshelper.rst @@ -1,6 +1,6 @@ .. index:: single: Console Helpers; Progress Helper - + Progress Helper =============== diff --git a/components/dependency_injection/advanced.rst b/components/dependency_injection/advanced.rst index 677c3541ce4..a7444038f60 100644 --- a/components/dependency_injection/advanced.rst +++ b/components/dependency_injection/advanced.rst @@ -122,4 +122,4 @@ the service itself gets loaded. To do so, you can use the ``file`` directive. $container->setDefinition('foo', $definition); Notice that Symfony will internally call the PHP function require_once -which means that your file will be included only once per request. +which means that your file will be included only once per request. diff --git a/components/dependency_injection/factories.rst b/components/dependency_injection/factories.rst index be9b8a9dee1..4f939b04527 100644 --- a/components/dependency_injection/factories.rst +++ b/components/dependency_injection/factories.rst @@ -4,7 +4,7 @@ Using a Factory to Create Services ================================== -Symfony2's Service Container provides a powerful way of controlling the +Symfony2's Service Container provides a powerful way of controlling the creation of objects, allowing you to specify arguments passed to the constructor as well as calling methods and setting parameters. Sometimes, however, this will not provide you with everything you need to construct your objects. @@ -20,9 +20,9 @@ object:: public function get() { $newsletterManager = new NewsletterManager(); - + // ... - + return $newsletterManager; } } @@ -43,7 +43,7 @@ class: newsletter_manager: class: "%newsletter_manager.class%" factory_class: "%newsletter_factory.class%" - factory_method: get + factory_method: get .. code-block:: xml @@ -54,7 +54,7 @@ class: - - - headers->set('Content-Type', 'text/plain') $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'filename.txt'); - + .. _component-http-foundation-json-response: diff --git a/components/http_kernel/introduction.rst b/components/http_kernel/introduction.rst index 2bad0ae7494..9cb6bb828f9 100644 --- a/components/http_kernel/introduction.rst +++ b/components/http_kernel/introduction.rst @@ -115,7 +115,7 @@ See ":ref:`http-kernel-working-example`" for a more concrete implementation. For general information on adding listeners to the events below, see :ref:`http-kernel-creating-listener`. -.. tip:: +.. tip:: Fabien Potencier also wrote a wonderful series on using the ``HttpKernel`` component and other Symfony2 components to create your own framework. See @@ -287,7 +287,7 @@ on the event object that's passed to listeners on this event. There are a few minor listeners to the ``kernel.controller`` event in the Symfony Framework, and many deal with collecting profiler data when the profiler is enabled. - + One interesting listener comes from the :doc:`SensioFrameworkExtraBundle `, which is packaged with the Symfony Standard Edition. This listener's :doc:`@ParamConverter` @@ -357,7 +357,7 @@ is the :ref:`kernel.response` event. :align: center But if the controller returns anything besides a ``Response``, then the kernel -has a little bit more work to do - :ref:`kernel.view` +has a little bit more work to do - :ref:`kernel.view` (since the end goal is *always* to generate a ``Response`` object). .. note:: @@ -444,7 +444,7 @@ method, which sends the headers and prints the ``Response`` content. which causes the web debug toolbar to be displayed. Another listener, :class:`Symfony\\Component\\Security\\Http\\Firewall\\ContextListener` serializes the current user's information into the - session so that it can be reloaded on the next request. + session so that it can be reloaded on the next request. .. _component-http-kernel-kernel-terminate: @@ -679,7 +679,7 @@ look like this:: if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { return; } - + // ... } diff --git a/components/map.rst.inc b/components/map.rst.inc index c14df50277c..66519e251f5 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -49,7 +49,7 @@ * **Filesystem** * :doc:`/components/filesystem` - + * **Finder** * :doc:`/components/finder` diff --git a/components/options_resolver.rst b/components/options_resolver.rst index 69d9f7996d0..dbfe43026eb 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -81,7 +81,7 @@ Now, try to actually use the class:: echo $person->getFirstName(); -Right now, you'll receive a +Right now, you'll receive a :class:`Symfony\\Component\\OptionsResolver\\Exception\\InvalidOptionsException`, which tells you that the options ``firstName`` and ``lastName`` do not exist. This is because you need to configure the ``OptionsResolver`` first, so it @@ -212,7 +212,7 @@ Closure as the default value:: if (GenderGuesser::isMale($options['firstName'])) { return 'male'; } - + return 'female'; }, )); diff --git a/components/process.rst b/components/process.rst index b0a2b2544dc..2c5f060ed65 100644 --- a/components/process.rst +++ b/components/process.rst @@ -63,7 +63,7 @@ anonymous function to the echo 'OUT > '.$buffer; } }); - + .. versionadded:: 2.1 The non-blocking feature was added in 2.1. @@ -71,7 +71,7 @@ Running Processes Asynchronously -------------------------------- You can also start the subprocess and then let it run asynchronously, retrieving -output and the status in your main process whenever you need it. Use the +output and the status in your main process whenever you need it. Use the :method:`Symfony\\Component\\Process\\Process::start` method to start an asynchronous process, the :method:`Symfony\\Component\\Process\\Process::isRunning` method to check if the process is done and the @@ -79,21 +79,21 @@ to check if the process is done and the $process = new Process('ls -lsa'); $process->start(); - + while ($process->isRunning()) { // waiting for process to finish } echo $process->getOutput(); - + You can also wait for a process to end if you started it asynchronously and are done doing other stuff:: $process = new Process('ls -lsa'); $process->start(); - + // ... do other things - + $process->wait(function ($type, $buffer) { if (Process:ERR === $type) { echo 'ERR > '.$buffer; diff --git a/components/property_access/introduction.rst b/components/property_access/introduction.rst index f4d4de5cb23..26991f046e9 100644 --- a/components/property_access/introduction.rst +++ b/components/property_access/introduction.rst @@ -219,7 +219,7 @@ can use setters, the magic ``__set`` or properties to set values:: } $person = new Person(); - + $accessor->setValue($person, 'firstName', 'Wouter'); $accessor->setValue($person, 'lastName', 'de Jong'); $accessor->setValue($person, 'children', array(new Person())); diff --git a/components/serializer.rst b/components/serializer.rst index d727a30e5e8..c6740878841 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -94,7 +94,7 @@ use the Serializer service created before:: // $jsonContent contains {"name":"foo","age":99} - echo $jsonContent; // or return it in a Response + echo $jsonContent; // or return it in a Response The first parameter of the :method:`Symfony\\Component\\Serializer\\Serializer::serialize` is the object to be serialized and the second is used to choose the proper encoder, diff --git a/components/using_components.rst b/components/using_components.rst index 174b041facc..c020270e76b 100644 --- a/components/using_components.rst +++ b/components/using_components.rst @@ -33,7 +33,7 @@ may also need to adjust the version (e.g. ``2.1.1`` or ``2.2.*``). You can research the component names and versions at `packagist.org`_. -**3.** `Install composer`_ if you don't already have it present on your system: +**3.** `Install composer`_ if you don't already have it present on your system: **4.** Download the vendor libraries and generate the ``vendor/autoload.php`` file: @@ -98,4 +98,4 @@ And have fun! .. _Composer: http://getcomposer.org .. _Install composer: http://getcomposer.org/download/ -.. _packagist.org: https://packagist.org/ \ No newline at end of file +.. _packagist.org: https://packagist.org/ diff --git a/contributing/code/standards.rst b/contributing/code/standards.rst index b73f9bf632a..88106afb078 100644 --- a/contributing/code/standards.rst +++ b/contributing/code/standards.rst @@ -87,7 +87,7 @@ Structure * Add a single space around operators (``==``, ``&&``, ...); -* Add a comma after each array item in a multi-line array, even after the +* Add a comma after each array item in a multi-line array, even after the last one; * Add a blank line before ``return`` statements, unless the return is alone diff --git a/contributing/documentation/format.rst b/contributing/documentation/format.rst index 072794b6226..22cbe779b9c 100644 --- a/contributing/documentation/format.rst +++ b/contributing/documentation/format.rst @@ -187,7 +187,7 @@ Installing the Sphinx extensions * Add the following to the ``conf.py`` file: .. code-block:: py - + # ... sys.path.append(os.path.abspath('_exts')) @@ -205,7 +205,7 @@ Installing the Sphinx extensions # use PHP as the primary domain primary_domain = 'php' - + # set url for API links api_url = 'http://api.symfony.com/master/%s' diff --git a/contributing/map.rst.inc b/contributing/map.rst.inc index 62a5e9f2f9e..4e42fb384b2 100644 --- a/contributing/map.rst.inc +++ b/contributing/map.rst.inc @@ -6,7 +6,7 @@ * :doc:`Tests ` * :doc:`Coding Standards` * :doc:`Code Conventions` - * :doc:`Git` + * :doc:`Git` * :doc:`License ` * **Documentation** diff --git a/cookbook/assetic/uglifyjs.rst b/cookbook/assetic/uglifyjs.rst index 6f3809d6441..c97368e6028 100644 --- a/cookbook/assetic/uglifyjs.rst +++ b/cookbook/assetic/uglifyjs.rst @@ -21,7 +21,7 @@ npm. First, you need to `install node.js`_. Afterwards you can install UglifyJs using npm: .. code-block:: bash - + $ npm install -g uglify-js This command will install UglifyJs globally and you may need to run it as @@ -90,29 +90,29 @@ your javascripts: ), ), )); - + .. note:: The path where UglifyJs is installed may vary depending on your system. To find out where npm stores the ``bin`` folder, you can use the following command: - + .. code-block:: bash - + $ npm bin -g - + It should output a folder on your system, inside which you should find the UglifyJs executable. - + If you installed UglifyJs locally, you can find the bin folder inside the ``node_modules`` folder. It's called ``.bin`` in this case. -You now have access to the ``uglifyjs2`` filter in your application. +You now have access to the ``uglifyjs2`` filter in your application. Minify your Assets ------------------ -In order to use UglifyJs on your assets, you need to apply it to them. Since +In order to use UglifyJs on your assets, you need to apply it to them. Since your assets are a part of the view layer, this work is done in your templates: .. configuration-block:: @@ -188,9 +188,9 @@ The usage of UglifyCss works the same way as UglifyJs. First, make sure the node package is installed: .. code-block:: bash - + $ npm install -g uglifycss - + Next, add the configuration for this filter: .. configuration-block:: @@ -222,7 +222,7 @@ Next, add the configuration for this filter: ), ), )); - + To use the filter for your css files, add the filter to the Assetic ``stylesheets`` helper: @@ -251,4 +251,4 @@ not in debug mode. .. _`UglifyCss`: https://github.com/fmarcia/UglifyCSS .. _`Node.js`: http://nodejs.org/ .. _`install node.js`: http://nodejs.org/ -.. _`package.json`: http://package.json.nodejitsu.com/ \ No newline at end of file +.. _`package.json`: http://package.json.nodejitsu.com/ diff --git a/cookbook/assetic/yuicompressor.rst b/cookbook/assetic/yuicompressor.rst index b948da87b27..80f71aafe03 100644 --- a/cookbook/assetic/yuicompressor.rst +++ b/cookbook/assetic/yuicompressor.rst @@ -65,10 +65,10 @@ stylesheets: ), ), )); - + .. note:: - Windows users need to remember to update config to proper java location. + Windows users need to remember to update config to proper java location. In Windows7 x64 bit by default it's ``C:\Program Files (x86)\Java\jre6\bin\java.exe``. You now have access to two new Assetic filters in your application: @@ -166,4 +166,4 @@ apply this filter when debug mode is off. .. _`YUI Compressor`: http://developer.yahoo.com/yui/compressor/ .. _`Download the JAR`: http://yuilibrary.com/projects/yuicompressor/ -.. _`deprecation process`: http://www.yuiblog.com/blog/2012/10/16/state-of-yui-compressor/ \ No newline at end of file +.. _`deprecation process`: http://www.yuiblog.com/blog/2012/10/16/state-of-yui-compressor/ diff --git a/cookbook/bundles/inheritance.rst b/cookbook/bundles/inheritance.rst index 81ed5f8bab1..456088cc0b1 100644 --- a/cookbook/bundles/inheritance.rst +++ b/cookbook/bundles/inheritance.rst @@ -34,7 +34,7 @@ simply by creating a file with the same name. .. note:: - Despite the method name, there is no parent/child relationship between + Despite the method name, there is no parent/child relationship between the bundles, it is just a way to extend and override an existing bundle. Overriding Controllers diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index 6fbaae26aeb..e461e3124ee 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -46,8 +46,8 @@ Symfony2 adds automatically: .. code-block:: text sub vcl_fetch { - /* - Check for ESI acknowledgement + /* + Check for ESI acknowledgement and remove Surrogate-Control header */ if (beresp.http.Surrogate-Control ~ "ESI/1.0") { @@ -80,8 +80,8 @@ that will invalidate the cache for a given resource: .. code-block:: text - /* - Connect to the backend server + /* + Connect to the backend server on the local machine on port 8080 */ backend default { @@ -90,11 +90,11 @@ that will invalidate the cache for a given resource: } sub vcl_recv { - /* + /* Varnish default behaviour doesn't support PURGE. - Match the PURGE request and immediately do a cache lookup, + Match the PURGE request and immediately do a cache lookup, otherwise Varnish will directly pipe the request to the backend - and bypass the cache + and bypass the cache */ if (req.request == "PURGE") { return(lookup); @@ -125,12 +125,12 @@ that will invalidate the cache for a given resource: .. caution:: You must protect the ``PURGE`` HTTP method somehow to avoid random people - purging your cached data. You can do this by setting up an access list: + purging your cached data. You can do this by setting up an access list: .. code-block:: text - /* - Connect to the backend server + /* + Connect to the backend server on the local machine on port 8080 */ backend default { @@ -169,7 +169,7 @@ that will invalidate the cache for a given resource: } sub vcl_miss { - // Match PURGE request + // Match PURGE request if (req.request == "PURGE") { // Indicate that the object isn't stored in cache error 404 "Not purged"; @@ -177,4 +177,4 @@ that will invalidate the cache for a given resource: } .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch -.. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html \ No newline at end of file +.. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html diff --git a/cookbook/configuration/environments.rst b/cookbook/configuration/environments.rst index 3cedfb91438..6515ffc0b62 100644 --- a/cookbook/configuration/environments.rst +++ b/cookbook/configuration/environments.rst @@ -38,7 +38,7 @@ class: // app/AppKernel.php // ... - + class AppKernel extends Kernel { // ... @@ -297,7 +297,7 @@ The new environment is now accessible via:: about the application or underlying infrastructure. To be sure these environments aren't accessible, the front controller is usually protected from external IP addresses via the following code at the top of the controller: - + .. code-block:: php if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) { diff --git a/cookbook/configuration/pdo_session_storage.rst b/cookbook/configuration/pdo_session_storage.rst index 3bbbff1ad42..46175ea87f4 100644 --- a/cookbook/configuration/pdo_session_storage.rst +++ b/cookbook/configuration/pdo_session_storage.rst @@ -15,10 +15,10 @@ To use it, you just need to change some parameters in ``config.yml`` (or the configuration format of your choice): .. versionadded:: 2.1 - In Symfony2.1 the class and namespace are slightly modified. You can now + In Symfony2.1 the class and namespace are slightly modified. You can now find the session storage classes in the `Session\\Storage` namespace: ``Symfony\Component\HttpFoundation\Session\Storage``. Also - note that in Symfony2.1 you should configure ``handler_id`` not ``storage_id`` like in Symfony2.0. + note that in Symfony2.1 you should configure ``handler_id`` not ``storage_id`` like in Symfony2.0. Below, you'll notice that ``%session.storage.options%`` is not used anymore. .. configuration-block:: diff --git a/cookbook/configuration/web_server_configuration.rst b/cookbook/configuration/web_server_configuration.rst index 4b993375e56..21a7bbc4818 100644 --- a/cookbook/configuration/web_server_configuration.rst +++ b/cookbook/configuration/web_server_configuration.rst @@ -97,7 +97,7 @@ are: also make sure that if you *do* deploy ``app_dev.php`` or ``config.php`` that these files are secured and not available to any outside user (the IP checking code at the top of each file does this by default). - + If you have other PHP files in your web directory that need to be executed, be sure to include them in the ``location`` block above. diff --git a/cookbook/console/sending_emails.rst b/cookbook/console/sending_emails.rst index 5bacf76955b..d3999c3c554 100644 --- a/cookbook/console/sending_emails.rst +++ b/cookbook/console/sending_emails.rst @@ -31,7 +31,7 @@ redefine the parameters it uses as default values to change the default host (localhost) and scheme (http). Starting with Symfony 2.2 you can also configure the base path if Symfony is not running in the root directory. -Note that this does not impact URLs generated via normal web requests, since those +Note that this does not impact URLs generated via normal web requests, since those will override the defaults. .. configuration-block:: @@ -91,13 +91,13 @@ service and override its settings:: Using Memory Spooling --------------------- -Sending emails in a console command works the same way as described in the +Sending emails in a console command works the same way as described in the :doc:`/cookbook/email/email` cookbook except if memory spooling is used. When using memory spooling (see the :doc:`/cookbook/email/spool` cookbook for more -information), you must be aware that because of how symfony handles console -commands, emails are not sent automatically. You must take care of flushing -the queue yourself. Use the following code to send emails inside your +information), you must be aware that because of how symfony handles console +commands, emails are not sent automatically. You must take care of flushing +the queue yourself. Use the following code to send emails inside your console command:: $container = $this->getContainer(); @@ -106,13 +106,13 @@ console command:: $transport = $container->get('swiftmailer.transport.real'); $spool->flushQueue($transport); - + Another option is to create an environment which is only used by console -commands and uses a different spooling method. - +commands and uses a different spooling method. + .. note:: - Taking care of the spooling is only needed when memory spooling is used. + Taking care of the spooling is only needed when memory spooling is used. If you are using file spooling (or no spooling at all), there is no need to flush the queue manually within the command. diff --git a/cookbook/doctrine/file_uploads.rst b/cookbook/doctrine/file_uploads.rst index 34778c3c0aa..9e839905cb6 100644 --- a/cookbook/doctrine/file_uploads.rst +++ b/cookbook/doctrine/file_uploads.rst @@ -202,7 +202,7 @@ rules:: class Document { // ... - + public static function loadValidatorMetadata(ClassMetadata $metadata) { $metadata->addPropertyConstraint('file', new Assert\File(array( diff --git a/cookbook/email/spool.rst b/cookbook/email/spool.rst index edea9482730..e44cdfe7a23 100644 --- a/cookbook/email/spool.rst +++ b/cookbook/email/spool.rst @@ -52,7 +52,7 @@ swiftmailer with the memory option, use the following configuration: ..., 'spool' => array('type' => 'memory') )); - + Spool using a file ------------------ diff --git a/cookbook/event_dispatcher/index.rst b/cookbook/event_dispatcher/index.rst index 8a30d4d1584..966eeaff556 100644 --- a/cookbook/event_dispatcher/index.rst +++ b/cookbook/event_dispatcher/index.rst @@ -7,4 +7,4 @@ Event Dispatcher before_after_filters class_extension method_behavior - \ No newline at end of file + diff --git a/cookbook/form/data_transformers.rst b/cookbook/form/data_transformers.rst index fa72d1df22a..da7e54d6a39 100644 --- a/cookbook/form/data_transformers.rst +++ b/cookbook/form/data_transformers.rst @@ -192,7 +192,7 @@ types of underlying data. In any form, the 3 different types of data are: 1) **Model data** - This is the data in the format used in your application -(e.g. an ``Issue`` object). If you call ``Form::getData`` or ``Form::setData``, +(e.g. an ``Issue`` object). If you call ``Form::getData`` or ``Form::setData``, you're dealing with the "model" data. 2) **Norm Data** - This is a normalized version of your data, and is commonly diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index def162d82ea..1cc21c71bd6 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -713,7 +713,7 @@ and customize the ``form_errors`` fragment. .. configuration-block:: .. code-block:: html+jinja - + {# form_errors.html.twig #} {% block form_errors %} {% spaceless %} diff --git a/cookbook/form/unit_testing.rst b/cookbook/form/unit_testing.rst index 56703f02915..a5dbbc0776b 100644 --- a/cookbook/form/unit_testing.rst +++ b/cookbook/form/unit_testing.rst @@ -188,7 +188,7 @@ on other extensions. You need add those extensions to the factory object:: } // ... your tests - } + } Testing against different Sets of Data -------------------------------------- diff --git a/cookbook/form/use_virtuals_forms.rst b/cookbook/form/use_virtuals_forms.rst index 1c1d1b96bb5..ab5fa6405f3 100644 --- a/cookbook/form/use_virtuals_forms.rst +++ b/cookbook/form/use_virtuals_forms.rst @@ -49,7 +49,7 @@ Start by creating a very simple ``CompanyType`` and ``CustomerType``:: // src/Acme/HelloBundle/Form/Type/CompanyType.php namespace Acme\HelloBundle\Form\Type; - + use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilder; diff --git a/cookbook/logging/monolog.rst b/cookbook/logging/monolog.rst index c36d0575e4e..8d858e09d97 100644 --- a/cookbook/logging/monolog.rst +++ b/cookbook/logging/monolog.rst @@ -113,7 +113,7 @@ allows you to log the messages in several ways easily. .. code-block:: php - + // app/config/config.php $container->loadFromExtension('monolog', array( 'handlers' => array( @@ -121,22 +121,22 @@ allows you to log the messages in several ways easily. 'type' => 'stream', 'path' => '/var/log/symfony.log', 'level' => 'error', - ), + ), 'main' => array( 'type' => 'fingers_crossed', 'action_level' => 'warning', 'handler' => 'file', - ), + ), 'file' => array( 'type' => 'stream', 'level' => 'debug', - ), + ), 'syslog' => array( 'type' => 'syslog', 'level' => 'error', - ), + ), ), - )); + )); The above configuration defines a stack of handlers which will be called in the order where they are defined. diff --git a/cookbook/logging/monolog_email.rst b/cookbook/logging/monolog_email.rst index c3ef1e147b1..fa7887a5a54 100644 --- a/cookbook/logging/monolog_email.rst +++ b/cookbook/logging/monolog_email.rst @@ -61,9 +61,9 @@ it is broken down. /> - + .. code-block:: php - + // app/config/config_prod.php $container->loadFromExtension('monolog', array( 'handlers' => array( @@ -71,21 +71,21 @@ it is broken down. 'type' => 'fingers_crossed', 'action_level' => 'critical', 'handler' => 'buffered', - ), + ), 'buffered' => array( 'type' => 'buffer', 'handler' => 'swift', - ), + ), 'swift' => array( 'type' => 'swift_mailer', 'from_email' => 'error@example.com', 'to_email' => 'error@example.com', 'subject' => 'An Error Occurred!', 'level' => 'debug', - ), + ), ), - )); - + )); + The ``mail`` handler is a ``fingers_crossed`` handler which means that it is only triggered when the action level, in this case ``critical`` is reached. @@ -151,7 +151,7 @@ get logged on the server as well as the emails being sent: type="fingers_crossed" action_level="critical" handler="grouped" - /> + /> 'fingers_crossed', 'action_level' => 'critical', 'handler' => 'grouped', - ), + ), 'grouped' => array( 'type' => 'group', 'members' => array('streamed', 'buffered'), - ), + ), 'streamed' => array( 'type' => 'stream', 'path' => '%kernel.logs_dir%/%kernel.environment%.log', 'level' => 'debug', - ), + ), 'buffered' => array( 'type' => 'buffer', 'handler' => 'swift', - ), + ), 'swift' => array( 'type' => 'swift_mailer', 'from_email' => 'error@example.com', 'to_email' => 'error@example.com', 'subject' => 'An Error Occurred!', 'level' => 'debug', - ), + ), ), )); diff --git a/cookbook/routing/method_parameters.rst b/cookbook/routing/method_parameters.rst index 5446b051f68..f6f6ca8d1db 100644 --- a/cookbook/routing/method_parameters.rst +++ b/cookbook/routing/method_parameters.rst @@ -77,7 +77,7 @@ Faking the Method with _method .. note:: The ``_method`` functionality shown here is disabled by default in Symfony 2.2. - To enable it, you must call :method:`Request::enableHttpMethodParameterOverride ` + To enable it, you must call :method:`Request::enableHttpMethodParameterOverride ` before you handle the request (e.g. in your front controller). Unfortunately, life isn't quite this simple, since most browsers do not diff --git a/cookbook/routing/slash_in_parameter.rst b/cookbook/routing/slash_in_parameter.rst index cc1532c16ee..041c08317b7 100644 --- a/cookbook/routing/slash_in_parameter.rst +++ b/cookbook/routing/slash_in_parameter.rst @@ -4,7 +4,7 @@ How to allow a "/" character in a route parameter ================================================= -Sometimes, you need to compose URLs with parameters that can contain a slash +Sometimes, you need to compose URLs with parameters that can contain a slash ``/``. For example, take the classic ``/hello/{name}`` route. By default, ``/hello/Fabien`` will match this route but not ``/hello/Fabien/Kris``. This is because Symfony uses this character as separator between route parts. @@ -15,11 +15,11 @@ matches the ``/hello/{name}`` route, where ``{name}`` equals ``Fabien/Kris``. Configure the Route ------------------- -By default, the Symfony routing components requires that the parameters -match the following regex path: ``[^/]+``. This means that all characters -are allowed except ``/``. +By default, the Symfony routing components requires that the parameters +match the following regex path: ``[^/]+``. This means that all characters +are allowed except ``/``. -You must explicitly allow ``/`` to be part of your parameter by specifying +You must explicitly allow ``/`` to be part of your parameter by specifying a more permissive regex path. .. configuration-block:: diff --git a/cookbook/security/custom_authentication_provider.rst b/cookbook/security/custom_authentication_provider.rst index 677e69e8b72..0fc8d0d1687 100644 --- a/cookbook/security/custom_authentication_provider.rst +++ b/cookbook/security/custom_authentication_provider.rst @@ -138,7 +138,7 @@ set an authenticated token in the security context if successful. try { $authToken = $this->authenticationManager->authenticate($token); $this->securityContext->setToken($authToken); - + return; } catch (AuthenticationException $failed) { // ... you might log something here @@ -480,7 +480,7 @@ You are finished! You can now define parts of your app as under WSSE protection. ), ), )); - + Congratulations! You have written your very own custom security authentication provider! diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index 7d8bf138288..b43a4e09ce3 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -491,7 +491,7 @@ of the ``security.yml`` file. administrators: entity: { class: AcmeUserBundle:User } # ... - + .. code-block:: xml diff --git a/cookbook/security/force_https.rst b/cookbook/security/force_https.rst index 46736abf430..eeb47cacf3a 100644 --- a/cookbook/security/force_https.rst +++ b/cookbook/security/force_https.rst @@ -36,7 +36,7 @@ to use ``HTTPS`` then you could use the following configuration: The login form itself needs to allow anonymous access, otherwise users will be unable to authenticate. To force it to use ``HTTPS`` you can still use -``access_control`` rules by using the ``IS_AUTHENTICATED_ANONYMOUSLY`` +``access_control`` rules by using the ``IS_AUTHENTICATED_ANONYMOUSLY`` role: .. configuration-block:: @@ -51,8 +51,8 @@ role: .. code-block:: xml - diff --git a/cookbook/security/form_login.rst b/cookbook/security/form_login.rst index 37b9f38fce1..c20a4cb6b74 100644 --- a/cookbook/security/form_login.rst +++ b/cookbook/security/form_login.rst @@ -92,7 +92,7 @@ Always Redirect to the Default Page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can make it so that users are always redirected to the default page regardless -of what URL they had requested previously by setting the +of what URL they had requested previously by setting the ``always_use_default_target_path`` option to true: .. configuration-block:: @@ -106,7 +106,7 @@ of what URL they had requested previously by setting the form_login: # ... always_use_default_target_path: true - + .. code-block:: xml @@ -139,7 +139,7 @@ Using the Referring URL In case no previous URL was stored in the session, you may wish to try using the ``HTTP_REFERER`` instead, as this will often be the same. You can do -this by setting ``use_referer`` to true (it defaults to false): +this by setting ``use_referer`` to true (it defaults to false): .. configuration-block:: @@ -187,7 +187,7 @@ this by setting ``use_referer`` to true (it defaults to false): Control the Redirect URL from inside the Form ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -You can also override where the user is redirected to via the form itself by +You can also override where the user is redirected to via the form itself by including a hidden field with the name ``_target_path``. For example, to redirect to the URL defined by some ``account`` route, use the following: @@ -227,13 +227,13 @@ redirect to the URL defined by some ``account`` route, use the following: - + Now, the user will be redirected to the value of the hidden form field. The -value attribute can be a relative path, absolute URL, or a route name. You -can even change the name of the hidden form field by changing the ``target_path_parameter`` +value attribute can be a relative path, absolute URL, or a route name. You +can even change the name of the hidden form field by changing the ``target_path_parameter`` option to another value. .. configuration-block:: @@ -291,7 +291,7 @@ back to the login form itself. You can set this to a different route (e.g. form_login: # ... failure_path: login_failure - + .. code-block:: xml diff --git a/cookbook/security/voters.rst b/cookbook/security/voters.rst index d6025f29948..b19bcf66559 100644 --- a/cookbook/security/voters.rst +++ b/cookbook/security/voters.rst @@ -102,14 +102,14 @@ the security layer. This can be done easily through the service container. .. tip:: - Your implementation of the methods - :method:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::supportsAttribute` - and :method:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::supportsClass` - are not being called internally by the framework. Once you have registered your - voter the ``vote()`` method will always be called, regardless of whether - or not these two methods return true. Therefore you need to call those - methods in your implementation of the ``vote()`` method and return ``ACCESS_ABSTAIN`` - if your voter does not support the class or attribute. + Your implementation of the methods + :method:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::supportsAttribute` + and :method:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\VoterInterface::supportsClass` + are not being called internally by the framework. Once you have registered your + voter the ``vote()`` method will always be called, regardless of whether + or not these two methods return true. Therefore you need to call those + methods in your implementation of the ``vote()`` method and return ``ACCESS_ABSTAIN`` + if your voter does not support the class or attribute. Declaring the Voter as a Service -------------------------------- diff --git a/cookbook/symfony1.rst b/cookbook/symfony1.rst index 57e6cdae880..7127b8903ce 100644 --- a/cookbook/symfony1.rst +++ b/cookbook/symfony1.rst @@ -151,17 +151,17 @@ contains a different class). In order for a class to be autoloaded, you As mentioned before, for the autoloader to work, it needs to know that the ``Sensio`` namespace lives in the ``vendor/bundles`` directory and that, for example, the ``Doctrine`` namespace lives in the ``vendor/doctrine/orm/lib/`` -directory. This mapping is entirely controlled by Composer. Each +directory. This mapping is entirely controlled by Composer. Each third-party library you load through composer has their settings defined and Composer takes care of everything for you. -For this to work, all third-party libraries used by your project must be -defined in the ``composer.json`` file. +For this to work, all third-party libraries used by your project must be +defined in the ``composer.json`` file. If you look at the ``HelloController`` from the Symfony2 Standard Edition you can see that it lives in the ``Acme\DemoBundle\Controller`` namespace. Yet, the ``AcmeDemoBundle`` is not defined in your ``composer.json`` file. Nonetheless are -the files autoloaded. This is because you can tell composer to autoload files +the files autoloaded. This is because you can tell composer to autoload files from specific directories without defining a dependency: .. code-block:: yaml diff --git a/cookbook/testing/database.rst b/cookbook/testing/database.rst index 17fd2431625..1debca5e44d 100644 --- a/cookbook/testing/database.rst +++ b/cookbook/testing/database.rst @@ -34,23 +34,23 @@ class. Suppose the class you want to test looks like this:: namespace Acme\DemoBundle\Salary; - + use Doctrine\Common\Persistence\ObjectManager; - + class SalaryCalculator { private $entityManager; - + public function __construct(ObjectManager $entityManager) { $this->entityManager = $entityManager; } - + public function calculateTotalSalary($id) { $employeeRepository = $this->entityManager->getRepository('AcmeDemoBundle::Employee'); $employee = $userRepository->find($id); - + return $employee->getSalary() + $employee->getBonus(); } } @@ -62,7 +62,7 @@ it's easy to pass a mock object within a test:: class SalaryCalculatorTest extends \PHPUnit_Framework_TestCase { - + public function testCalculateTotalSalary() { // First, mock the object to be used in the test @@ -72,8 +72,8 @@ it's easy to pass a mock object within a test:: ->will($this->returnValue(1000)); $employee->expects($this->once()) ->method('getBonus') - ->will($this->returnValue(1100)); - + ->will($this->returnValue(1100)); + // Now, mock the repository so it returns the mock of the employee $employeeRepository = $this->getMockBuilder('\Doctrine\ORM\EntityRepository') ->disableOriginalConstructor() @@ -81,7 +81,7 @@ it's easy to pass a mock object within a test:: $employeeRepository->expects($this->once()) ->method('find') ->will($this->returnValue($employee)); - + // Last, mock the EntityManager to return the mock of the repository $entityManager = $this->getMockBuilder('\Doctrine\Common\Persistence\ObjectManager') ->disableOriginalConstructor() @@ -89,17 +89,17 @@ it's easy to pass a mock object within a test:: $entityManager->expects($this->once()) ->method('getRepository') ->will($this->returnValue($employeeRepository)); - + $salaryCalculator = new SalaryCalculator($entityManager); $this->assertEquals(2100, $salaryCalculator->calculateTotalSalary(1)); } } - + In this example, you are building the mocks from the inside out, first creating the employee which gets returned by the ``Repository``, which itself gets returned by the ``EntityManager``. This way, no real class is involved in testing. - + Changing database Settings for functional Tests ----------------------------------------------- @@ -121,7 +121,7 @@ configuration: dbname: testdb user: testdb password: testdb - + .. code-block:: xml diff --git a/cookbook/web_services/php_soap_extension.rst b/cookbook/web_services/php_soap_extension.rst index 246f3b64fbc..fe22b393406 100644 --- a/cookbook/web_services/php_soap_extension.rst +++ b/cookbook/web_services/php_soap_extension.rst @@ -170,7 +170,7 @@ An example WSDL is below. - + diff --git a/cookbook/workflow/new_project_git.rst b/cookbook/workflow/new_project_git.rst index 672a012f1c7..f548b27d308 100644 --- a/cookbook/workflow/new_project_git.rst +++ b/cookbook/workflow/new_project_git.rst @@ -35,7 +35,7 @@ git repository: /app/bootstrap* /app/cache/* /app/logs/* - /vendor/ + /vendor/ /app/config/parameters.yml .. tip:: diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index 7a13463e430..474e20d5f0e 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -80,7 +80,7 @@ have a ``Symfony/`` directory that looks like this: # remove the Git history $ rm -rf .git - + For an exact version, replace `2.2.0` with the latest Symfony version (e.g. 2.1.1). For details, see the `Symfony Installation Page`_ @@ -428,7 +428,7 @@ the profiler. .. note:: - You can get more information quickly by hovering over the items on the + You can get more information quickly by hovering over the items on the Web Debug Toolbar. Of course, you won't want to show these tools when you deploy your application From 5542d41ef7060fa7410007b1980652abd03954e3 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 16 Jun 2013 13:38:04 +0200 Subject: [PATCH 0308/2078] Deleted blank lines --- book/forms.rst | 2 -- book/http_fundamentals.rst | 1 - book/installation.rst | 1 - book/propel.rst | 1 - book/security.rst | 2 -- book/templating.rst | 3 --- book/testing.rst | 1 - components/config/definition.rst | 1 - components/console/single_command_tool.rst | 1 - components/dependency_injection/compilation.rst | 1 - components/dependency_injection/configurators.rst | 3 --- components/dependency_injection/definitions.rst | 1 - components/dependency_injection/index.rst | 1 - components/dependency_injection/tags.rst | 1 - components/dependency_injection/types.rst | 2 -- components/filesystem.rst | 2 -- components/http_foundation/introduction.rst | 2 -- components/http_foundation/session_configuration.rst | 3 --- components/http_foundation/session_testing.rst | 1 - components/http_foundation/sessions.rst | 3 --- components/security/firewall.rst | 2 +- components/security/index.rst | 2 +- contributing/community/releases.rst | 3 +-- cookbook/assetic/yuicompressor.rst | 2 -- cookbook/bundles/inheritance.rst | 1 - cookbook/bundles/prepend_extension.rst | 1 - cookbook/configuration/environments.rst | 1 - cookbook/console/logging.rst | 1 - cookbook/console/sending_emails.rst | 1 - cookbook/event_dispatcher/index.rst | 1 - cookbook/form/form_collections.rst | 1 - cookbook/form/form_customization.rst | 3 --- cookbook/logging/monolog.rst | 1 - cookbook/logging/monolog_email.rst | 2 -- cookbook/map.rst.inc | 1 - cookbook/security/acl.rst | 1 - cookbook/security/acl_advanced.rst | 3 --- cookbook/security/custom_authentication_provider.rst | 2 -- cookbook/security/voters.rst | 1 - cookbook/web_services/php_soap_extension.rst | 3 --- quick_tour/the_view.rst | 1 - 41 files changed, 3 insertions(+), 64 deletions(-) diff --git a/book/forms.rst b/book/forms.rst index 591967ca273..06665a15889 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -1437,7 +1437,6 @@ file: - 'AcmeTaskBundle:Form' # ... - .. code-block:: xml @@ -1638,7 +1637,6 @@ but here's a short example: new NotBlank(array('groups' => array('create', 'update')) - Final Thoughts -------------- diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index 507eb697a94..794a107e05f 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -270,7 +270,6 @@ the user is connecting via a secured connection (i.e. ``https``). ``attributes`` property exists entirely to be a place where you can prepare and store context-specific information about the request. - Symfony also provides a ``Response`` class: a simple PHP representation of an HTTP response message. This allows your application to use an object-oriented interface to construct the response that needs to be returned to the client:: diff --git a/book/installation.rst b/book/installation.rst index 7da652ad2c4..02414e6f508 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -195,7 +195,6 @@ Symfony itself - into the ``vendor/`` directory. in the ``extra`` node of your composer.json file with the key ``symfony-assets-install`` and the value ``symlink``: - .. code-block:: json "extra": { diff --git a/book/propel.rst b/book/propel.rst index bfc51a772a1..772739daa6e 100644 --- a/book/propel.rst +++ b/book/propel.rst @@ -439,7 +439,6 @@ Propel provides the following hooks: * ``preDelete()`` code executed before deleting an object * ``postDelete()`` code executed after deleting an object - Behaviors --------- diff --git a/book/security.rst b/book/security.rst index cb583031a90..4cb09b90bdb 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1378,7 +1378,6 @@ In a controller this can be shortcut to: $user = $this->getUser(); } - .. note:: Anonymous users are technically authenticated, meaning that the ``isAuthenticated()`` @@ -1400,7 +1399,6 @@ method:

    Username: getUser()->getUsername() ?>

    - Using Multiple User Providers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/book/templating.rst b/book/templating.rst index ec36f633c26..8118ebe29d4 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -19,7 +19,6 @@ code. How to render templates is covered in the :ref:`controller ` page of the book. - .. index:: single: Templating; What is a template? @@ -976,7 +975,6 @@ advantage of Symfony's template inheritance. more interesting things with those assets. For more information on using Assetic see :doc:`/cookbook/assetic/asset_management`. - Start by adding two blocks to your base template that will hold your assets: one called ``stylesheets`` inside the ``head`` tag and another called ``javascripts`` just above the closing ``body`` tag. These blocks will contain all of the @@ -1401,7 +1399,6 @@ Template parameters can then be dumped using the ``dump`` function: {% endfor %} - The variables will only be dumped if Twig's ``debug`` setting (in ``config.yml``) is ``true``. By default this means that the variables will be dumped in the ``dev`` environment but not the ``prod`` environment. diff --git a/book/testing.rst b/book/testing.rst index 204a74bcbd9..c572bcd842d 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -799,7 +799,6 @@ Learn more * :doc:`/cookbook/testing/profiling` * :doc:`/cookbook/testing/bootstrap` - .. _`DemoControllerTest`: https://github.com/symfony/symfony-standard/blob/master/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php .. _`$_SERVER`: http://php.net/manual/en/reserved.variables.server.php .. _`documentation`: http://www.phpunit.de/manual/3.5/en/ diff --git a/components/config/definition.rst b/components/config/definition.rst index af13de4ec32..18e7a889cfe 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -553,4 +553,3 @@ Otherwise the result is a clean array of configuration values:: $configuration, $configs) ; - diff --git a/components/console/single_command_tool.rst b/components/console/single_command_tool.rst index d77436c53d4..27942df40f2 100644 --- a/components/console/single_command_tool.rst +++ b/components/console/single_command_tool.rst @@ -70,4 +70,3 @@ You can also simplify how you execute the application:: $application = new MyApplication(); $application->run(); - diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index da74e5b9ac8..be24ed45de7 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -264,7 +264,6 @@ but also load a secondary one only if a certain parameter is set:: $container->loadFromExtension($extension->getAlias()); $container->compile(); - .. note:: If you need to manipulate the configuration loaded by an extension then diff --git a/components/dependency_injection/configurators.rst b/components/dependency_injection/configurators.rst index 841413f2f87..6321cc5be8e 100644 --- a/components/dependency_injection/configurators.rst +++ b/components/dependency_injection/configurators.rst @@ -44,7 +44,6 @@ defining a ``NewsletterManager`` class like this:: // ... } - and also a ``GreetingCardManager`` class:: class GreetingCardManager implements EmailFormatterAwareInterface @@ -65,7 +64,6 @@ and also a ``GreetingCardManager`` class:: // ... } - As mentioned before, the goal is to set the formatters at runtime depending on application settings. To do this, you also have an ``EmailFormatterManager`` class which is responsible for loading and validating formatters enabled @@ -155,7 +153,6 @@ The service config for the above classes would look something like this: - [setMailer, ["@my_mailer"]] configurator: ["@email_configurator", configure] - .. code-block:: xml diff --git a/components/dependency_injection/definitions.rst b/components/dependency_injection/definitions.rst index 0a88d74863b..100da379123 100644 --- a/components/dependency_injection/definitions.rst +++ b/components/dependency_injection/definitions.rst @@ -1,7 +1,6 @@ .. index:: single: Dependency Injection; Service definitions - Working with Container Service Definitions ========================================== diff --git a/components/dependency_injection/index.rst b/components/dependency_injection/index.rst index e1d6b0eab8d..74b2ac1e445 100644 --- a/components/dependency_injection/index.rst +++ b/components/dependency_injection/index.rst @@ -15,4 +15,3 @@ parentservices advanced workflow - diff --git a/components/dependency_injection/tags.rst b/components/dependency_injection/tags.rst index 9e0e7ac70df..14c58b8fae9 100644 --- a/components/dependency_injection/tags.rst +++ b/components/dependency_injection/tags.rst @@ -227,7 +227,6 @@ To answer this, change the service declaration: tags: - { name: acme_mailer.transport, alias: bar } - .. code-block:: xml diff --git a/components/dependency_injection/types.rst b/components/dependency_injection/types.rst index 99d428db935..6dabde4b6ef 100644 --- a/components/dependency_injection/types.rst +++ b/components/dependency_injection/types.rst @@ -210,7 +210,6 @@ Another possibility is just setting public fields of the class directly:: 'NewsletterManager' ))->setProperty('mailer', new Reference('my_mailer'))); - There are mainly only disadvantages to using property injection, it is similar to setter injection but with these additional important problems: @@ -224,4 +223,3 @@ to setter injection but with these additional important problems: But, it is useful to know that this can be done with the service container, especially if you are working with code that is out of your control, such as in a third party library, which uses public properties for its dependencies. - diff --git a/components/filesystem.rst b/components/filesystem.rst index e6e2cb6e52e..5b1dc701217 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -47,7 +47,6 @@ endpoint for filesystem operations:: string, an array or any object implementing :phpclass:`Traversable` as the target argument. - Mkdir ~~~~~ @@ -139,7 +138,6 @@ the group of a file. The third argument is a boolean recursive option:: // change the group of the video directory recursively $fs->chgrp('/video', 'nginx', true); - .. note:: You can pass an array or any :phpclass:`Traversable` object as the first diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 2b51d0047d9..7e2b101f7ce 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -145,7 +145,6 @@ exist:: $request->query->get('bar', 'bar'); // returns 'bar' - When PHP imports the request query, it handles request parameters like ``foo[bar]=bar`` in a special way as it creates an array. So you can get the ``foo`` parameter and you will get back an array with a ``bar`` element. But @@ -462,7 +461,6 @@ You can still set the ``Content-Type`` of the sent file, or change its ``Content $response->headers->set('Content-Type', 'text/plain') $response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'filename.txt'); - .. _component-http-foundation-json-response: Creating a JSON Response diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index 187f5d52c03..dcd55298de6 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -19,7 +19,6 @@ is called randomly according to PHP's configuration and if called, it is invoked after the `open` operation). You can read more about this at `php.net/session.customhandler`_ - Native PHP Save Handlers ------------------------ @@ -59,7 +58,6 @@ Example usage:: where you need more control, custom save handlers may provide more freedom and flexibility. Symfony2 provides several implementations which you may further customise as required. - Custom Save Handlers -------------------- @@ -85,7 +83,6 @@ Example usage:: $storage = new NativeSessionStorage(array(), new PdoSessionHandler()); $session = new Session($storage); - Configuring PHP Sessions ~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/components/http_foundation/session_testing.rst b/components/http_foundation/session_testing.rst index 7a938b924b9..e9331eb71a3 100644 --- a/components/http_foundation/session_testing.rst +++ b/components/http_foundation/session_testing.rst @@ -56,4 +56,3 @@ separate PHP processes, simply change the storage engine to use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage; $session = new Session(new MockFileSessionStorage()); - diff --git a/components/http_foundation/sessions.rst b/components/http_foundation/sessions.rst index dbd855f4bf0..f83eb8e9773 100644 --- a/components/http_foundation/sessions.rst +++ b/components/http_foundation/sessions.rst @@ -134,7 +134,6 @@ Session meta-data Gets the :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\MetadataBag` which contains information about the session. - Session Data Management ~~~~~~~~~~~~~~~~~~~~~~~ @@ -167,7 +166,6 @@ the following API which is intended mainly for internal purposes: * :method:`Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface::getName`: Returns the name of the session bag. - Attributes ~~~~~~~~~~ @@ -234,7 +232,6 @@ has a simple API * :method:`Symfony\\Component\\HttpFoundation\\Session\\Attribute\\AttributeBagInterface::clear`: Clear the bag; - Flash messages ~~~~~~~~~~~~~~ diff --git a/components/security/firewall.rst b/components/security/firewall.rst index 1fce747905e..0251cb269f1 100644 --- a/components/security/firewall.rst +++ b/components/security/firewall.rst @@ -128,4 +128,4 @@ context works: to deny access to certain resources. Read the next sections to find out more about :doc:`/components/security/authentication` -and :doc:`/components/security/authorization`. \ No newline at end of file +and :doc:`/components/security/authorization`. diff --git a/components/security/index.rst b/components/security/index.rst index c735740690d..94e3e6c77d6 100644 --- a/components/security/index.rst +++ b/components/security/index.rst @@ -7,4 +7,4 @@ Security introduction firewall authentication - authorization \ No newline at end of file + authorization diff --git a/contributing/community/releases.rst b/contributing/community/releases.rst index 9825a01e7a5..386df081e87 100644 --- a/contributing/community/releases.rst +++ b/contributing/community/releases.rst @@ -75,7 +75,6 @@ Below is the schedule for the first few versions that use this release model: This results in very predictable dates and maintenance periods: - +---------+---------+---------------------+-------------+ | Version | Release | End of Maintenance | End of Life | +=========+=========+=====================+=============+ @@ -159,4 +158,4 @@ upgrade. .. _Git repository: https://github.com/symfony/symfony .. _SensioLabs: http://sensiolabs.com/ .. _roadmap: http://symfony.com/roadmap -.. _`timeline calculator`: http://symfony.com/roadmap \ No newline at end of file +.. _`timeline calculator`: http://symfony.com/roadmap diff --git a/cookbook/assetic/yuicompressor.rst b/cookbook/assetic/yuicompressor.rst index 80f71aafe03..b5122be8e8c 100644 --- a/cookbook/assetic/yuicompressor.rst +++ b/cookbook/assetic/yuicompressor.rst @@ -153,7 +153,6 @@ apply this filter when debug mode is off. - .. tip:: Instead of adding the filter to the asset tags, you can also globally @@ -163,7 +162,6 @@ apply this filter when debug mode is off. common config file. For details on applying filters by file extension, see :ref:`cookbook-assetic-apply-to`. - .. _`YUI Compressor`: http://developer.yahoo.com/yui/compressor/ .. _`Download the JAR`: http://yuilibrary.com/projects/yuicompressor/ .. _`deprecation process`: http://www.yuiblog.com/blog/2012/10/16/state-of-yui-compressor/ diff --git a/cookbook/bundles/inheritance.rst b/cookbook/bundles/inheritance.rst index 456088cc0b1..cfb56b52db0 100644 --- a/cookbook/bundles/inheritance.rst +++ b/cookbook/bundles/inheritance.rst @@ -102,4 +102,3 @@ The same goes for routing files, validation configuration and other resources. translations. .. _`FOSUserBundle`: https://github.com/friendsofsymfony/fosuserbundle - diff --git a/cookbook/bundles/prepend_extension.rst b/cookbook/bundles/prepend_extension.rst index 74f1500c8f4..61e0d642cd0 100644 --- a/cookbook/bundles/prepend_extension.rst +++ b/cookbook/bundles/prepend_extension.rst @@ -132,4 +132,3 @@ for ``acme_hello`` is set to ``non_default``: ..., 'use_acme_goodbye' => false, )); - diff --git a/cookbook/configuration/environments.rst b/cookbook/configuration/environments.rst index 6515ffc0b62..b1dea887b47 100644 --- a/cookbook/configuration/environments.rst +++ b/cookbook/configuration/environments.rst @@ -345,7 +345,6 @@ includes the following: You can easily change the directory location and name. For more information read the article :doc:`/cookbook/configuration/override_dir_structure`. - Going Further ------------- diff --git a/cookbook/console/logging.rst b/cookbook/console/logging.rst index b332c149fdd..bbddf0c7646 100644 --- a/cookbook/console/logging.rst +++ b/cookbook/console/logging.rst @@ -86,7 +86,6 @@ method, where exception handling should happen: code, though there is a high risk that something may break when upgrading to future versions of Symfony. - .. code-block:: php // src/Acme/DemoBundle/Console/Application.php diff --git a/cookbook/console/sending_emails.rst b/cookbook/console/sending_emails.rst index d3999c3c554..60194fe5904 100644 --- a/cookbook/console/sending_emails.rst +++ b/cookbook/console/sending_emails.rst @@ -115,4 +115,3 @@ commands and uses a different spooling method. Taking care of the spooling is only needed when memory spooling is used. If you are using file spooling (or no spooling at all), there is no need to flush the queue manually within the command. - diff --git a/cookbook/event_dispatcher/index.rst b/cookbook/event_dispatcher/index.rst index 966eeaff556..8dfe9a541f4 100644 --- a/cookbook/event_dispatcher/index.rst +++ b/cookbook/event_dispatcher/index.rst @@ -7,4 +7,3 @@ Event Dispatcher before_after_filters class_extension method_behavior - diff --git a/cookbook/form/form_collections.rst b/cookbook/form/form_collections.rst index f8365de53c0..bb8a419b64d 100755 --- a/cookbook/form/form_collections.rst +++ b/cookbook/form/form_collections.rst @@ -733,5 +733,4 @@ the relationship between the removed ``Tag`` and ``Task`` object. updated (whether you're adding new tags or removing existing tags) on each Tag object itself. - .. _`Owning Side and Inverse Side`: http://docs.doctrine-project.org/en/latest/reference/unitofwork-associations.html diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index 1cc21c71bd6..5aa5bff48b5 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -508,7 +508,6 @@ form is rendered. - 'AcmeDemoBundle:Form' # ... - .. code-block:: xml @@ -521,7 +520,6 @@ form is rendered. - .. code-block:: php // app/config/config.php @@ -756,7 +754,6 @@ and customize the ``form_errors`` fragment.
- .. tip:: See :ref:`cookbook-form-theming-methods` for how to apply this customization. diff --git a/cookbook/logging/monolog.rst b/cookbook/logging/monolog.rst index 8d858e09d97..f31952a33e2 100644 --- a/cookbook/logging/monolog.rst +++ b/cookbook/logging/monolog.rst @@ -267,7 +267,6 @@ using a processor. } } - .. configuration-block:: .. code-block:: yaml diff --git a/cookbook/logging/monolog_email.rst b/cookbook/logging/monolog_email.rst index fa7887a5a54..b429bc8c588 100644 --- a/cookbook/logging/monolog_email.rst +++ b/cookbook/logging/monolog_email.rst @@ -86,7 +86,6 @@ it is broken down. ), )); - The ``mail`` handler is a ``fingers_crossed`` handler which means that it is only triggered when the action level, in this case ``critical`` is reached. It then logs everything including messages below the action level. The @@ -212,7 +211,6 @@ get logged on the server as well as the emails being sent: ), )); - This uses the ``group`` handler to send the messages to the two group members, the ``buffered`` and the ``stream`` handlers. The messages will now be both written to the log file and emailed. diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index ca5f6610a39..a8368b8e699 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -173,4 +173,3 @@ * :doc:`/cookbook/workflow/new_project_git` * :doc:`/cookbook/workflow/new_project_svn` - diff --git a/cookbook/security/acl.rst b/cookbook/security/acl.rst index 3d19c16b7d8..dfe4af27ff0 100644 --- a/cookbook/security/acl.rst +++ b/cookbook/security/acl.rst @@ -58,7 +58,6 @@ First, you need to configure the connection the ACL system is supposed to use: 'connection' => 'default', )); - .. note:: The ACL system requires a connection from either Doctrine DBAL (usable by diff --git a/cookbook/security/acl_advanced.rst b/cookbook/security/acl_advanced.rst index 52c7687db00..e04ab11ea90 100644 --- a/cookbook/security/acl_advanced.rst +++ b/cookbook/security/acl_advanced.rst @@ -39,14 +39,12 @@ domain object, the ACL system will first create an object identity from your domain object, and then pass this object identity to the ACL provider for further processing. - Security Identities ~~~~~~~~~~~~~~~~~~~ This is analog to the object identity, but represents a user, or a role in your application. Each role, or user has its own security identity. - Database Table Structure ------------------------ @@ -66,7 +64,6 @@ tables are ordered from least rows to most rows in a typical application: with the most rows. It can contain tens of millions without significantly impacting performance. - Scope of Access Control Entries ------------------------------- diff --git a/cookbook/security/custom_authentication_provider.rst b/cookbook/security/custom_authentication_provider.rst index 0fc8d0d1687..fb676007b89 100644 --- a/cookbook/security/custom_authentication_provider.rst +++ b/cookbook/security/custom_authentication_provider.rst @@ -377,7 +377,6 @@ to service ids that do not exist yet: ``wsse.security.authentication.provider`` class: Acme\DemoBundle\Security\Firewall\WsseListener arguments: ["@security.context", "@security.authentication.manager"] - .. code-block:: xml @@ -481,7 +480,6 @@ You are finished! You can now define parts of your app as under WSSE protection. ), )); - Congratulations! You have written your very own custom security authentication provider! diff --git a/cookbook/security/voters.rst b/cookbook/security/voters.rst index b19bcf66559..f4d93ce6011 100644 --- a/cookbook/security/voters.rst +++ b/cookbook/security/voters.rst @@ -30,7 +30,6 @@ which requires the following three methods: function vote(TokenInterface $token, $object, array $attributes); } - The ``supportsAttribute()`` method is used to check if the voter supports the given user attribute (i.e: a role, an acl, etc.). diff --git a/cookbook/web_services/php_soap_extension.rst b/cookbook/web_services/php_soap_extension.rst index fe22b393406..10535d3c913 100644 --- a/cookbook/web_services/php_soap_extension.rst +++ b/cookbook/web_services/php_soap_extension.rst @@ -44,7 +44,6 @@ In this case, the SOAP service will allow the client to call a method called $this->mailer->send($message); - return 'Hello, '.$name; } } @@ -80,7 +79,6 @@ a ``HelloService`` object properly: ->register('hello_service', 'Acme\SoapBundle\Services\HelloService') ->addArgument(new Reference('mailer')); - Below is an example of a controller that is capable of handling a SOAP request. If ``indexAction()`` is accessible via the route ``/soap``, then the WSDL document can be retrieved via ``/soap?wsdl``. @@ -190,7 +188,6 @@ An example WSDL is below. - .. _`PHP SOAP`: http://php.net/manual/en/book.soap.php .. _`NuSOAP`: http://sourceforge.net/projects/nusoap .. _`output buffering`: http://php.net/manual/en/book.outcontrol.php diff --git a/quick_tour/the_view.rst b/quick_tour/the_view.rst index 60788277a0d..9d9413837ac 100644 --- a/quick_tour/the_view.rst +++ b/quick_tour/the_view.rst @@ -50,7 +50,6 @@ Below is a minimal template that illustrates a few basics, using two variables - .. tip:: Comments can be included inside templates using the ``{# ... #}`` delimiter. From ddaac67dc0997db3832bf7fe00ba3decce55fea6 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 16 Jun 2013 17:35:09 +0200 Subject: [PATCH 0309/2078] Made sentence more clear --- cookbook/console/console_command.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cookbook/console/console_command.rst b/cookbook/console/console_command.rst index 41aba0f58ff..47afaccfaaf 100644 --- a/cookbook/console/console_command.rst +++ b/cookbook/console/console_command.rst @@ -85,8 +85,10 @@ For example, you could easily extend the task to be translatable:: Testing Commands ---------------- -When testing commands used as part of the full framework :class:`Symfony\\Bundle\\FrameworkBundle\\Console\\Application` -should be used instead of :class:`Symfony\\Component\\Console\\Application`:: +When testing commands used as part of the full framework +:class:`Symfony\\Bundle\\FrameworkBundle\\Console\\Application ` should be used +instead of +:class:`Symfony\\Component\\Console\\Application `:: use Symfony\Component\Console\Tester\CommandTester; use Symfony\Bundle\FrameworkBundle\Console\Application; From 14aff92f7f185ed90471404b21e976dcdedd99e9 Mon Sep 17 00:00:00 2001 From: thewilkybarkid Date: Sun, 16 Jun 2013 20:41:54 +0100 Subject: [PATCH 0310/2078] Add PDO error handling details --- cookbook/configuration/pdo_session_storage.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cookbook/configuration/pdo_session_storage.rst b/cookbook/configuration/pdo_session_storage.rst index 3bbbff1ad42..31e1d6b781e 100644 --- a/cookbook/configuration/pdo_session_storage.rst +++ b/cookbook/configuration/pdo_session_storage.rst @@ -45,6 +45,8 @@ configuration format of your choice): dsn: "mysql:dbname=mydatabase" user: myuser password: mypassword + calls: + - [setAttribute, [3, 2]] # \PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION session.handler.pdo: class: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler @@ -71,6 +73,10 @@ configuration format of your choice): mysql:dbname=mydatabase myuser mypassword + + PDO::ATTR_ERRMODE + PDO::ERRMODE_EXCEPTION + @@ -105,6 +111,7 @@ configuration format of your choice): 'myuser', 'mypassword', )); + $pdoDefinition->addMethodCall('setAttribute', array(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION)); $container->setDefinition('pdo', $pdoDefinition); $storageDefinition = new Definition('Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler', array( From a3dc9cb48b3f01e40446440a01ddfb1c48e54553 Mon Sep 17 00:00:00 2001 From: Bilal Amarni Date: Mon, 17 Jun 2013 18:16:46 +0300 Subject: [PATCH 0311/2078] [Validation] fixed a link --- book/validation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/validation.rst b/book/validation.rst index f1c676eca9a..c643414410d 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -101,7 +101,7 @@ following: .. tip:: Protected and private properties can also be validated, as well as "getter" - methods (see `validator-constraint-targets`). + methods (see :ref:`validator-constraint-targets`). .. index:: single: Validation; Using the validator From eb93d2652c43b25600b57198f4fefbba26cc2122 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Wed, 19 Jun 2013 15:50:00 +0300 Subject: [PATCH 0312/2078] Fixed the YAML example in the scope cookboob article The argument was missing the strict=false attribute to be consistent with the XML and PHP examples, and it is needed when using a synchronized service from a narrower scope. --- cookbook/service_container/scopes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/service_container/scopes.rst b/cookbook/service_container/scopes.rst index e779bc933b9..5227ab4a478 100644 --- a/cookbook/service_container/scopes.rst +++ b/cookbook/service_container/scopes.rst @@ -149,7 +149,7 @@ your code. This should also be taken into account when declaring your service: greeting_card_manager: class: Acme\HelloBundle\Mail\GreetingCardManager calls: - - [setRequest, ['@?request']] + - [setRequest, ['@?request=']] .. code-block:: xml From 01f0d2436a7fd42249fd84f727f4bed67fea9e85 Mon Sep 17 00:00:00 2001 From: rayrigam Date: Thu, 20 Jun 2013 15:39:35 -0430 Subject: [PATCH 0313/2078] Eliminate comment about JMSSecurityExtraBundle being included by default. --- book/security.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/book/security.rst b/book/security.rst index ee45430393e..80ab5da852e 100644 --- a/book/security.rst +++ b/book/security.rst @@ -993,9 +993,7 @@ which can secure your controller using annotations:: // ... } -For more information, see the `JMSSecurityExtraBundle`_ documentation. If you're -using Symfony's Standard Distribution, this bundle is available by default. -If not, you can easily download and install it. +For more information, see the `JMSSecurityExtraBundle`_ documentation. Securing other Services ~~~~~~~~~~~~~~~~~~~~~~~ From 80eba1549d990c9fb23d643e2de6993d31f80c37 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 22 Jun 2013 16:30:11 +0200 Subject: [PATCH 0314/2078] fix group sequence order --- book/validation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/validation.rst b/book/validation.rst index f1c676eca9a..0018667c187 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -849,7 +849,7 @@ username and the password are different only if all other validation passes use Symfony\Component\Validator\Constraints as Assert; /** - * @Assert\GroupSequence({"Strict", "User"}) + * @Assert\GroupSequence({"User", "Strict"}) */ class User implements UserInterface { From 4a26df17449f40f57f3b489558fc33e5d1a5efad Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 22 Jun 2013 16:43:52 +0200 Subject: [PATCH 0315/2078] remove unmaintained translations --- contributing/documentation/translations.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/contributing/documentation/translations.rst b/contributing/documentation/translations.rst index 88ea2112c25..937f5e87a82 100644 --- a/contributing/documentation/translations.rst +++ b/contributing/documentation/translations.rst @@ -22,10 +22,7 @@ for. Here is the list of the official *master* repositories: * *Japanese*: https://github.com/symfony-japan/symfony-docs-ja * *Polish*: https://github.com/ampluso/symfony-docs-pl * *Portuguese (Brazilian)*: https://github.com/andreia/symfony-docs-pt-BR -* *Romanian*: https://github.com/sebio/symfony-docs-ro -* *Russian*: https://github.com/avalanche123/symfony-docs-ru * *Spanish*: https://github.com/gitnacho/symfony-docs-es -* *Turkish*: https://github.com/symfony-tr/symfony-docs-tr .. note:: From 267a1dac2519b57423f3cad7cc7dd4ac0a039d02 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 22 Jun 2013 20:12:30 +0200 Subject: [PATCH 0316/2078] fix branch version used to base pull requests on --- contributing/documentation/overview.rst | 36 ++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/contributing/documentation/overview.rst b/contributing/documentation/overview.rst index e48a1d73ca6..78f8dd42d2b 100644 --- a/contributing/documentation/overview.rst +++ b/contributing/documentation/overview.rst @@ -26,21 +26,21 @@ then clone your fork: $ git clone git://github.com/YOURUSERNAME/symfony-docs.git Consistent with Symfony's source code, the documentation repository is split into -multiple branches: ``2.0``, ``2.1``, ``2.2`` corresponding to the different -versions of Symfony itself. The ``master`` branch holds the documentation -for the development branch of the code. +multiple branches: ``2.2``, ``2.3`` corresponding to the different versions of +Symfony itself. The ``master`` branch holds the documentation for the development +branch of the code. -Unless you're documenting a feature that was introduced *after* Symfony 2.1 -(e.g. in Symfony 2.2), your changes should always be based on the 2.1 branch. -To do this checkout the 2.1 branch before the next step: +Unless you're documenting a feature that was introduced *after* Symfony 2.2 +(e.g. in Symfony 2.3), your changes should always be based on the 2.2 branch. +To do this checkout the 2.2 branch before the next step: .. code-block:: bash - $ git checkout 2.1 + $ git checkout 2.2 .. tip:: - Your base branch (e.g. 2.1) will become the "Applies to" in the :ref:`doc-contributing-pr-format` + Your base branch (e.g. 2.2) will become the "Applies to" in the :ref:`doc-contributing-pr-format` that you'll use later. Next, create a dedicated branch for your changes (for organization): @@ -61,16 +61,16 @@ Following the example, the pull request will default to be between your .. image:: /images/docs-pull-request.png :align: center -If you have made your changes based on the 2.1 branch then you need to change -the base branch to be 2.1 on the preview page: +If you have made your changes based on the 2.2 branch then you need to change +the base branch to be 2.2 on the preview page: .. image:: /images/docs-pull-request-change-base.png :align: center .. note:: - All changes made to a branch (e.g. 2.1) will be merged up to each "newer" - branch (e.g. 2.2, master, etc) for the next release on a weekly basis. + All changes made to a branch (e.g. 2.2) will be merged up to each "newer" + branch (e.g. 2.3, master, etc) for the next release on a weekly basis. GitHub covers the topic of `pull requests`_ in detail. @@ -117,7 +117,7 @@ An example submission could now look as follows: | ------------- | --- | Doc fix? | yes | New docs? | yes (symfony/symfony#2500) - | Applies to | all (or 2.1+) + | Applies to | all (or 2.3+) | Fixed tickets | #1075 .. tip:: @@ -137,8 +137,8 @@ tag and a short description: .. code-block:: text - .. versionadded:: 2.2 - The ``askHiddenResponse`` method was added in Symfony 2.2. + .. versionadded:: 2.3 + The ``askHiddenResponse`` method was added in Symfony 2.3. You can also ask a question and hide the response. This is particularly... @@ -147,11 +147,11 @@ how the behavior has changed. .. code-block:: text - .. versionadded:: 2.2 + .. versionadded:: 2.3 The ``include()`` function is a new Twig feature that's available in - Symfony 2.2. Prior, the ``{% include %}`` tag was used. + Symfony 2.3. Prior, the ``{% include %}`` tag was used. -Whenever a new minor version of Symfony2 is released (e.g. 2.3, 2.4, etc), +Whenever a new minor version of Symfony2 is released (e.g. 2.4, 2.5, etc), a new branch of the documentation is created from the ``master`` branch. At this point, all the ``versionadded`` tags for Symfony2 versions that have reached end-of-life will be removed. For example, if Symfony 2.5 were released From de71e77e6b076d40721cbc04d36764c784ce2da4 Mon Sep 17 00:00:00 2001 From: Pedro Junior Date: Sat, 22 Jun 2013 15:30:57 -0300 Subject: [PATCH 0317/2078] Added missing class to static callback example in PHP Signed-off-by: Pedro Junior --- reference/constraints/Callback.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reference/constraints/Callback.rst b/reference/constraints/Callback.rst index 93539cb7eb2..030cfe73c3c 100644 --- a/reference/constraints/Callback.rst +++ b/reference/constraints/Callback.rst @@ -182,7 +182,9 @@ process. Each method can be one of the following formats: public static function loadValidatorMetadata(ClassMetadata $metadata) { $metadata->addConstraint(new Callback(array( - 'methods' => array('isAuthorValid'), + 'methods' => array( + array('Acme\BlogBundle\MyStaticValidatorClass', 'isAuthorValid'), + ), ))); } } From 8fa24cd6edb36635ff80d9ad883f9011f62536c1 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 22 Jun 2013 14:54:42 -0500 Subject: [PATCH 0318/2078] [Console] Changing table header at @xabbuh's suggestion --- components/console/introduction.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index c99f95d97ba..8661df71ea1 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -167,7 +167,7 @@ The console has 3 levels of verbosity. These are defined in the :class:`Symfony\\Component\\Console\\Output\\OutputInterface`: ================================== =============================== -Option Value +Mode Value ================================== =============================== OutputInterface::VERBOSITY_QUIET Do not output any messages OutputInterface::VERBOSITY_NORMAL The default verbosity level @@ -256,7 +256,7 @@ You can access the ``names`` argument as an array:: There are 3 argument variants you can use: =========================== =============================================================================================================== -Option Value +Mode Value =========================== =============================================================================================================== InputArgument::REQUIRED The argument is required InputArgument::OPTIONAL The argument is optional and therefore can be omitted From 7d7e459fc58e6bb0a94be78a60337611cd3768fc Mon Sep 17 00:00:00 2001 From: Ken Marfilla Date: Tue, 4 Jun 2013 15:49:13 +0800 Subject: [PATCH 0319/2078] Added missing manager_name key for entity provider --- reference/configuration/security.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index 9d208d605e2..7871cf21aa5 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -83,6 +83,7 @@ Each part will be explained in the next section. entity: class: SecurityBundle:User property: username + manager_name: ~ # Example custom provider my_some_custom_provider: From 6ddc1bf3e891a07fee52a954b174dd30485ec39b Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 22 Jun 2013 15:14:25 -0500 Subject: [PATCH 0320/2078] [#2698] Slight rewording --- reference/configuration/security.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index d9a510b98a2..0b6c2b883b5 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -304,7 +304,9 @@ Using the BCrypt Password Encoder --------------------------------- .. caution:: - PHP Version 5.5 is required or install the "ircmaxell/password-compat" via composer. + + To use this encoder, you either need to use PHP Version 5.5 or install + the `ircmaxell/password-compat`_ library via Composer. .. versionadded:: 2.2 The BCrypt password encoder was added in Symfony 2.2. @@ -470,3 +472,4 @@ To use HTTP-Digest authentication you need to provide a realm and a key: )); .. _`PBKDF2`: http://en.wikipedia.org/wiki/PBKDF2 +.. _`ircmaxell/password-compat`: https://packagist.org/packages/ircmaxell/password-compat \ No newline at end of file From dd7c90bb9f13addc4632d658f6352a497fcb150c Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 16 Jun 2013 13:07:07 +0200 Subject: [PATCH 0321/2078] Documented synthetic services --- components/dependency_injection/advanced.rst | 46 ++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/components/dependency_injection/advanced.rst b/components/dependency_injection/advanced.rst index 677c3541ce4..284f8a58375 100644 --- a/components/dependency_injection/advanced.rst +++ b/components/dependency_injection/advanced.rst @@ -59,6 +59,52 @@ below) to access this service (via the alias). Services are by default public. +Synthetic Services +------------------ + +Synthetic services are services that are injected into the container instead +of being created by the container. + +For instance, the ``request`` service which is injected in the +:method:`HttpKernel::handle() ` +method when entering the request :doc:`scope `. +The class does not exist when there is no request, so it can't be included in +the container configuration. Also, the service should be different for every +subrequest in the application. + +To create a synthetic service, set ``synthetic`` to ``true``: + +.. configuration-block:: + + .. code-block:: yaml + + services: + request: + synthetic: true + + .. code-block:: xml + + + + .. code-block:: php + + use Symfony\Component\DependencyInjection\Definition; + + // ... + $container->setDefinition('request', new Definition()) + ->setSynthetic(true); + +As you see, only the ``synthetic`` option is set. All other options are only used +to configure the container how a service is created by the container. As the +service isn't created by the container, these options are omitted. + +Now, you can inject the class by using +:method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::set`:: + + // ... + $container->set('request', new MyRequest(...)); + Aliasing -------- From 7c49c2fef442c28a57914565a5c688300487f0d1 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Mon, 24 Jun 2013 17:08:22 +0200 Subject: [PATCH 0322/2078] Added docs about groupsequenceproviders --- book/validation.rst | 127 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/book/validation.rst b/book/validation.rst index f1c676eca9a..913a48dfef8 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -924,6 +924,133 @@ In this example, it will first validate all constraints in the group ``User`` (which is the same as the ``Default`` group). Only if all constraints in that group are valid, the second group, ``Strict``, will be validated. +Group Sequence Providers +~~~~~~~~~~~~~~~~~~~~~~~~ + +Imagine a ``User`` entity which can be a normal user or a premium user. When +it's a premium user, some extra constraints should be added to the user entity +(e.g. the credit card details). To dynamically determine which groups should +be activated, you can create a Group Sequence Provider. First, create the +entity and a new constraint group called ``Premium``: + +.. configuration-block:: + + .. code-block:: php-annotations + + // src/Acme/DemoBundle/Entity/User.php + namespace Acme\DemoBundle\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + + class User + { + // ... + + /** + * @Assert\NotBlank() + */ + private $name; + + /** + * @Assert\CardScheme( + * schemes={"VISA"}, + * groups={"Premium"}, + * ) + private $creditCard; + } + + .. code-block:: yaml + + # src/Acme/DemoBundle/Resources/config/validation.yml + Acme\DemoBundle\Entity\User: + properties: + name: + - NotBlank + creditCard: + - CardScheme + schemes: [VISA] + groups: [Premium] + + .. code-block:: xml + + + + + + + + + + + + + + + + .. code-block:: php + + // src/Acme/DemoBundle/Entity/User.php + namespace Acme\DemoBundle\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + use Symfony\Component\Validator\Mapping\ClassMetadata; + + class User + { + private $name; + private $creditCard; + + // ... + + public static function loadValidatorMetadata(ClassMetadata $metadata) + { + $metadata->addPropertyConstraint('name', new Assert\NotBlank()); + $metadata->addPropertyConstraint('creditCard', new Assert\CardScheme( + 'schemes' => array('VISA'), + 'groups' => array('Premium'), + )); + } + } + +Now, let this class implement +:class:`Symfony\\Componet\\Validation\\GroupSequenceProviderInterface` and +implement a method called +:method:`Symfony\\Componet\\Validation\\GroupSequenceProviderInterface::getGroupSequence`, +which returns an array of groups to use and add the +``@Assert\GroupSequencdeProvider`` annotation to the class. Imagine a method +``isPremium`` returns true if the user is a premium member. Your method looks +like this:: + + // src/Acme/DemoBundle/Entity/User.php + namespace Acme\DemoBundle\Entity; + + // ... + use Symfony\Component\Validation\GroupSequenceProviderInterface; + + /** + * @Assert\GroupSequenceProvider + * ... + */ + class User + { + // ... + + public function getGroupSequence() + { + $groups = array('User'); + + if ($this->isPremium()) { + $groups[] = 'Premium'; + } + + return $groups; + } + } + .. _book-validation-raw-values: Validating Values and Arrays From d412a9ede26b4f2c3d81d74c9025fdf5db86dfa4 Mon Sep 17 00:00:00 2001 From: Denis Togbe Date: Tue, 25 Jun 2013 10:48:33 +0200 Subject: [PATCH 0323/2078] [Cookbook] Fixed mapping of sessions cookbooks --- cookbook/map.rst.inc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index 2b65e0cb5c6..353695fca8e 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -107,10 +107,6 @@ * :doc:`/cookbook/request/mime_type` -* :doc:`/cookbook/session/index` - - * :doc:`/cookbook/session/php_bridge` - * :doc:`/cookbook/routing/index` * :doc:`/cookbook/routing/scheme` @@ -147,6 +143,7 @@ * :doc:`/cookbook/session/index` * :doc:`/cookbook/session/proxy_examples` + * :doc:`/cookbook/session/php_bridge` * **symfony1** From 8c62e832d82b02ac91db29f2198b27a419110775 Mon Sep 17 00:00:00 2001 From: Denis Togbe Date: Tue, 25 Jun 2013 11:34:50 +0200 Subject: [PATCH 0324/2078] [Cookbook][Session] Fixed headline in php_bridge --- cookbook/session/php_bridge.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/session/php_bridge.rst b/cookbook/session/php_bridge.rst index 6783bf398e2..c2e6b2596df 100644 --- a/cookbook/session/php_bridge.rst +++ b/cookbook/session/php_bridge.rst @@ -2,7 +2,7 @@ single: Sessions Bridge a legacy application with Symfony Sessions -------------------------------------------------- +================================================= .. versionadded:: 2.3 The ability to integrate with a legacy PHP session was added in Symfony 2.3. From 56cd551c67be461433e77119925d1cc23abc739d Mon Sep 17 00:00:00 2001 From: Sam Van der Borght Date: Wed, 26 Jun 2013 15:45:14 +0200 Subject: [PATCH 0325/2078] Renamed getPropertyAccessor to createPropertyAccessor --- cookbook/form/create_form_type_extension.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/create_form_type_extension.rst b/cookbook/form/create_form_type_extension.rst index a75eaefc7ca..ab0d1c42502 100644 --- a/cookbook/form/create_form_type_extension.rst +++ b/cookbook/form/create_form_type_extension.rst @@ -232,7 +232,7 @@ it in the view:: $parentData = $form->getParent()->getData(); if (null !== $parentData) { - $accessor = PropertyAccess::getPropertyAccessor(); + $accessor = PropertyAccess::createPropertyAccessor(); $imageUrl = $accessor->getValue($parentData, $options['image_path']); } else { $imageUrl = null; From a7126b00275388403ce821d865e1ab31db0e114b Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 27 Jun 2013 10:05:37 +0200 Subject: [PATCH 0326/2078] add missing code block --- components/property_access/introduction.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/property_access/introduction.rst b/components/property_access/introduction.rst index 130d7d0f7f4..767097f8dfd 100644 --- a/components/property_access/introduction.rst +++ b/components/property_access/introduction.rst @@ -278,6 +278,8 @@ can use setters, the magic ``__set`` or properties to set values:: You can also use ``__call`` to set values but you need to enable the feature, see `Enable other Features`_. +.. code-block:: php + // ... class Person { From e00ba57eec0c5f724984bd6c96af41401fc8f305 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Thu, 6 Jun 2013 20:17:20 +0200 Subject: [PATCH 0327/2078] Documented Currency constraint --- reference/constraints.rst | 1 + reference/constraints/Currency.rst | 85 ++++++++++++++++++++++++++++++ reference/constraints/map.rst.inc | 1 + 3 files changed, 87 insertions(+) create mode 100644 reference/constraints/Currency.rst diff --git a/reference/constraints.rst b/reference/constraints.rst index d3d09d6fd58..efbc0e554a6 100644 --- a/reference/constraints.rst +++ b/reference/constraints.rst @@ -46,6 +46,7 @@ Validation Constraints Reference constraints/Image constraints/CardScheme + constraints/Currency constraints/Luhn constraints/Iban constraints/Isbn diff --git a/reference/constraints/Currency.rst b/reference/constraints/Currency.rst new file mode 100644 index 00000000000..3a2a3b1b8cf --- /dev/null +++ b/reference/constraints/Currency.rst @@ -0,0 +1,85 @@ +Currency +======== + +.. versionadded:: 2.3 + This constraint is new in version 2.3. + +Validates that a value is a valid `3-letter ISO 4217`_ currency name. + ++----------------+---------------------------------------------------------------------------+ +| Applies to | :ref:`property or method` | ++----------------+---------------------------------------------------------------------------+ +| Options | - `message`_ | ++----------------+---------------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Validator\\Constraints\\Currency` | ++----------------+---------------------------------------------------------------------------+ +| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\CurrencyValidator` | ++----------------+---------------------------------------------------------------------------+ + +Basic Usage +----------- + +If you want to ensure that the ``currency`` property of an ``Order`` is a valid +currency, you could do the following: + +.. configuration-block:: + + .. code-block:: yaml + + # src/EcommerceBundle/Resources/config/validation.yml + Acme\EcommerceBundle\Entity\Order: + properties: + currency: + - Currency: ~ + + .. code-block:: php-annotations + + // src/Acme/EcommerceBundle/Entity/Order.php + namespace Acme\EcommerceBundle\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + + class Order + { + /** + * @Assert\Currency + */ + protected $currency; + } + + .. code-block:: xml + + + + + + + + + .. code-block:: php + + // src/Acme/EcommerceBundle/Entity/Order.php + namespace Acme\SocialBundle\Entity; + + use Symfony\Component\Validator\Mapping\ClassMetadata; + use Symfony\Component\Validator\Constraints as Assert; + + class Order + { + public static function loadValidatorMetadata(ClassMetadata $metadata) + { + $metadata->addPropertyConstraint('currency', new Assert\Currency()); + } + } + +Options +------- + +message +~~~~~~~ + +**type**: ``string`` **default**: ``This value is not a valid currency.`` + +This is the message that will be shown if the value is not a valid currency. + +.. _`3-letter ISO 4217`: http://en.wikipedia.org/wiki/ISO_4217 diff --git a/reference/constraints/map.rst.inc b/reference/constraints/map.rst.inc index 2c185d11cbf..84186b01d25 100644 --- a/reference/constraints/map.rst.inc +++ b/reference/constraints/map.rst.inc @@ -66,6 +66,7 @@ Financial and other Number Constraints ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * :doc:`CardScheme ` +* :doc:`Currency ` * :doc:`Luhn ` * :doc:`Iban ` * :doc:`Isbn ` From 3a8bd43e145a36165e2016bb7c484602bbad5525 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Thu, 6 Jun 2013 20:23:23 +0200 Subject: [PATCH 0328/2078] Added currency field type --- reference/forms/types.rst | 1 + reference/forms/types/currency.rst | 75 ++++++++++++++++++++++++++++++ reference/forms/types/map.rst.inc | 1 + 3 files changed, 77 insertions(+) create mode 100644 reference/forms/types/currency.rst diff --git a/reference/forms/types.rst b/reference/forms/types.rst index 9c46ae00770..c51dc0bbdf2 100644 --- a/reference/forms/types.rst +++ b/reference/forms/types.rst @@ -14,6 +14,7 @@ Form Types Reference types/choice types/collection types/country + types/currency types/date types/datetime types/email diff --git a/reference/forms/types/currency.rst b/reference/forms/types/currency.rst new file mode 100644 index 00000000000..d3564fc4a85 --- /dev/null +++ b/reference/forms/types/currency.rst @@ -0,0 +1,75 @@ +.. index:: + single: Forms; Fields; currency + +currency Field Type +=================== + +The ``currency`` type is a subset of the +:doc:`choice type ` | ++-------------+------------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CurrencyType` | ++-------------+------------------------------------------------------------------------+ + +Overridden Options +------------------ + +choices +~~~~~~~ + +**default**: ``Symfony\Component\Intl\Intl::getCurrencyBundle()->getCurrencyNames()`` + +The choices option defaults to all currencies. + +Inherited options +----------------- + +These options inherit from the :doc:`choice` type: + +.. include:: /reference/forms/types/options/multiple.rst.inc + +.. include:: /reference/forms/types/options/expanded.rst.inc + +.. include:: /reference/forms/types/options/preferred_choices.rst.inc + +.. include:: /reference/forms/types/options/empty_value.rst.inc + +.. include:: /reference/forms/types/options/error_bubbling.rst.inc + +These options inherit from the :doc:`date` type: + +.. include:: /reference/forms/types/options/required.rst.inc + +.. include:: /reference/forms/types/options/label.rst.inc + +.. include:: /reference/forms/types/options/read_only.rst.inc + +.. include:: /reference/forms/types/options/disabled.rst.inc + +.. include:: /reference/forms/types/options/mapped.rst.inc + +.. _`3-letter ISO 4217`: http://en.wikipedia.org/wiki/ISO_4217 diff --git a/reference/forms/types/map.rst.inc b/reference/forms/types/map.rst.inc index a57e4880f68..3bbbcc64c32 100644 --- a/reference/forms/types/map.rst.inc +++ b/reference/forms/types/map.rst.inc @@ -21,6 +21,7 @@ Choice Fields * :doc:`language` * :doc:`locale` * :doc:`timezone` +* :doc:`currency` Date and Time Fields ~~~~~~~~~~~~~~~~~~~~ From 87b9556e7f66227598fc34a3c0378bd5e45c5583 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Fri, 21 Jun 2013 09:01:33 +0200 Subject: [PATCH 0329/2078] Avoid scrollbars in code examples --- book/controller.rst | 5 +- book/doctrine.rst | 26 +++++-- book/forms.rst | 26 ++++--- book/installation.rst | 3 +- book/internals.rst | 45 +++++++++--- book/page_creation.rst | 21 ++++-- book/performance.rst | 3 +- book/propel.rst | 40 ++++++++--- book/routing.rst | 89 +++++++++++++++-------- book/security.rst | 142 ++++++++++++++++++++++++++++--------- book/service_container.rst | 13 ++-- book/templating.rst | 45 ++++++++---- book/validation.rst | 21 ++++-- 13 files changed, 353 insertions(+), 126 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 1eac0bd0640..932bc8c0c60 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -667,7 +667,10 @@ For example, imagine you're processing a form submit:: if ($form->isValid()) { // do some sort of processing - $this->get('session')->getFlashBag()->add('notice', 'Your changes were saved!'); + $this->get('session')->getFlashBag()->add( + 'notice', + 'Your changes were saved!' + ); return $this->redirect($this->generateUrl(...)); } diff --git a/book/doctrine.rst b/book/doctrine.rst index e9d09d5b784..9c2e3965f5e 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -212,7 +212,9 @@ just a simple PHP class. .. code-block:: bash - $ php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Product" --fields="name:string(255) price:float description:text" + $ php app/console doctrine:generate:entity \ + --entity="AcmeStoreBundle:Product" \ + --fields="name:string(255) price:float description:text" .. index:: single: Doctrine; Adding mapping metadata @@ -696,7 +698,10 @@ a controller, do the following:: $em = $this->getDoctrine()->getManager(); $query = $em->createQuery( - 'SELECT p FROM AcmeStoreBundle:Product p WHERE p.price > :price ORDER BY p.price ASC' + 'SELECT p + FROM AcmeStoreBundle:Product p + WHERE p.price > :price + ORDER BY p.price ASC' )->setParameter('price', '19.99'); $products = $query->getResult(); @@ -858,7 +863,9 @@ ordered alphabetically. public function findAllOrderedByName() { return $this->getEntityManager() - ->createQuery('SELECT p FROM AcmeStoreBundle:Product p ORDER BY p.name ASC') + ->createQuery( + 'SELECT p FROM AcmeStoreBundle:Product p ORDER BY p.name ASC' + ) ->getResult(); } } @@ -892,7 +899,8 @@ you can let Doctrine create the class for you. .. code-block:: bash - $ php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Category" --fields="name:string(255)" + $ php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Category" \ + --fields="name:string(255)" This task generates the ``Category`` entity for you, with an ``id`` field, a ``name`` field and the associated getter and setter functions. @@ -937,7 +945,7 @@ To relate the ``Category`` and ``Product`` entities, start by creating a products: targetEntity: Product mappedBy: category - # don't forget to init the collection in entity __construct() method + # don't forget to init the collection in the __construct() method of the entity .. code-block:: xml @@ -954,7 +962,10 @@ To relate the ``Category`` and ``Product`` entities, start by creating a mapped-by="category" /> - + @@ -1325,7 +1336,8 @@ the current date, only when the entity is first persisted (i.e. inserted): - + diff --git a/book/forms.rst b/book/forms.rst index 945fc177b7a..fcbbefb2224 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -344,7 +344,10 @@ object. $metadata->addPropertyConstraint('task', new NotBlank()); $metadata->addPropertyConstraint('dueDate', new NotBlank()); - $metadata->addPropertyConstraint('dueDate', new Type('\DateTime')); + $metadata->addPropertyConstraint( + 'dueDate', + new Type('\DateTime') + ); } } @@ -424,7 +427,10 @@ to an array callback, or a ``Closure``:: public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( - 'validation_groups' => array('Acme\\AcmeBundle\\Entity\\Client', 'determineValidationGroups'), + 'validation_groups' => array( + 'Acme\AcmeBundle\Entity\Client', + 'determineValidationGroups', + ), )); } @@ -903,7 +909,8 @@ easy to use in your application. .. code-block:: xml - + @@ -913,7 +920,10 @@ easy to use in your application. use Symfony\Component\DependencyInjection\Definition; $container - ->register('acme_demo.form.type.task', 'Acme\TaskBundle\Form\Type\TaskType') + ->register( + 'acme_demo.form.type.task', + 'Acme\TaskBundle\Form\Type\TaskType' + ) ->addTag('form.type', array( 'alias' => 'task', )) @@ -1286,13 +1296,13 @@ rendered (e.g. ``label``, ``widget``, ``errors``, etc). By default, there are 4 possible *parts* of a form that can be rendered: +-------------+--------------------------+---------------------------------------------------------+ -| ``label`` | (e.g. ``form_label``) | renders the field's label | +| ``label`` | (e.g. ``form_label``) | renders the field's label | +-------------+--------------------------+---------------------------------------------------------+ -| ``widget`` | (e.g. ``form_widget``) | renders the field's HTML representation | +| ``widget`` | (e.g. ``form_widget``) | renders the field's HTML representation | +-------------+--------------------------+---------------------------------------------------------+ -| ``errors`` | (e.g. ``form_errors``) | renders the field's errors | +| ``errors`` | (e.g. ``form_errors``) | renders the field's errors | +-------------+--------------------------+---------------------------------------------------------+ -| ``row`` | (e.g. ``form_row``) | renders the field's entire row (label, widget & errors) | +| ``row`` | (e.g. ``form_row``) | renders the field's entire row (label, widget & errors) | +-------------+--------------------------+---------------------------------------------------------+ .. note:: diff --git a/book/installation.rst b/book/installation.rst index e79fa0a172d..df4b40b63ee 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -57,7 +57,8 @@ Distribution: .. code-block:: bash - php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.2.0 + $ php composer.phar create-project \ + symfony/framework-standard-edition /path/to/webroot/Symfony 2.2.0 .. tip:: diff --git a/book/internals.rst b/book/internals.rst index d61951b86fb..96d35cf91cc 100644 --- a/book/internals.rst +++ b/book/internals.rst @@ -418,7 +418,11 @@ and set a new ``Exception`` object, or do nothing:: response won't work. If you want to overwrite the status code (which you should not without a good reason), set the ``X-Status-Code`` header:: - return new Response('Error', 404 /* ignored */, array('X-Status-Code' => 200)); + return new Response( + 'Error', + 404 // ignored, + array('X-Status-Code' => 200) + ); .. index:: single: Event Dispatcher @@ -610,11 +614,19 @@ If you enable the web profiler, you also need to mount the profiler routes: .. code-block:: xml - + .. code-block:: php - $collection->addCollection($loader->import("@WebProfilerBundle/Resources/config/routing/profiler.xml"), '/_profiler'); + $collection->addCollection( + $loader->import( + "@WebProfilerBundle/Resources/config/routing/profiler.xml" + ), + '/_profiler' + ); As the profiler adds some overhead, you might want to enable it only under certain circumstances in the production environment. The ``only-exceptions`` @@ -626,7 +638,8 @@ portion of the website? You can use a request matcher: .. code-block:: yaml - # enables the profiler only for request coming for the 192.168.0.0 network + # enables the profiler only for request coming + # for the 192.168.0.0 network framework: profiler: matcher: { ip: 192.168.0.0/24 } @@ -641,14 +654,18 @@ portion of the website? You can use a request matcher: profiler: matcher: { ip: 192.168.0.0/24, path: "^/admin/" } - # use a custom matcher instance defined in the "custom_matcher" service + # use a custom matcher instance defined in + # the "custom_matcher" service framework: profiler: matcher: { service: custom_matcher } .. code-block:: xml - + @@ -669,7 +686,10 @@ portion of the website? You can use a request matcher: - + @@ -678,7 +698,8 @@ portion of the website? You can use a request matcher: .. code-block:: php - // enables the profiler only for request coming for the 192.168.0.0 network + // enables the profiler only for request coming + // for the 192.168.0.0 network $container->loadFromExtension('framework', array( 'profiler' => array( 'matcher' => array('ip' => '192.168.0.0/24'), @@ -695,11 +716,15 @@ portion of the website? You can use a request matcher: // combine rules $container->loadFromExtension('framework', array( 'profiler' => array( - 'matcher' => array('ip' => '192.168.0.0/24', 'path' => '^/admin/'), + 'matcher' => array( + 'ip' => '192.168.0.0/24', + 'path' => '^/admin/', + ), ), )); - # use a custom matcher instance defined in the "custom_matcher" service + // use a custom matcher instance defined in + // the "custom_matcher" service $container->loadFromExtension('framework', array( 'profiler' => array( 'matcher' => array('service' => 'custom_matcher'), diff --git a/book/page_creation.rst b/book/page_creation.rst index 33a91bdde80..f136b25546b 100644 --- a/book/page_creation.rst +++ b/book/page_creation.rst @@ -114,9 +114,11 @@ an entry when you generated the ``AcmeHelloBundle``: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> - + .. code-block:: php @@ -157,7 +159,8 @@ the new route that defines the URL of the page that you're about to create: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeHelloBundle:Hello:index @@ -771,7 +774,9 @@ format you prefer: $container->loadFromExtension('framework', array( 'secret' => '%secret%', - 'router' => array('resource' => '%kernel.root_dir%/config/routing.php'), + 'router' => array( + 'resource' => '%kernel.root_dir%/config/routing.php', + ), // ... ), )); @@ -940,7 +945,9 @@ the configuration file for the ``dev`` environment. - + @@ -952,7 +959,9 @@ the configuration file for the ``dev`` environment. $loader->import('config.php'); $container->loadFromExtension('framework', array( - 'router' => array('resource' => '%kernel.root_dir%/config/routing_dev.php'), + 'router' => array( + 'resource' => '%kernel.root_dir%/config/routing_dev.php', + ), 'profiler' => array('only-exceptions' => false), )); diff --git a/book/performance.rst b/book/performance.rst index 9224233ba6e..51c19f1b762 100644 --- a/book/performance.rst +++ b/book/performance.rst @@ -79,7 +79,8 @@ as comments in this file:: $loader = require_once __DIR__.'/../app/bootstrap.php.cache'; // Use APC for autoloading to improve performance - // Change 'sf2' by the prefix you want in order to prevent key conflict with another application + // Change 'sf2' by the prefix you want in order + // to prevent key conflict with another application /* $loader = new ApcClassLoader('sf2', $loader); $loader->register(true); diff --git a/book/propel.rst b/book/propel.rst index bfc51a772a1..71589d9dae2 100644 --- a/book/propel.rst +++ b/book/propel.rst @@ -304,22 +304,46 @@ Start by adding the ``category`` definition in your ``schema.xml``: .. code-block:: xml - + - - - - + + + + + + + + + -
- - + + +
diff --git a/book/routing.rst b/book/routing.rst index dd69eb1ba9f..eb7b64fd1b8 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -47,7 +47,8 @@ The route is simple: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeBlogBundle:Blog:show @@ -175,7 +176,9 @@ file: // app/config/config.php $container->loadFromExtension('framework', array( // ... - 'router' => array('resource' => '%kernel.root_dir%/config/routing.php'), + 'router' => array( + 'resource' => '%kernel.root_dir%/config/routing.php', + ), )); .. tip:: @@ -207,7 +210,8 @@ A basic route consists of just two parts: the ``path`` to match and a + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeDemoBundle:Main:homepage @@ -255,7 +259,8 @@ routes will contain one or more named "wildcard" placeholders: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeBlogBundle:Blog:show @@ -304,7 +309,8 @@ the available blog posts for this imaginary blog application: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeBlogBundle:Blog:index @@ -342,7 +348,8 @@ entries? Update the route to have a new ``{page}`` placeholder: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeBlogBundle:Blog:index @@ -385,7 +392,8 @@ This is done by including it in the ``defaults`` collection: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeBlogBundle:Blog:index @@ -450,7 +458,8 @@ Take a quick look at the routes that have been created so far: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeBlogBundle:Blog:index @@ -515,7 +524,8 @@ requirements can easily be added for each parameter. For example: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeBlogBundle:Blog:index @@ -585,7 +595,8 @@ URL: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeDemoBundle:Main:homepage @@ -654,7 +665,8 @@ be accomplished with the following route configuration: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeDemoBundle:Main:contact @@ -735,14 +747,18 @@ routing system can be: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> + + - AcmeDemoBundle:Article:show html en|fr html|rss \d+ + @@ -752,14 +768,17 @@ routing system can be: use Symfony\Component\Routing\Route; $collection = new RouteCollection(); - $collection->add('homepage', new Route('/articles/{culture}/{year}/{title}.{_format}', array( - '_controller' => 'AcmeDemoBundle:Article:show', - '_format' => 'html', - ), array( - 'culture' => 'en|fr', - '_format' => 'html|rss', - 'year' => '\d+', - ))); + $collection->add( + 'homepage', + new Route('/articles/{culture}/{year}/{title}.{_format}', array( + '_controller' => 'AcmeDemoBundle:Article:show', + '_format' => 'html', + ), array( + 'culture' => 'en|fr', + '_format' => 'html|rss', + 'year' => '\d+', + )) + ); return $collection; @@ -928,7 +947,8 @@ be done by "importing" that file: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> @@ -939,7 +959,9 @@ be done by "importing" that file: use Symfony\Component\Routing\RouteCollection; $collection = new RouteCollection(); - $collection->addCollection($loader->import("@AcmeHelloBundle/Resources/config/routing.php")); + $collection->addCollection( + $loader->import("@AcmeHelloBundle/Resources/config/routing.php") + ); return $collection; @@ -969,7 +991,8 @@ like this: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeHelloBundle:Hello:index @@ -1015,9 +1038,11 @@ instead of simply ``/hello/{name}``: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> - + .. code-block:: php @@ -1027,7 +1052,9 @@ instead of simply ``/hello/{name}``: $collection = new RouteCollection(); - $acmeHello = $loader->import("@AcmeHelloBundle/Resources/config/routing.php"); + $acmeHello = $loader->import( + "@AcmeHelloBundle/Resources/config/routing.php" + ); $acmeHello->setPrefix('/admin'); $collection->addCollection($acmeHello); @@ -1216,7 +1243,9 @@ a template helper function: .. code-block:: html+php - + Read this blog post. @@ -1232,7 +1261,9 @@ Absolute URLs can also be generated. .. code-block:: html+php - + Read this blog post. diff --git a/book/security.rst b/book/security.rst index cb583031a90..ddc12f21f19 100644 --- a/book/security.rst +++ b/book/security.rst @@ -70,7 +70,8 @@ authentication (i.e. the old-school username/password box): + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd"> @@ -91,7 +92,8 @@ authentication (i.e. the old-school username/password box): - + @@ -115,8 +117,14 @@ authentication (i.e. the old-school username/password box): 'in_memory' => array( 'memory' => array( 'users' => array( - 'ryan' => array('password' => 'ryanpass', 'roles' => 'ROLE_USER'), - 'admin' => array('password' => 'kitten', 'roles' => 'ROLE_ADMIN'), + 'ryan' => array( + 'password' => 'ryanpass', + 'roles' => 'ROLE_USER', + ), + 'admin' => array( + 'password' => 'kitten', + 'roles' => 'ROLE_ADMIN', + ), ), ), ), @@ -308,7 +316,8 @@ First, enable form login under your firewall: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd"> @@ -381,7 +390,8 @@ submission (i.e. ``/login_check``): + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeSecurityBundle:Security:login @@ -484,7 +494,8 @@ Finally, create the corresponding template: {# - If you want to control the URL the user is redirected to on success (more details below) + If you want to control the URL the user + is redirected to on success (more details below) #} @@ -506,7 +517,8 @@ Finally, create the corresponding template: @@ -801,10 +813,25 @@ Take the following ``access_control`` entries as an example: .. code-block:: php 'access_control' => array( - array('path' => '^/admin', 'role' => 'ROLE_USER_IP', 'ip' => '127.0.0.1'), - array('path' => '^/admin', 'role' => 'ROLE_USER_HOST', 'host' => 'symfony.com'), - array('path' => '^/admin', 'role' => 'ROLE_USER_METHOD', 'method' => 'POST, PUT'), - array('path' => '^/admin', 'role' => 'ROLE_USER'), + array( + 'path' => '^/admin', + 'role' => 'ROLE_USER_IP', + 'ip' => '127.0.0.1', + ), + array( + 'path' => '^/admin', + 'role' => 'ROLE_USER_HOST', + 'host' => 'symfony.com', + ), + array( + 'path' => '^/admin', + 'role' => 'ROLE_USER_METHOD', + 'method' => 'POST, PUT', + ), + array( + 'path' => '^/admin', + 'role' => 'ROLE_USER', + ), ), For each incoming request, Symfony will decide which ``access_control`` @@ -894,15 +921,23 @@ given prefix, ``/esi``, from outside access: .. code-block:: xml - + .. code-block:: php 'access_control' => array( - array('path' => '^/esi', 'role' => 'IS_AUTHENTICATED_ANONYMOUSLY', 'ip' => '127.0.0.1'), - array('path' => '^/esi', 'role' => 'ROLE_NO_ACCESS'), + array( + 'path' => '^/esi', + 'role' => 'IS_AUTHENTICATED_ANONYMOUSLY', + 'ip' => '127.0.0.1', + ), + array( + 'path' => '^/esi', + 'role' => 'ROLE_NO_ACCESS', + ), ), Here is how it works when the path is ``/esi/something`` coming from the @@ -946,13 +981,18 @@ You can also require a user to access a URL via SSL; just use the .. code-block:: xml - + .. code-block:: php 'access_control' => array( - array('path' => '^/cart/checkout', 'role' => 'IS_AUTHENTICATED_ANONYMOUSLY', 'requires_channel' => 'https'), + array( + 'path' => '^/cart/checkout', + 'role' => 'IS_AUTHENTICATED_ANONYMOUSLY', + 'requires_channel' => 'https', + ), ), .. _book-security-securing-controller: @@ -1087,8 +1127,14 @@ In fact, you've seen this already in the example in this chapter. 'default_provider' => array( 'memory' => array( 'users' => array( - 'ryan' => array('password' => 'ryanpass', 'roles' => 'ROLE_USER'), - 'admin' => array('password' => 'kitten', 'roles' => 'ROLE_ADMIN'), + 'ryan' => array( + 'password' => 'ryanpass', + 'roles' => 'ROLE_USER', + ), + 'admin' => array( + 'password' => 'kitten', + 'roles' => 'ROLE_ADMIN', + ), ), ), ), @@ -1202,7 +1248,10 @@ class: $container->loadFromExtension('security', array( 'providers' => array( 'main' => array( - 'entity' => array('class' => 'Acme\UserBundle\Entity\User', 'property' => 'username'), + 'entity' => array( + 'class' => 'Acme\UserBundle\Entity\User', + 'property' => 'username', + ), ), ), )); @@ -1258,12 +1307,19 @@ do the following: - - + + - + .. code-block:: php @@ -1275,8 +1331,14 @@ do the following: 'in_memory' => array( 'memory' => array( 'users' => array( - 'ryan' => array('password' => 'bb87a29949f3a1ee0559f8a57357487151281386', 'roles' => 'ROLE_USER'), - 'admin' => array('password' => '74913f5cd5f61ec0bcfdb775414c2fb3d161b620', 'roles' => 'ROLE_ADMIN'), + 'ryan' => array( + 'password' => 'bb87a29949f3a1ee0559f8a57357487151281386', + 'roles' => 'ROLE_USER', + ), + 'admin' => array( + 'password' => '74913f5cd5f61ec0bcfdb775414c2fb3d161b620', + 'roles' => 'ROLE_ADMIN', + ), ), ), ), @@ -1465,7 +1527,10 @@ a new provider that chains the two together: ), ), 'user_db' => array( - 'entity' => array('class' => 'Acme\UserBundle\Entity\User', 'property' => 'username'), + 'entity' => array( + 'class' => 'Acme\UserBundle\Entity\User', + 'property' => 'username', + ), ), ), )); @@ -1503,7 +1568,9 @@ the user from both the ``in_memory`` and ``user_db`` providers. - + + @@ -1518,7 +1585,9 @@ the user from both the ``in_memory`` and ``user_db`` providers. 'foo' => array('password' => 'test'), ), ), - 'entity' => array('class' => 'Acme\UserBundle\Entity\User', 'property' => 'username'), + 'entity' => array( + 'class' => 'Acme\UserBundle\Entity\User', + 'property' => 'username'), ), ), )); @@ -1627,7 +1696,10 @@ rules by creating a role hierarchy: $container->loadFromExtension('security', array( 'role_hierarchy' => array( 'ROLE_ADMIN' => 'ROLE_USER', - 'ROLE_SUPER_ADMIN' => array('ROLE_ADMIN', 'ROLE_ALLOWED_TO_SWITCH'), + 'ROLE_SUPER_ADMIN' => array( + 'ROLE_ADMIN', + 'ROLE_ALLOWED_TO_SWITCH', + ), ), )); @@ -1725,7 +1797,8 @@ a route so that you can use it to generate the URL: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> @@ -1868,7 +1941,9 @@ to show a link to exit impersonation: isGranted('ROLE_PREVIOUS_ADMIN')): ?> Exit impersonation @@ -1908,7 +1983,10 @@ setting: 'firewalls' => array( 'main'=> array( // ... - 'switch_user' => array('role' => 'ROLE_ADMIN', 'parameter' => '_want_to_be_this_user'), + 'switch_user' => array( + 'role' => 'ROLE_ADMIN', + 'parameter' => '_want_to_be_this_user', + ), ), ), )); diff --git a/book/service_container.rst b/book/service_container.rst index 1de05025ee0..1f4acaedb88 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -464,7 +464,9 @@ invokes the service container extension inside the ``FrameworkBundle``: 'secret' => 'xxxxxxxxxx', 'form' => array(), 'csrf-protection' => array(), - 'router' => array('resource' => '%kernel.root_dir%/config/routing.php'), + 'router' => array( + 'resource' => '%kernel.root_dir%/config/routing.php', + ), // ... )); @@ -819,8 +821,10 @@ so that it can generate the email content via a template:: protected $templating; - public function __construct(\Swift_Mailer $mailer, EngineInterface $templating) - { + public function __construct( + \Swift_Mailer $mailer, + EngineInterface $templating + ) { $this->mailer = $mailer; $this->templating = $templating; } @@ -890,7 +894,8 @@ to be used for a specific purpose. Take the following example: .. code-block:: xml - + diff --git a/book/templating.rst b/book/templating.rst index 04e420e3bc3..935d4809898 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -537,7 +537,10 @@ Including this template from any other template is simple:

Recent Articles

{% for article in articles %} - {{ include('AcmeArticleBundle:Article:articleDetails.html.twig', {'article': article}) }} + {{ include( + 'AcmeArticleBundle:Article:articleDetails.html.twig', + { 'article': article } + ) }} {% endfor %} {% endblock %} @@ -644,7 +647,9 @@ string syntax for controllers (i.e. **bundle**:**controller**:**action**): {# ... #} .. code-block:: html+php @@ -654,7 +659,10 @@ string syntax for controllers (i.e. **bundle**:**controller**:**action**): @@ -740,7 +748,8 @@ in your application configuration: - + .. code-block:: php @@ -749,7 +758,9 @@ in your application configuration: $container->loadFromExtension('framework', array( // ... 'templating' => array( - 'hinclude_default_template' => array('AcmeDemoBundle::hinclude.html.twig'), + 'hinclude_default_template' => array( + 'AcmeDemoBundle::hinclude.html.twig', + ), ), )); @@ -763,7 +774,9 @@ any global default template that is defined): .. code-block:: jinja - {{ render_hinclude(controller('...'), {'default': 'AcmeDemoBundle:Default:content.html.twig'}) }} + {{ render_hinclude(controller('...'), { + 'default': 'AcmeDemoBundle:Default:content.html.twig' + }) }} .. code-block:: php @@ -892,7 +905,9 @@ correctly: - + getTitle() ?> @@ -990,14 +1005,14 @@ stylesheets and Javascripts that you'll need throughout your site: {# ... #} {% block stylesheets %} - + {% endblock %} {# ... #} {% block javascripts %} - + {% endblock %} @@ -1015,7 +1030,7 @@ page. From inside that contact page's template, do the following: {% block stylesheets %} {{ parent() }} - + {% endblock %} {# ... #} @@ -1033,7 +1048,7 @@ is by default "web"). .. code-block:: html+jinja - + The end result is a page that includes both the ``main.css`` and ``contact.css`` stylesheets. @@ -1418,7 +1433,8 @@ console command: .. code-block:: bash # You can check by filename: - $ php app/console twig:lint src/Acme/ArticleBundle/Resources/views/Article/recentList.html.twig + $ php app/console twig:lint \ + src/Acme/ArticleBundle/Resources/views/Article/recentList.html.twig # or by directory: $ php app/console twig:lint src/Acme/ArticleBundle/Resources/views @@ -1474,7 +1490,10 @@ key in the parameter hash: .. code-block:: html+php - + PDF Version diff --git a/book/validation.rst b/book/validation.rst index f1c676eca9a..3293ed99e4b 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -908,13 +908,22 @@ username and the password are different only if all other validation passes { public static function loadValidatorMetadata(ClassMetadata $metadata) { - $metadata->addPropertyConstraint('username', new Assert\NotBlank()); - $metadata->addPropertyConstraint('password', new Assert\NotBlank()); + $metadata->addPropertyConstraint( + 'username', + new Assert\NotBlank() + ); + $metadata->addPropertyConstraint( + 'password', + new Assert\NotBlank() + ); - $metadata->addGetterConstraint('passwordLegal', new Assert\True(array( - 'message' => 'The password cannot match your first name', - 'groups' => array('Strict'), - ))); + $metadata->addGetterConstraint( + 'passwordLegal', + new Assert\True(array( + 'message' => 'The password cannot match your first name', + 'groups' => array('Strict'), + )) + ); $metadata->setGroupSequence(array('User', 'Strict')); } From 788292b042462b8f75a5ec29c7aa528541b87123 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 29 Jun 2013 17:33:12 -0500 Subject: [PATCH 0330/2078] [#2690][#2720][#2758] Updating README for new PR merge version - taken from @WouterJ's PR --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 498ccb7adb9..79ea15a20ee 100644 --- a/README.markdown +++ b/README.markdown @@ -8,8 +8,8 @@ Contributing >**Note** >Unless you're documenting a feature that's new to a specific version of Symfony ->(e.g. Symfony 2.2), all pull requests must be based off of the **2.1** branch, ->**not** the master or 2.2 branch. +>(e.g. Symfony 2.3), all pull requests must be based off of the **2.2** branch, +>**not** the master or 2.3 branch. We love contributors! For more information on how you can contribute to the Symfony documentation, please read From 3665ed039490c92b3685b0d3891c2da8f30157d8 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 29 Jun 2013 17:55:42 -0500 Subject: [PATCH 0331/2078] Removing the form "field" type, which was removed in Symfony 2.3 --- reference/forms/types.rst | 1 - reference/forms/types/field.rst | 8 -------- reference/forms/types/map.rst.inc | 1 - 3 files changed, 10 deletions(-) delete mode 100644 reference/forms/types/field.rst diff --git a/reference/forms/types.rst b/reference/forms/types.rst index 9c46ae00770..5d9dacd50b6 100644 --- a/reference/forms/types.rst +++ b/reference/forms/types.rst @@ -19,7 +19,6 @@ Form Types Reference types/email types/entity types/file - types/field types/form types/hidden types/integer diff --git a/reference/forms/types/field.rst b/reference/forms/types/field.rst deleted file mode 100644 index ee06911d6bb..00000000000 --- a/reference/forms/types/field.rst +++ /dev/null @@ -1,8 +0,0 @@ -.. index:: - single: Forms; Fields; field - -The Abstract "field" Type -========================= - -The ``field`` form type is deprecated as of Symfony 2.1. -Please use the :doc:`Form field type` instead. diff --git a/reference/forms/types/map.rst.inc b/reference/forms/types/map.rst.inc index a57e4880f68..a14da04a67c 100644 --- a/reference/forms/types/map.rst.inc +++ b/reference/forms/types/map.rst.inc @@ -58,5 +58,4 @@ Buttons Base Fields ~~~~~~~~~~~ -* :doc:`field` * :doc:`form` From be6c2484adcacd2506bfcbfff38d28f3ee68d5a4 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 30 Jun 2013 12:23:59 +0200 Subject: [PATCH 0332/2078] Updated images to match the new github design --- contributing/documentation/overview.rst | 6 ++---- images/docs-pull-request-change-base.png | Bin 3337 -> 5849 bytes images/docs-pull-request.png | Bin 28574 -> 0 bytes 3 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 images/docs-pull-request.png diff --git a/contributing/documentation/overview.rst b/contributing/documentation/overview.rst index c7524b11d28..8e1e0a81b20 100644 --- a/contributing/documentation/overview.rst +++ b/contributing/documentation/overview.rst @@ -58,11 +58,9 @@ Creating a Pull Request Following the example, the pull request will default to be between your ``improving_foo_and_bar`` branch and the ``symfony-docs`` ``master`` branch. -.. image:: /images/docs-pull-request.png - :align: center - If you have made your changes based on the 2.2 branch then you need to change -the base branch to be 2.2 on the preview page: +the base branch to be 2.2 on the preview page by clicking the ``edit`` button +on the top left: .. image:: /images/docs-pull-request-change-base.png :align: center diff --git a/images/docs-pull-request-change-base.png b/images/docs-pull-request-change-base.png index 64e9423e363684d408c4ea5126b86ee7f600db05..d824e8ef1bc507beaf51bf95fbee20093dc44dff 100644 GIT binary patch literal 5849 zcmZ9QcQ{;I*TBcgobIxA-tg_d0_IlR-MQEx+$VhIJ0000orKbwd003MR_FaSsh`kT` zIhJ7`IBw4%a)9z-#!c)1&rViN767P<16^6*W5+C3PoJp)0Nz{xKwt;}aDf#CZU6x8 z4*-BIa{xdh1pv6^lHR2C2mqkfS5lDG@ig6q!rbN*Xl(+tugB$f0swW*G$CS0PipCX z;zFZHI)+~Lyuf9x_i`=+Rj!}e z-eZjgpD$V^kfXQ)jZEn-1-x(o6$?-ykcbk8O$P5>EC2zf{zHJBwU+>X5%L2vKK{2@ z(~dG6_;1k$E?yz*(ws^hA8YDwyFusvyKlHP>OXw=)%*Y51%AA^xY*k(55Ji92P^FM z^z?lFYFe^R+;GyOfqeRp4IH)+Cp;DtRx?)1H%+w5)wEh5u_9O+T$@qqj}RQ?0Eai5 z>&csW}fMlmZ;oJ4CS;Q{IV|93q zo2Fd{40v=h_N2HkWr!sTP0_=d62fN5;Sb(j6J)-F?!}K zEJke&pii&6v!9xr6-n8ZH;JfZ2}RHi#7IPWlAmGUj7zXcp404n)5&O^80518 z_P>^Sm;6pTm!#K>E#7MjLqgb}A1)I^^dNA8NV<8C6Ue!dRa-vEP*(&uL>1XMyEL{6 z5~H>;ySuv@(mz(;n)z?u*)t3Hc@lNM?Yx7K`ReD{f_Uq(Ifr3uh3Xxtobl2Aq+*wb zN6#GGybb2*3SezxU;5UHD+_Z_NQa`{Z|{>ORn-?sKnUQo2pPSIawrt)cQho5Mx!O^ zTPEf)81J)r4}H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ZlW()a!$o(r>~>B34+a9i+geNF&Gj~cxM#<2Y-Un z$Fif)QsikdVDhuNqvGjR@%r?QVAh4}z?E(<#gbJW=T2-@-QCu3tTfRo8YeaGcQJ;yyktc+R_> z$+p{oxnueWmk$C$$sO0G+Eh^dU7bmD*k;j<_fOubgoj0&4@jk-zlp|VR>KRGy;VfX zP#jQ$MP@8c7x9P8WZYE2(RCpl${9Hw5LDTEpHXgmY*j~$UA|R%H!gPh3^EITQq-FuhcnS3wstBkLx=1~vON`tX943^cmV5G+UA8OLd|#`t;88hxTP z`hm{PBdfc7&%zp|KI%2)A)+HQ;;;=eWP}ORLUp6kUF#F;Ug@LZrO&hjG6T95wgjp? zzI2z4p;#!oIc)#u1y!W(`+;w{o+x+s<(B^GyVw^5b@L7CKl2sz$99q zQy?Qqo9fF}nAWVd$z7v-nn8XDO>W1Ngd>(;0%p}&qkqRP8}B4;5ce(}V4&M`Ka7d` zlP_D6mAoG`2gyg_w2gSe^?+3@xURUiOgomAls|$8HHbE6@=8=}exEk?AOrX;E#!;* zgzw}jy&y$}Ckc?zT^&y4^s+hX*6;Ywpfdn{h85)~NKk!Q*GUf;up`ArQGKp~)~_3$ zIfZ=A|D{|Tx^GB#yYAXO^^&yzdw0Dd@^H#+lfcquTS9jUiN@0GrVY+#bg|2B&MD6r!P?fv_Qz3#b>g219I~yx}`2Fp#7uK%`no-~ayseW+^S From 35e719735f2e6ed52fe33e4ef342d34bf396f5e2 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 30 Jun 2013 14:45:33 +0200 Subject: [PATCH 0333/2078] Fixed typo --- book/validation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/validation.rst b/book/validation.rst index f1c676eca9a..13758f8f6c9 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -814,7 +814,7 @@ and then the groups in the group sequence are validated in order. .. tip:: Group sequences cannot contain the group ``Default``, as this would create - a loop. Instead, use the group ``{ClassName}`` (e.g. ``User``) instead. + a loop. Instead, use the group ``{ClassName}`` (e.g. ``User``). For example, suppose you have a ``User`` class and want to validate that the username and the password are different only if all other validation passes From 7e06f9f1d23eb8baeaa4107ecc9efc072f40dfa8 Mon Sep 17 00:00:00 2001 From: Hyunmin Kim Date: Sat, 30 Mar 2013 12:01:55 -0700 Subject: [PATCH 0334/2078] Added missing options. --- reference/forms/types/checkbox.rst | 7 +++++++ reference/forms/types/datetime.rst | 3 +++ reference/forms/types/form.rst | 5 +++++ reference/forms/types/integer.rst | 3 +++ reference/forms/types/number.rst | 2 ++ reference/forms/types/options/precision.rst.inc | 9 +++++++++ reference/forms/types/time.rst | 3 +++ 7 files changed, 32 insertions(+) create mode 100644 reference/forms/types/options/precision.rst.inc diff --git a/reference/forms/types/checkbox.rst b/reference/forms/types/checkbox.rst index e72400d2684..00034b4da74 100644 --- a/reference/forms/types/checkbox.rst +++ b/reference/forms/types/checkbox.rst @@ -12,6 +12,7 @@ if the box is unchecked, the value will be set to false. | Rendered as | ``input`` ``checkbox`` field | +-------------+------------------------------------------------------------------------+ | Options | - `value`_ | +| | - `checked`_ | +-------------+------------------------------------------------------------------------+ | Inherited | - `required`_ | | options | - `label`_ | @@ -47,6 +48,12 @@ value The value that's actually used as the value for the checkbox. This does not affect the value that's set on your object. +checked +~~~~~~~ + +**type**: ``mixed`` **default**: ``1`` + + Inherited options ----------------- diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst index d920857f531..d034ad46389 100644 --- a/reference/forms/types/datetime.rst +++ b/reference/forms/types/datetime.rst @@ -28,6 +28,7 @@ data can be a ``DateTime`` object, a string, a timestamp or an array. | | - `with_seconds`_ | | | - `data_timezone`_ | | | - `user_timezone`_ | +| | - `empty_value`_ | +----------------------+-----------------------------------------------------------------------------+ | Inherited | - `invalid_message`_ | | options | - `invalid_message_parameters`_ | @@ -101,6 +102,8 @@ for more details. .. include:: /reference/forms/types/options/user_timezone.rst.inc +.. include:: /reference/forms/types/options/empty_value.rst.inc + Inherited options ----------------- diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index 9fc066f6691..9520e3d9e79 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -30,3 +30,8 @@ on all fields. .. include:: /reference/forms/types/options/attr.rst.inc .. include:: /reference/forms/types/options/translation_domain.rst.inc + +virtual +------- + +See :doc:`How to use the Virtual Form Field Option` diff --git a/reference/forms/types/integer.rst b/reference/forms/types/integer.rst index 00bd559e67e..b1a3d518eea 100644 --- a/reference/forms/types/integer.rst +++ b/reference/forms/types/integer.rst @@ -16,6 +16,7 @@ integers. By default, all non-integer values (e.g. 6.78) will round down (e.g. 6 | Rendered as | ``input`` ``text`` field | +-------------+-----------------------------------------------------------------------+ | Options | - `rounding_mode`_ | +| | - `precision`_ | | | - `grouping`_ | +-------------+-----------------------------------------------------------------------+ | Inherited | - `required`_ | @@ -36,6 +37,8 @@ integers. By default, all non-integer values (e.g. 6.78) will round down (e.g. 6 Field Options ------------- +.. include:: /reference/forms/types/options/precision.rst.inc + rounding_mode ~~~~~~~~~~~~~ diff --git a/reference/forms/types/number.rst b/reference/forms/types/number.rst index 1dd5234c38b..9d40d422ce9 100644 --- a/reference/forms/types/number.rst +++ b/reference/forms/types/number.rst @@ -33,6 +33,8 @@ you want to use for your number. Field Options ------------- +.. include:: /reference/forms/types/options/precision.rst.inc + precision ~~~~~~~~~ diff --git a/reference/forms/types/options/precision.rst.inc b/reference/forms/types/options/precision.rst.inc new file mode 100644 index 00000000000..ac606eb8a5d --- /dev/null +++ b/reference/forms/types/options/precision.rst.inc @@ -0,0 +1,9 @@ +precision +~~~~~~~~~ + +**type**: ``integer`` **default**: Locale-specific (usually around ``3``) + +This specifies how many decimals will be allowed until the field rounds +the submitted value (via ``rounding_mode``). For example, if ``precision`` +is set to ``2``, a submitted value of ``20.123`` will be rounded to, +for example, ``20.12`` (depending on your ``rounding_mode``). diff --git a/reference/forms/types/time.rst b/reference/forms/types/time.rst index 303a9c29061..5034e14e97e 100644 --- a/reference/forms/types/time.rst +++ b/reference/forms/types/time.rst @@ -23,6 +23,7 @@ as a ``DateTime`` object, a string, a timestamp or an array. | | - `seconds`_ | | | - `data_timezone`_ | | | - `user_timezone`_ | +| | - `empty_value`_ | +----------------------+-----------------------------------------------------------------------------+ | Overridden Options | - `by_reference`_ | | | - `error_bubbling`_ | @@ -116,6 +117,8 @@ this format. .. include:: /reference/forms/types/options/user_timezone.rst.inc +.. include:: /reference/forms/types/options/empty_value.rst.inc + Overridden Options ------------------ From 3b153bf5f684f0ad7ed3dc1ec54717a42e319178 Mon Sep 17 00:00:00 2001 From: Hyunmin Kim Date: Sat, 30 Mar 2013 12:04:47 -0700 Subject: [PATCH 0335/2078] Deleted checked from options --- reference/forms/types/checkbox.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/reference/forms/types/checkbox.rst b/reference/forms/types/checkbox.rst index 00034b4da74..e72400d2684 100644 --- a/reference/forms/types/checkbox.rst +++ b/reference/forms/types/checkbox.rst @@ -12,7 +12,6 @@ if the box is unchecked, the value will be set to false. | Rendered as | ``input`` ``checkbox`` field | +-------------+------------------------------------------------------------------------+ | Options | - `value`_ | -| | - `checked`_ | +-------------+------------------------------------------------------------------------+ | Inherited | - `required`_ | | options | - `label`_ | @@ -48,12 +47,6 @@ value The value that's actually used as the value for the checkbox. This does not affect the value that's set on your object. -checked -~~~~~~~ - -**type**: ``mixed`` **default**: ``1`` - - Inherited options ----------------- From a0d6e9a1bbb3a14d6dd5529ee8f7c2690e86f51f Mon Sep 17 00:00:00 2001 From: Hyunmin Kim Date: Sat, 30 Mar 2013 12:12:04 -0700 Subject: [PATCH 0336/2078] Added more newlines at end of file. --- reference/forms/types/form.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index 9520e3d9e79..97451e3c39c 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -35,3 +35,4 @@ virtual ------- See :doc:`How to use the Virtual Form Field Option` + From 005d28a61cd1ec6ab45674470b6887743a7099e9 Mon Sep 17 00:00:00 2001 From: Hyunmin Kim Date: Sat, 30 Mar 2013 12:22:15 -0700 Subject: [PATCH 0337/2078] Deleted precision duplication from number.rst --- reference/forms/types/number.rst | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/reference/forms/types/number.rst b/reference/forms/types/number.rst index 9d40d422ce9..ce40bce055c 100644 --- a/reference/forms/types/number.rst +++ b/reference/forms/types/number.rst @@ -35,16 +35,6 @@ Field Options .. include:: /reference/forms/types/options/precision.rst.inc -precision -~~~~~~~~~ - -**type**: ``integer`` **default**: Locale-specific (usually around ``3``) - -This specifies how many decimals will be allowed until the field rounds -the submitted value (via ``rounding_mode``). For example, if ``precision`` -is set to ``2``, a submitted value of ``20.123`` will be rounded to, -for example, ``20.12`` (depending on your ``rounding_mode``). - rounding_mode ~~~~~~~~~~~~~ From 7b4625b600d91afeadfaf1126a86a0a5c3af12e3 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 11:48:27 -0500 Subject: [PATCH 0338/2078] [#2427] Fixing syntax error --- reference/forms/types/datetime.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst index d034ad46389..25528d5d886 100644 --- a/reference/forms/types/datetime.rst +++ b/reference/forms/types/datetime.rst @@ -28,7 +28,7 @@ data can be a ``DateTime`` object, a string, a timestamp or an array. | | - `with_seconds`_ | | | - `data_timezone`_ | | | - `user_timezone`_ | -| | - `empty_value`_ | +| | - `empty_value`_ | +----------------------+-----------------------------------------------------------------------------+ | Inherited | - `invalid_message`_ | | options | - `invalid_message_parameters`_ | From c363f66b0d8570b22fdcac0a64d5c700f4212405 Mon Sep 17 00:00:00 2001 From: Richard Miller Date: Mon, 22 Apr 2013 16:33:06 +0100 Subject: [PATCH 0339/2078] Adding to the controllers as services cookbook --- cookbook/controller/service.rst | 266 ++++++++++++++++++++++++++++---- 1 file changed, 232 insertions(+), 34 deletions(-) diff --git a/cookbook/controller/service.rst b/cookbook/controller/service.rst index 8466bc802ab..4670a1e6de9 100644 --- a/cookbook/controller/service.rst +++ b/cookbook/controller/service.rst @@ -9,25 +9,138 @@ extends the base :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller` class. While this works fine, controllers can also be specified as services. +.. note:: + + Specifying a controller as a service takes a little bit more work. The + primary advantage is that the entire controller or any services passed to + the controller can be modified via the service container configuration. + This is especially useful when developing an open-source bundle or any + bundle that will be used in many different projects. So, even if you don't + specify your controllers as services, you'll likely see this done in some + open-source Symfony2 bundles. + +Defining the Controller as a Service +------------------------------------ + +A controller can be defined as a service in the same way as any other class. +For example, if you have the following simple controller:: + + // src/Acme/HelloBundle/Controller/HelloController.php + namespace Acme\HelloBundle\Controller; + + use Symfony\Component\HttpFoundation\Response; + + class HelloController + { + public function indexAction($name) + { + return new Response('Hello '.$name.'!'); + } + } + +Then you can define it as a service as follows: + +.. configuration-block:: + + .. code-block:: yaml + + # src/Acme/HelloBundle/Resources/config/services.yml + parameters: + # ... + acme.controller.hello.class: Acme\HelloBundle\Controller\HelloController + + services: + acme.hello.controller: + class: "%acme.controller.hello.class%" + + .. code-block:: xml + + + + + Acme\HelloBundle\Controller\HelloController + + + + + + + .. code-block:: php + + // src/Acme/HelloBundle/Resources/config/services.php + use Symfony\Component\DependencyInjection\Definition; + + // ... + $container->setParameter( + 'acme.controller.hello.class', + 'Acme\HelloBundle\Controller\HelloController' + ); + + $container->setDefinition('acme.hello.controller', new Definition( + '%acme.controller.hello.class%' + )); + +Referring to the service +------------------------ + To refer to a controller that's defined as a service, use the single colon (:) -notation. For example, suppose you've defined a service called -``my_controller`` and you want to forward to a method called ``indexAction()`` -inside the service:: +notation. For example, to forward to the ``indexAction()`` method of the service +defined above with the id ``acme.hello.controller``:: + + $this->forward('acme.hello.controller:indexAction'); + +.. note:: - $this->forward('my_controller:indexAction', array('foo' => $bar)); + You cannot drop the ``Action`` part of the method name when using this + syntax. -You need to use the same notation when defining the route ``_controller`` -value: +You can also route to the service by using the same notation when defining +the route ``_controller`` value: -.. code-block:: yaml +.. configuration-block:: - my_controller: - path: / - defaults: { _controller: my_controller:indexAction } + .. code-block:: yaml -To use a controller in this way, it must be defined in the service container -configuration. For more information, see the :doc:`Service Container -` chapter. + # app/config/routing.yml + hello: + pattern: /hello + defaults: { _controller: acme.hello.controller:indexAction } + + .. code-block:: xml + + + + acme.hello.controller:indexAction + + + .. code-block:: php + + // app/config/routing.php + $collection->add('hello', new Route('/hello', array( + '_controller' => 'acme.hello.controller:indexAction', + ))); + +Using Annotation Routing +~~~~~~~~~~~~~~~~~~~~~~~~ + +When using annotations to configure routing using a controller defined as a +service, you need to specify the service id as follows:: + + use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; + + /** + * @Route("/hello", service="acme.hello.controller") + */ + class HelloController extends Controller + { + // ... + } + +This is documented in the :doc:`/bundles/SensioFrameworkExtraBundle/annotations/routing` +chapter. + +Alternatives to Base Controller Methods +--------------------------------------- When using a controller defined as a service, it will most likely not extend the base ``Controller`` class. Instead of relying on its shortcut methods, @@ -35,31 +148,116 @@ you'll interact directly with the services that you need. Fortunately, this is usually pretty easy and the base ``Controller`` class itself is a great source on how to perform many common tasks. -.. note:: +For example, if you want to use templates instead of creating the ``Response`` +object directly then if you were extending from the base controller you could +use:: - Specifying a controller as a service takes a little bit more work. The - primary advantage is that the entire controller or any services passed to - the controller can be modified via the service container configuration. - This is especially useful when developing an open-source bundle or any - bundle that will be used in many different projects. So, even if you don't - specify your controllers as services, you'll likely see this done in some - open-source Symfony2 bundles. + // src/Acme/HelloBundle/Controller/HelloController.php + namespace Acme\HelloBundle\Controller; -Using Annotation Routing ------------------------- + use Symfony\Bundle\FrameworkBundle\Controller\Controller; + use Symfony\Component\HttpFoundation\Response; -When using annotations to setup routing when using a controller defined as a -service, you need to specify your service as follows:: + class HelloController extends Controller + { + public function indexAction($name) + { + return $this->render( + 'AcmeHelloBundle:Hello:index.html.twig', + array('name' => $name) + ); + } + } - /** - * @Route("/blog", service="my_bundle.annot_controller") - * @Cache(expires="tomorrow") - */ - class AnnotController extends Controller +This method actually uses the ``templating`` service:: + + public function render($view, array $parameters = array(), Response $response = null) { + return $this->container->get('templating')->renderResponse($view, $parameters, $response); } -In this example, ``my_bundle.annot_controller`` should be the id of the -``AnnotController`` instance defined in the service container. This is -documented in the :doc:`/bundles/SensioFrameworkExtraBundle/annotations/routing` -chapter. +So in our controller as a service we can instead inject the ``templating`` +service and use it directly:: + + // src/Acme/HelloBundle/Controller/HelloController.php + namespace Acme\HelloBundle\Controller; + + use Symfony\Component\HttpFoundation\Response; + + class HelloController + { + private $templating; + + public function __construct($templating) + { + $this->templating = $templating; + } + + public function indexAction($name) + { + return $this->templating->renderResponse( + 'AcmeHelloBundle:Hello:index.html.twig', + array('name' => $name) + ); + } + } + +The service definition also needs modifying to specify the constructor +argument: + +.. configuration-block:: + + .. code-block:: yaml + + # src/Acme/HelloBundle/Resources/config/services.yml + parameters: + # ... + acme.controller.hello.class: Acme\HelloBundle\Controller\HelloController + + services: + acme.hello.controller: + class: "%acme.controller.hello.class%" + arguments: ["@templating"] + + .. code-block:: xml + + + + + Acme\HelloBundle\Controller\HelloController + + + + + + + + + .. code-block:: php + + // src/Acme/HelloBundle/Resources/config/services.php + use Symfony\Component\DependencyInjection\Definition; + use Symfony\Component\DependencyInjection\Reference; + + // ... + $container->setParameter( + 'acme.controller.hello.class', + 'Acme\HelloBundle\Controller\HelloController' + ); + + $container->setDefinition('acme.hello.controller', new Definition( + '%acme.controller.hello.class%', + array(new Reference('templating')) + )); + +Rather than fetching the ``templating`` service from the container just the +service required is being directly injected into the controller. + +.. note:: + + This does not mean that you cannot extend these controllers from a base + controller. The move away from the standard base controller is because + its helper method rely on having the container available which is not + the case for controllers defined as services. However, it is worth considering + extracting common code into a service to be injected in rather than a parent + class. From f63583868cbe1c38f6eaf9f1e66e8faa9058c7fc Mon Sep 17 00:00:00 2001 From: Richard Miller Date: Tue, 23 Apr 2013 09:45:19 +0100 Subject: [PATCH 0340/2078] Changing controllers as services with annotations ot a tip --- cookbook/controller/service.rst | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/cookbook/controller/service.rst b/cookbook/controller/service.rst index 4670a1e6de9..03ae0aa1a6a 100644 --- a/cookbook/controller/service.rst +++ b/cookbook/controller/service.rst @@ -120,24 +120,12 @@ the route ``_controller`` value: '_controller' => 'acme.hello.controller:indexAction', ))); -Using Annotation Routing -~~~~~~~~~~~~~~~~~~~~~~~~ +.. tip:: -When using annotations to configure routing using a controller defined as a -service, you need to specify the service id as follows:: - - use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; - - /** - * @Route("/hello", service="acme.hello.controller") - */ - class HelloController extends Controller - { - // ... - } - -This is documented in the :doc:`/bundles/SensioFrameworkExtraBundle/annotations/routing` -chapter. + You can also use annotations to configure routing using a controller + defined as a service. See the + :doc:`FrameworkExtraBundle documentation` + for details. Alternatives to Base Controller Methods --------------------------------------- @@ -224,7 +212,9 @@ argument: - Acme\HelloBundle\Controller\HelloController + Acme\HelloBundle\Controller\HelloController From 6442cf1bbe38247ada11a231e204624926b91b96 Mon Sep 17 00:00:00 2001 From: Sylvain Lorinet Date: Wed, 5 Jun 2013 12:58:19 +0300 Subject: [PATCH 0341/2078] Missing constant colon --- components/process.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/process.rst b/components/process.rst index b0a2b2544dc..b84f1882f45 100644 --- a/components/process.rst +++ b/components/process.rst @@ -95,7 +95,7 @@ are done doing other stuff:: // ... do other things $process->wait(function ($type, $buffer) { - if (Process:ERR === $type) { + if (Process::ERR === $type) { echo 'ERR > '.$buffer; } else { echo 'OUT > '.$buffer; From 278842f70bd7778ce09f81e205b723801f6594c4 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 12:44:31 -0500 Subject: [PATCH 0342/2078] [#2538] Proofreading and minor tweaks to updates to controllers as services --- cookbook/controller/service.rst | 36 +++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/cookbook/controller/service.rst b/cookbook/controller/service.rst index 03ae0aa1a6a..9c20f98cbc4 100644 --- a/cookbook/controller/service.rst +++ b/cookbook/controller/service.rst @@ -133,18 +133,17 @@ Alternatives to Base Controller Methods When using a controller defined as a service, it will most likely not extend the base ``Controller`` class. Instead of relying on its shortcut methods, you'll interact directly with the services that you need. Fortunately, this is -usually pretty easy and the base ``Controller`` class itself is a great source -on how to perform many common tasks. +usually pretty easy and the base `Controller class source code`_ is a great +source on how to perform many common tasks. -For example, if you want to use templates instead of creating the ``Response`` -object directly then if you were extending from the base controller you could -use:: +For example, if you want to render a template instead of creating the ``Response`` +object directly, then your code would look like this if you were extending +Symfony's base controller:: // src/Acme/HelloBundle/Controller/HelloController.php namespace Acme\HelloBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; - use Symfony\Component\HttpFoundation\Response; class HelloController extends Controller { @@ -157,14 +156,16 @@ use:: } } -This method actually uses the ``templating`` service:: +If you look at the source code for the ``render`` function in Symfony's +`base Controller class`_, you'll see that this method actually uses the +``templating`` service:: public function render($view, array $parameters = array(), Response $response = null) { return $this->container->get('templating')->renderResponse($view, $parameters, $response); } -So in our controller as a service we can instead inject the ``templating`` +In a controller that's defined as a service, you can instead inject the ``templating`` service and use it directly:: // src/Acme/HelloBundle/Controller/HelloController.php @@ -240,14 +241,19 @@ argument: array(new Reference('templating')) )); -Rather than fetching the ``templating`` service from the container just the -service required is being directly injected into the controller. +Rather than fetching the ``templating`` service from the container, you can +inject *only* the exact service(s) that you need directly into the controller. .. note:: - This does not mean that you cannot extend these controllers from a base - controller. The move away from the standard base controller is because + This does not mean that you cannot extend these controllers from your own + base controller. The move away from the standard base controller is because its helper method rely on having the container available which is not - the case for controllers defined as services. However, it is worth considering - extracting common code into a service to be injected in rather than a parent - class. + the case for controllers that are defined as services. It may be a good + idea to extract common code into a service that's injected rather than + place that code into a base controller that you extend. Both approaches + are valid, exactly how you want to organize your reusable code is up to + you. + +.. _`Controller class source code`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php +.. _`base Controller class`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php \ No newline at end of file From 1a79eddc6788ee35c3bdddbfa0de0c492b300a93 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 12:49:28 -0500 Subject: [PATCH 0343/2078] [#2538][#2433] Adding a note to the service container chapter about how a controller can be defined as a service --- book/service_container.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/book/service_container.rst b/book/service_container.rst index 1de05025ee0..2b63bd2d66a 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -172,6 +172,15 @@ the behavior you'll need (it's more flexible and powerful), but you'll learn later how you can configure a service that has multiple instances in the ":doc:`/cookbook/service_container/scopes`" cookbook article. +.. note:: + + In this example, the controller extends Symfony's base Controller, which + gives you access to the service container itself. You can then use the + ``get`` method to locate and retrieve the ``my_mailer`` service from + the service container. You can also define your :doc:`controllers as services`. + This is a bit more advanced and not necessary, but it allows you to inject + only the services you need into your controller. + .. _book-service-container-parameters: Service Parameters From 1fbd278b772f2415b7ec44b04903b7a5845998ca Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 12:54:25 -0500 Subject: [PATCH 0344/2078] [#2433][#457] Adding more emphasis to the note about controllers as services in the controllers chapter --- book/controller.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/book/controller.rst b/book/controller.rst index 1eac0bd0640..21130224c4f 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -384,6 +384,8 @@ itself. .. note:: You can also define your :doc:`Controllers as Services`. + This is optional, but can give you more control over the exact dependencies + that are injected into your controllers. .. index:: single: Controller; Common tasks From 42f80e0b5f59274e0cb2c62814768ebe68a7bd0a Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 12:54:59 -0500 Subject: [PATCH 0345/2078] [#2538] Enhancing advantages of a controller as a service --- cookbook/controller/service.rst | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cookbook/controller/service.rst b/cookbook/controller/service.rst index 9c20f98cbc4..69f6bf19c49 100644 --- a/cookbook/controller/service.rst +++ b/cookbook/controller/service.rst @@ -15,9 +15,18 @@ this works fine, controllers can also be specified as services. primary advantage is that the entire controller or any services passed to the controller can be modified via the service container configuration. This is especially useful when developing an open-source bundle or any - bundle that will be used in many different projects. So, even if you don't - specify your controllers as services, you'll likely see this done in some - open-source Symfony2 bundles. + bundle that will be used in many different projects. + + A second advantage is that your controllers are more "sandboxed". By + looking at the constructor arguments, it's easy to see what types of things + this controller may or may not do. And because each dependency needs + to be injected manually, it's more obvious (i.e. if you have many constructor + arguments) when your controller has become too big, and may need to be + split into multiple controllers. + + So, even if you don't specify your controllers as services, you'll likely + see this done in some open-source Symfony2 bundles. It's also important + to understand the pros and cons of both approaches. Defining the Controller as a Service ------------------------------------ From ed0920eb5e9190c476616c007f97292489d8cc22 Mon Sep 17 00:00:00 2001 From: Julien Chaumond Date: Tue, 14 May 2013 15:52:47 +0300 Subject: [PATCH 0346/2078] each() iterates over items as Crawlers --- components/dom_crawler.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index f16509f6690..b30a3ace0b5 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -141,7 +141,7 @@ Call an anonymous function on each node of the list:: return $node->text(); }); -The anonymous function receives the position and the node as arguments. +The anonymous function receives the position and the node (as a Crawler) as arguments. The result is an array of values returned by the anonymous function calls. Adding the Content From a15a9d53c0de2baed22980fc246306516c91dcdd Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 13:32:28 -0500 Subject: [PATCH 0347/2078] [#2638] Adding versionadded and type-hints to make Closure argument even more obvious --- components/dom_crawler.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index b30a3ace0b5..d9fef3926b5 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -70,7 +70,10 @@ This allows you to use jQuery-like selectors to traverse:: Anonymous function can be used to filter with more complex criteria:: - $crawler = $crawler->filter('body > p')->reduce(function ($node, $i) { + use Symfony\Component\DomCrawler\Crawler; + // ... + + $crawler = $crawler->filter('body > p')->reduce(function (Crawler $node, $i) { // filter even nodes return ($i % 2) == 0; }); @@ -137,10 +140,18 @@ Extract attribute and/or node values from the list of nodes:: Call an anonymous function on each node of the list:: - $nodeValues = $crawler->filter('p')->each(function ($node, $i) { + use Symfony\Component\DomCrawler\Crawler; + // ... + + $nodeValues = $crawler->filter('p')->each(function (Crawler $node, $i) { return $node->text(); }); +.. versionadded:: + As seen here, in Symfony 2.3, the ``each`` and ``reduce`` Closure functions + are passed a ``Crawler`` as the first argument. Previously, that argument + was a :phpclass:`DOMNode`. + The anonymous function receives the position and the node (as a Crawler) as arguments. The result is an array of values returned by the anonymous function calls. From 6ec09bc554faa86b293826f970f173235186404e Mon Sep 17 00:00:00 2001 From: flip111 Date: Tue, 21 May 2013 20:19:48 +0300 Subject: [PATCH 0348/2078] Update dom_crawler.rst --- components/dom_crawler.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index 29a08890129..436b69724c8 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -10,7 +10,10 @@ The DomCrawler Component .. note:: While possible, the DomCrawler component is not designed for manipulation - of the DOM or re-dumping HTML/XML. + of the DOM or re-dumping HTML/XML. However the DomCrawler will attempt to + automatically fix your HTML to match the official specification. Take note + about this behaviour as you could be working with a different DOM after it + has been parsed with the DomCrawler. Installation ------------ From 29c5f84534fb87aab34592e9cbc13eead5cdd100 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 13:44:31 -0500 Subject: [PATCH 0349/2078] [#2651] Moving and expanding on note --- components/dom_crawler.rst | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index 436b69724c8..75b93e5a854 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -10,10 +10,7 @@ The DomCrawler Component .. note:: While possible, the DomCrawler component is not designed for manipulation - of the DOM or re-dumping HTML/XML. However the DomCrawler will attempt to - automatically fix your HTML to match the official specification. Take note - about this behaviour as you could be working with a different DOM after it - has been parsed with the DomCrawler. + of the DOM or re-dumping HTML/XML. Installation ------------ @@ -55,6 +52,16 @@ Specialized :class:`Symfony\\Component\\DomCrawler\\Link` and :class:`Symfony\\Component\\DomCrawler\\Form` classes are useful for interacting with html links and forms as you traverse through the HTML tree. +.. note:: + + The DomCrawler will attempt to automatically fix your HTML to match the + official specification. For example, if you nest a ``

`` tag inside + another ``

`` tag, it will be moved to be a sibling of the parent tag. + This is expected and is part of the HTML5 spec. But if you're getting + unexpected behavior, this could be a cause. And while the ``DomCrawler`` + isn't meant to dump content, you can see the "fixed" version if your HTML + by :ref:`dumping it`. + Node Filtering ~~~~~~~~~~~~~~ @@ -187,6 +194,8 @@ and :phpclass:`DOMNode` objects: $crawler->addNode($node); $crawler->add($document); +.. component-dom-crawler-dumping: + .. sidebar:: Manipulating and Dumping a ``Crawler`` These methods on the ``Crawler`` are intended to initially populate your From 0da5e3619024aed7954e3ad68b33d6e70eba5f40 Mon Sep 17 00:00:00 2001 From: Markus Weiland Date: Sat, 25 May 2013 22:29:59 -0300 Subject: [PATCH 0350/2078] XML callback definition needs to define an array to work --- reference/constraints/Callback.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reference/constraints/Callback.rst b/reference/constraints/Callback.rst index 93539cb7eb2..ac44a15a699 100644 --- a/reference/constraints/Callback.rst +++ b/reference/constraints/Callback.rst @@ -162,8 +162,10 @@ process. Each method can be one of the following formats: From e55f0f72a146743a28e78545db0f30fef46b7c87 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 14:22:01 -0500 Subject: [PATCH 0351/2078] [#2669] Proofreading and minor fixes for updates to mapping mode classes 1) Fixed missed second argument to the `createXmlMappingDriver` methods 2) Clarified the final note about the SymfonyFileLocator 3) Other minor changes --- cookbook/doctrine/mapping_model_classes.rst | 32 ++++++++++++++------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/cookbook/doctrine/mapping_model_classes.rst b/cookbook/doctrine/mapping_model_classes.rst index 0b13eac7500..f72b6939e38 100644 --- a/cookbook/doctrine/mapping_model_classes.rst +++ b/cookbook/doctrine/mapping_model_classes.rst @@ -17,7 +17,6 @@ register the mappings for your model classes. just to get the auto mapping, use the compiler pass. .. versionadded:: 2.3 - The base mapping compiler pass was added in Symfony 2.3. The Doctrine bundles support it from DoctrineBundle >= 1.2.1, MongoDBBundle >= 3.0.0, PHPCRBundle >= 1.0.0-alpha2 and the (unversioned) CouchDBBundle supports the @@ -30,7 +29,9 @@ register the mappings for your model classes. ``addRegisterMappingsPass``. -In your bundle class, write the following code to register the compiler pass:: +In your bundle class, write the following code to register the compiler pass. +This one is written for the ``FOSUserBundle``, so parts of it will need to +be adapted for your case:: use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass; use Doctrine\Bundle\MongoDBBundle\DependencyInjection\Compiler\DoctrineMongoDBMappingsPass; @@ -54,6 +55,7 @@ In your bundle class, write the following code to register the compiler pass:: $container->addCompilerPass( DoctrineOrmMappingsPass::createXmlMappingDriver( $mappings, + array('fos_user.model_manager_name'), 'fos_user.backend_type_orm' )); } @@ -63,6 +65,7 @@ In your bundle class, write the following code to register the compiler pass:: $container->addCompilerPass( DoctrineMongoDBMappingsPass::createXmlMappingDriver( $mappings, + array('fos_user.model_manager_name'), 'fos_user.backend_type_mongodb' )); } @@ -72,6 +75,7 @@ In your bundle class, write the following code to register the compiler pass:: $container->addCompilerPass( DoctrineCouchDBMappingsPass::createXmlMappingDriver( $mappings, + array('fos_user.model_manager_name'), 'fos_user.backend_type_couchdb' )); } @@ -81,6 +85,7 @@ In your bundle class, write the following code to register the compiler pass:: $container->addCompilerPass( DoctrinePhpcrMappingsPass::createXmlMappingDriver( $mappings, + array('fos_user.model_manager_name'), 'fos_user.backend_type_phpcr' )); } @@ -94,12 +99,13 @@ decide which to use. The compiler pass provides factory methods for all drivers provided by Doctrine: Annotations, XML, Yaml, PHP and StaticPHP. The arguments are: -* a map of absolute directory path to namespace; +* a map/hash of absolute directory path to namespace; * an array of container parameters that your bundle uses to specify the name of - the Doctrine manager that it is using. The compiler pass will append the - parameter Doctrine is using to specify the name of the default manager. The - first parameter found is used and the mappings are registered with that - manager; + the Doctrine manager that it is using. In the above example, the FOSUserBundle + stores the manager name that's being used under the ``fos_user.model_manager_name`` + parameter. The compiler pass will append the parameter Doctrine is using + to specify the name of the default manager. The first parameter found is + used and the mappings are registered with that manager; * an optional container parameter name that will be used by the compiler pass to determine if this Doctrine type is used at all (this is relevant if your user has more than one type of Doctrine bundle installed, but your @@ -109,8 +115,14 @@ Annotations, XML, Yaml, PHP and StaticPHP. The arguments are: The factory method is using the ``SymfonyFileLocator`` of Doctrine, meaning it will only see XML and YML mapping files if they do not contain the - namespace. If you also need to map a base class, you can register a - compiler pass with the ``DefaultFileLocator`` like this:: + full namespace as the filename. This is by design: the ``SymfonyFileLocator`` + simplifies things by assuming the files are just the "short" version + of the class as their filename (e.g. ``BlogPost.orm.xml``) + + If you also need to map a base class, you can register a compiler pass + with the ``DefaultFileLocator`` like this. This code is simply taken from the + ``DoctrineOrmMappingsPass`` and adapted to use the ``DefaultFileLocator`` + instead of the ``SymfonyFileLocator``:: private function buildMappingCompilerPass() { @@ -126,7 +138,7 @@ Annotations, XML, Yaml, PHP and StaticPHP. The arguments are: ); } - And place your mapping file into ``/Resources/config/doctrine-base`` with the + Now place your mapping file into ``/Resources/config/doctrine-base`` with the fully qualified class name, separated by ``.`` instead of ``\``, for example ``Other.Namespace.Model.Name.orm.xml``. You may not mix the two as otherwise the SymfonyFileLocator will get confused. From e3147da2b8db7c5caa55e7923b628b079726d5e9 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 14:51:51 -0500 Subject: [PATCH 0352/2078] [#2675] Updating chnages to the registration chapter 1) Added XML and PHP routing 2) Removed database creation step and re-worded items --- cookbook/doctrine/registration_form.rst | 64 +++++++++++++++++++------ 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/cookbook/doctrine/registration_form.rst b/cookbook/doctrine/registration_form.rst index 04cb7f2fa4d..9e98cea4b87 100644 --- a/cookbook/doctrine/registration_form.rst +++ b/cookbook/doctrine/registration_form.rst @@ -284,27 +284,63 @@ the validation and saves the data into the database:: Add New Routes -------------- -Next, update your routes +Next, update your routes. If you're placing your routes inside your bundle +(as shown here), don't forget to make sure that the routing file is being +:ref:`imported`. -.. code-block:: yml +.. configuration-block:: - register: - pattern: /register - defaults: { _controller: AcmeAccountBundle:Account:register } + .. code-block:: yml + + # src/Acme/AccountBundle/Resources/config/routing.yml + account_register: + pattern: /register + defaults: { _controller: AcmeAccountBundle:Account:register } - create: - pattern: /create - defaults: { _controller: AcmeAccountBundle:Account:create } + account_create: + pattern: /register/create + defaults: { _controller: AcmeAccountBundle:Account:create } -Run Doctrine Commands ---------------------- + .. code-block:: xml + + + + + + + AcmeAccountBundle:Account:register + + + + AcmeAccountBundle:Account:create + + -Finally, generate your entities and schema + .. code-block:: php + + // src/Acme/AccountBundle/Resources/config/routing.php + use Symfony\Component\Routing\RouteCollection; + use Symfony\Component\Routing\Route; + + $collection = new RouteCollection(); + $collection->add('account_register', new Route('/register', array( + '_controller' => 'AcmeAccountBundle:Account:register', + ))); + $collection->add('account_create', new Route('/register/create', array( + '_controller' => 'AcmeAccountBundle:Account:create', + ))); + + return $collection; + +Update your Database Schema +--------------------------- -.. code-block:: +Of course, since you've added a ``User`` entity during this tutorial, make +sure that your database schema has been updated properly: - php app/console doctrine:database:create - php app/console doctrine:schema:update --force + $ php app/console doctrine:schema:update --force That's it! Your form now validates, and allows you to save the ``User`` object to the database. The extra ``terms`` checkbox on the ``Registration`` From 57f7e9843c8eaf3a3de7043db968c3e4d1c31b30 Mon Sep 17 00:00:00 2001 From: ragtek Date: Tue, 4 Jun 2013 23:13:49 +0200 Subject: [PATCH 0353/2078] corrected console exception event classname --- components/console/events.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/console/events.rst b/components/console/events.rst index 661e2586038..3fe9c34c48a 100644 --- a/components/console/events.rst +++ b/components/console/events.rst @@ -98,12 +98,12 @@ event is dispatched. A listener can wrap or change the exception or do anything useful before the exception is thrown by the application. Listeners receive a -:class:`Symfony\\Component\\Console\\Event\\ConsoleForExceptionEvent` event:: +:class:`Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent` event:: - use Symfony\Component\Console\Event\ConsoleForExceptionEvent; + use Symfony\Component\Console\Event\ConsoleExceptionEvent; use Symfony\Component\Console\ConsoleEvents; - $dispatcher->addListener(ConsoleEvents::EXCEPTION, function (ConsoleForExceptionEvent $event) { + $dispatcher->addListener(ConsoleEvents::EXCEPTION, function (ConsoleExceptionEvent $event) { $output = $event->getOutput(); $command = $event->getCommand(); From a48c6ab3c4f4436bdb96d228350c652e6bf294bf Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 15:57:04 -0500 Subject: [PATCH 0354/2078] [#2701] Updating a few more references to the an old property name --- reference/forms/types/birthday.rst | 8 ++++---- reference/forms/types/options/model_timezone.rst.inc | 2 +- reference/forms/types/time.rst | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/reference/forms/types/birthday.rst b/reference/forms/types/birthday.rst index 0d05e757a42..8b8d565c19d 100644 --- a/reference/forms/types/birthday.rst +++ b/reference/forms/types/birthday.rst @@ -27,8 +27,8 @@ option defaults to 120 years ago to the current year. | | - `months`_ | | | - `days`_ | | | - `format`_ | -| | - `data_timezone`_ | -| | - `user_timezone`_ | +| | - `model_timezone`_ | +| | - `view_timezone`_ | | | - `invalid_message`_ | | | - `invalid_message_parameters`_ | | | - `read_only`_ | @@ -67,9 +67,9 @@ These options inherit from the :doc:`date` type: .. include:: /reference/forms/types/options/date_format.rst.inc -.. include:: /reference/forms/types/options/data_timezone.rst.inc +.. include:: /reference/forms/types/options/model_timezone.rst.inc -.. include:: /reference/forms/types/options/user_timezone.rst.inc +.. include:: /reference/forms/types/options/view_timezone.rst.inc These options inherit from the :doc:`date` type: diff --git a/reference/forms/types/options/model_timezone.rst.inc b/reference/forms/types/options/model_timezone.rst.inc index 3650ea9b21f..8ac7beac743 100644 --- a/reference/forms/types/options/model_timezone.rst.inc +++ b/reference/forms/types/options/model_timezone.rst.inc @@ -1,5 +1,5 @@ model_timezone -~~~~~~~~~~~~~ +~~~~~~~~~~~~~~ **type**: ``string`` **default**: system default timezone diff --git a/reference/forms/types/time.rst b/reference/forms/types/time.rst index 3ac01789c47..ebb35fc8670 100644 --- a/reference/forms/types/time.rst +++ b/reference/forms/types/time.rst @@ -21,8 +21,8 @@ as a ``DateTime`` object, a string, a timestamp or an array. | | - `hours`_ | | | - `minutes`_ | | | - `seconds`_ | -| | - `data_timezone`_ | -| | - `user_timezone`_ | +| | - `model_timezone`_ | +| | - `view_timezone`_ | | | - `empty_value`_ | +----------------------+-----------------------------------------------------------------------------+ | Overridden Options | - `by_reference`_ | @@ -114,9 +114,9 @@ this format. .. include:: /reference/forms/types/options/seconds.rst.inc -.. include:: /reference/forms/types/options/data_timezone.rst.inc +.. include:: /reference/forms/types/options/model_timezone.rst.inc -.. include:: /reference/forms/types/options/user_timezone.rst.inc +.. include:: /reference/forms/types/options/view_timezone.rst.inc .. include:: /reference/forms/types/options/empty_value.rst.inc From 3842f599eb277e387c820816c91a099d6be50df2 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 16:01:51 -0500 Subject: [PATCH 0355/2078] [#2704] Minor syntax error for new currency form type --- reference/forms/types/currency.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/forms/types/currency.rst b/reference/forms/types/currency.rst index d3564fc4a85..d921ce09a1b 100644 --- a/reference/forms/types/currency.rst +++ b/reference/forms/types/currency.rst @@ -5,7 +5,7 @@ currency Field Type =================== The ``currency`` type is a subset of the -:doc:`choice type ` that allows the user to select from a large list of `3-letter ISO 4217`_ currencies. Unlike the ``choice`` type, you don't need to specify a ``choices`` or From b84559133e5daf2caa609e1f7a633a8c42e271e7 Mon Sep 17 00:00:00 2001 From: James Mallison Date: Fri, 7 Jun 2013 17:48:48 +0200 Subject: [PATCH 0356/2078] Updated XSSI Json Hijacking Caution Only methods that respond to GET requests are vulnerable to XSSI 'JSON Hijacking'. POST requests remain unaffected. --- components/http_foundation/introduction.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 5e7e2fc6054..5b97f686ab9 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -496,7 +496,10 @@ to ``application/json``. as the outer-most array to ``JsonResponse`` and not an indexed array so that the final result is an object (e.g. ``{"object": "not inside an array"}``) instead of an array (e.g. ``[{"object": "inside an array"}]``). Read - the `OWASP guidelines`_ for more information. + the `OWASP guidelines`_ for more information. + + Only methods that respond to GET requests are vulnerable to XSSI 'JSON Hijacking'. + Methods responding to POST requests only remain unaffected. JSONP Callback ~~~~~~~~~~~~~~ From f8ace43cdee888c8856c9225f702561845a2e746 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 16:35:17 -0500 Subject: [PATCH 0357/2078] [#2710] Fixing whitespace --- components/http_foundation/introduction.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 5b97f686ab9..3ed22644292 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -496,9 +496,9 @@ to ``application/json``. as the outer-most array to ``JsonResponse`` and not an indexed array so that the final result is an object (e.g. ``{"object": "not inside an array"}``) instead of an array (e.g. ``[{"object": "inside an array"}]``). Read - the `OWASP guidelines`_ for more information. - - Only methods that respond to GET requests are vulnerable to XSSI 'JSON Hijacking'. + the `OWASP guidelines`_ for more information. + + Only methods that respond to GET requests are vulnerable to XSSI 'JSON Hijacking'. Methods responding to POST requests only remain unaffected. JSONP Callback From e9d2df62870b6d794e6057188bc338a971508e8b Mon Sep 17 00:00:00 2001 From: James Mallison Date: Fri, 7 Jun 2013 17:48:48 +0200 Subject: [PATCH 0358/2078] Back-porting change from 2.3 (should have been patched into 2.2 originally) Updated XSSI Json Hijacking Caution Only methods that respond to GET requests are vulnerable to XSSI 'JSON Hijacking'. POST requests remain unaffected. (cherry picked from commit b84559133e5daf2caa609e1f7a633a8c42e271e7) --- components/http_foundation/introduction.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index f39de2382aa..da80bd3c85b 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -506,7 +506,10 @@ to ``application/json``. as the outer-most array to ``JsonResponse`` and not an indexed array so that the final result is an object (e.g. ``{"object": "not inside an array"}``) instead of an array (e.g. ``[{"object": "inside an array"}]``). Read - the `OWASP guidelines`_ for more information. + the `OWASP guidelines`_ for more information. + + Only methods that respond to GET requests are vulnerable to XSSI 'JSON Hijacking'. + Methods responding to POST requests only remain unaffected. JSONP Callback ~~~~~~~~~~~~~~ From 4447f1d8ed2199cf6628116642778f5f07c4cc02 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 16:35:17 -0500 Subject: [PATCH 0359/2078] Back-porting change from 2.3 (should have been patched into 2.2 originally) [#2710] Fixing whitespace (cherry picked from commit f8ace43cdee888c8856c9225f702561845a2e746) --- components/http_foundation/introduction.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index da80bd3c85b..10a1f7cd65f 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -506,9 +506,9 @@ to ``application/json``. as the outer-most array to ``JsonResponse`` and not an indexed array so that the final result is an object (e.g. ``{"object": "not inside an array"}``) instead of an array (e.g. ``[{"object": "inside an array"}]``). Read - the `OWASP guidelines`_ for more information. - - Only methods that respond to GET requests are vulnerable to XSSI 'JSON Hijacking'. + the `OWASP guidelines`_ for more information. + + Only methods that respond to GET requests are vulnerable to XSSI 'JSON Hijacking'. Methods responding to POST requests only remain unaffected. JSONP Callback From 4be99ed569f5d60ac5d80a624bde7b44efdd6ed8 Mon Sep 17 00:00:00 2001 From: rodnaph Date: Mon, 10 Jun 2013 10:57:36 +0200 Subject: [PATCH 0360/2078] fixed typo --- cookbook/form/data_transformers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/data_transformers.rst b/cookbook/form/data_transformers.rst index fa72d1df22a..cd269155f47 100644 --- a/cookbook/form/data_transformers.rst +++ b/cookbook/form/data_transformers.rst @@ -183,7 +183,7 @@ Model and View Transformers became ``addViewTransformer``. In the above example, the transformer was used as a "model" transformer. -In fact, there are two different type of transformers and three different +In fact, there are two different types of transformers and three different types of underlying data. .. image:: /images/cookbook/form/DataTransformersTypes.png From ba4a5a87b7c53ffb83cc20afce74100bc5fdf13c Mon Sep 17 00:00:00 2001 From: Vincent Terraillon Date: Tue, 11 Jun 2013 09:38:22 +0200 Subject: [PATCH 0361/2078] Update monolog.rst 'channels' key was specified twice in default options, removed one. --- reference/configuration/monolog.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/reference/configuration/monolog.rst b/reference/configuration/monolog.rst index 266b4e56a8f..69cb053dca3 100644 --- a/reference/configuration/monolog.rst +++ b/reference/configuration/monolog.rst @@ -55,9 +55,6 @@ Monolog Configuration Reference email_prototype: id: ~ # Required (when the email_prototype is used) method: ~ - channels: - type: ~ - elements: [] formatter: ~ .. code-block:: xml From 038da9082b2e45d6e98d807cacc5c5e20990ad98 Mon Sep 17 00:00:00 2001 From: Patrik Patie Gmitter Date: Wed, 12 Jun 2013 01:02:22 +0200 Subject: [PATCH 0362/2078] fixed links to API for isValid() and handleRequest() --- book/forms.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/book/forms.rst b/book/forms.rst index 7993d2d801f..f1a257115b7 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -230,7 +230,7 @@ controller:: } .. versionadded:: 2.3 - The :method:`Symfony\Component\Form\FormInterface::handleRequest` method was + The :method:`Symfony\\Component\\Form\\FormInterface::handleRequest` method was added in Symfony 2.3. Previously, the ``$request`` was passed to the ``submit`` method - a strategy which is deprecated and will be removed in Symfony 3.0. For details on that method, see :ref:`cookbook-form-submit-request`. @@ -239,26 +239,26 @@ This controller follows a common pattern for handling forms, and has three possible paths: #. When initially loading the page in a browser, the form is simply created and - rendered. :method:`Symfony\Component\Form\FormInterface::handleRequest` + rendered. :method:`Symfony\\Component\\Form\\FormInterface::handleRequest` recognizes that the form was not submitted and does nothing. - :method:`Symfony\Component\Form\FormInterface::isValid` returns ``false`` + :method:`Symfony\\Component\\Form\\FormInterface::isValid` returns ``false`` if the form was not submitted. -#. When the user submits the form, :method:`Symfony\Component\Form\FormInterface::handleRequest` +#. When the user submits the form, :method:`Symfony\\Component\\Form\\FormInterface::handleRequest` recognizes this and immediately writes the submitted data back into the ``task`` and ``dueDate`` properties of the ``$task`` object. Then this object is validated. If it is invalid (validation is covered in the next section), - :method:`Symfony\Component\Form\FormInterface::isValid` returns ``false`` + :method:`Symfony\\Component\\Form\\FormInterface::isValid` returns ``false`` again, so the form is rendered together with all validation errors; .. note:: - You can use the method :method:`Symfony\Component\Form\FormInterface::isSubmitted` + You can use the method :method:`Symfony\\Component\\Form\\FormInterface::isSubmitted` to check whether a form was submitted, regardless of whether or not the submitted data is actually valid. #. When the user submits the form with valid data, the submitted data is again - written into the form, but this time :method:`Symfony\Component\Form\FormInterface::isValid` + written into the form, but this time :method:`Symfony\\Component\\Form\\FormInterface::isValid` returns ``true``. Now you have the opportunity to perform some actions using the ``$task`` object (e.g. persisting it to the database) before redirecting the user to some other page (e.g. a "thank you" or "success" page). From 83641f81c1d9d3ddb12f77442543834a6dc8460c Mon Sep 17 00:00:00 2001 From: Ulrich Date: Thu, 13 Jun 2013 17:36:11 +0300 Subject: [PATCH 0363/2078] Update how to add custom Type New in sf2.3, update the way we have to use to add custom Type. --- cookbook/form/unit_testing.rst | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cookbook/form/unit_testing.rst b/cookbook/form/unit_testing.rst index 56703f02915..a01a1f4d5a1 100644 --- a/cookbook/form/unit_testing.rst +++ b/cookbook/form/unit_testing.rst @@ -117,21 +117,28 @@ might look like this:: To create your form correctly, you need to make the type available to the form factory in your test. The easiest way is to register it manually -before creating the parent form:: +before creating the parent form using PreloadedExtension class:: // src/Acme/TestBundle/Tests/Form/Type/TestedTypeTests.php namespace Acme\TestBundle\Tests\Form\Type; use Acme\TestBundle\Form\Type\TestedType; use Acme\TestBundle\Model\TestObject; - use Symfony\Component\Form\Tests\Extension\Core\Type\TypeTestCase; + use Symfony\Component\Form\Test\TypeTestCase; + use Symfony\Component\Form\PreloadedExtension; class TestedTypeTest extends TypeTestCase { - public function testBindValidData() + protected function getExtensions() { - $this->factory->addType(new TestChildType()); + $childType = new TestChildType(); + return array(new PreloadedExtension(array( + $childType->getName() => $childType + ), array())); + } + public function testBindValidData() + { $type = new TestedType(); $form = $this->factory->create($type); From 755065f2ccd40f69dfdef4bb6096855a7f497bf5 Mon Sep 17 00:00:00 2001 From: Ulrich Date: Thu, 13 Jun 2013 17:54:32 +0300 Subject: [PATCH 0364/2078] fix indent & coma --- cookbook/form/unit_testing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/form/unit_testing.rst b/cookbook/form/unit_testing.rst index a01a1f4d5a1..e9a5fbc362a 100644 --- a/cookbook/form/unit_testing.rst +++ b/cookbook/form/unit_testing.rst @@ -133,8 +133,8 @@ before creating the parent form using PreloadedExtension class:: { $childType = new TestChildType(); return array(new PreloadedExtension(array( - $childType->getName() => $childType - ), array())); + $childType->getName() => $childType, + ), array())); } public function testBindValidData() From 24b184beda52da674ed3fa895749630fd19cbc23 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 17:01:33 -0500 Subject: [PATCH 0365/2078] [#2725] Fixing whitespace --- cookbook/form/unit_testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/unit_testing.rst b/cookbook/form/unit_testing.rst index e9a5fbc362a..b5f3fbb65cc 100644 --- a/cookbook/form/unit_testing.rst +++ b/cookbook/form/unit_testing.rst @@ -135,7 +135,7 @@ before creating the parent form using PreloadedExtension class:: return array(new PreloadedExtension(array( $childType->getName() => $childType, ), array())); - } + } public function testBindValidData() { From cdca6266cde0925102ea46db2074b72ca326eb01 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 15 Jun 2013 17:58:03 +0300 Subject: [PATCH 0366/2078] space typo Remove space to enable code block --- book/security.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/security.rst b/book/security.rst index cb583031a90..ff4e4b702b8 100644 --- a/book/security.rst +++ b/book/security.rst @@ -415,7 +415,7 @@ submission (i.e. ``/login_check``): ``check_path`` ``logout`` keys. These keys can be route names (as shown in this example) or URLs that have routes configured for them. -Notice that the name of the ``login`` route matches the``login_path`` config +Notice that the name of the ``login`` route matches the ``login_path`` config value, as that's where the security system will redirect users that need to login. @@ -1247,7 +1247,7 @@ do the following: encoders: Symfony\Component\Security\Core\User\User: - algorithm: sha1 + algorithm: sha1 iterations: 1 encode_as_base64: false From d6dfc088d6c4cd0552a50f50dc4f488d93406d94 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 17:14:13 -0500 Subject: [PATCH 0367/2078] [#2675] Fixing a markup error --- cookbook/doctrine/registration_form.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/doctrine/registration_form.rst b/cookbook/doctrine/registration_form.rst index 9e98cea4b87..e274cf1c639 100644 --- a/cookbook/doctrine/registration_form.rst +++ b/cookbook/doctrine/registration_form.rst @@ -290,7 +290,7 @@ Next, update your routes. If you're placing your routes inside your bundle .. configuration-block:: - .. code-block:: yml + .. code-block:: yaml # src/Acme/AccountBundle/Resources/config/routing.yml account_register: From 0015c9d3532694a3ab8cb8da3a8884b3b6a1b36b Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 17:18:13 -0500 Subject: [PATCH 0368/2078] [#2729] Tweaks to the new synthetic service documentation by @WouterJ --- components/dependency_injection/advanced.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/components/dependency_injection/advanced.rst b/components/dependency_injection/advanced.rst index 284f8a58375..0dbe5526041 100644 --- a/components/dependency_injection/advanced.rst +++ b/components/dependency_injection/advanced.rst @@ -65,8 +65,10 @@ Synthetic Services Synthetic services are services that are injected into the container instead of being created by the container. -For instance, the ``request`` service which is injected in the -:method:`HttpKernel::handle() ` +For example, if you're using the :doc:`HttpKernel` +component with the DependencyInjection component, then the the ``request`` +service is injected in the +:method:`ContainerAwareHttpKernel::handle() ` method when entering the request :doc:`scope `. The class does not exist when there is no request, so it can't be included in the container configuration. Also, the service should be different for every @@ -96,11 +98,11 @@ To create a synthetic service, set ``synthetic`` to ``true``: ->setSynthetic(true); As you see, only the ``synthetic`` option is set. All other options are only used -to configure the container how a service is created by the container. As the -service isn't created by the container, these options are omitted. +to configure how a service is created by the container. As the service isn't +created by the container, these options are omitted. Now, you can inject the class by using -:method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::set`:: +:method:`Container::set`:: // ... $container->set('request', new MyRequest(...)); From 41e12daab7ad42e3a4dfcba8c672f96b3281fbbf Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 20 Jun 2013 08:27:28 +0300 Subject: [PATCH 0369/2078] Fix entity manager injection in listener service Argument 2 of of RegistrationSportListener __construct must be an instance of Doctrine\ORM\EntityManager, but in service configuration "doctrine" was injected. --- cookbook/form/dynamic_form_modification.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index aede2db7105..3e72de980d4 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -480,15 +480,15 @@ The subscriber would now look like:: /** * @var EntityManager */ - private $om; + private $em; /** * @param factory FormFactoryInterface */ - public function __construct(FormFactoryInterface $factory, EntityManager $om) + public function __construct(FormFactoryInterface $factory, EntityManager $em) { $this->factory = $factory; - $this->om = $om; + $this->em = $em; } public static function getSubscribedEvents() @@ -521,7 +521,7 @@ The subscriber would now look like:: { $data = $event->getData(); $id = $data['event']; - $meetup = $this->om + $meetup = $this->em ->getRepository('AcmeDemoBundle:SportMeetup') ->find($id); @@ -560,7 +560,7 @@ Now that you have that setup, register your form and the listener as services: - { name: form.type, alias: acme_meetup_registration } acme.form.meetup_registration_listener class: Acme\SportBundle\Form\EventListener\RegistrationSportListener - arguments: [@form.factory, @doctrine] + arguments: [@form.factory, @doctrine.orm.entity_manager] .. code-block:: xml @@ -572,7 +572,7 @@ Now that you have that setup, register your form and the listener as services: - + @@ -590,7 +590,7 @@ Now that you have that setup, register your form and the listener as services: $container->setDefinition( 'acme.form.meetup_registration_listener', $definition, - array('form.factory', 'doctrine') + array('form.factory', 'doctrine.orm.entity_manager') ); In this setup, the ``RegistrationSportListener`` will be a constructor argument From dcf2c27f57059ed62f662b2f7ef1b8edbb3f9dd0 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 18:09:35 -0500 Subject: [PATCH 0370/2078] [#2749] Reverting some mult-line commands that use the "\" character. This is technically correct, and prevents the scrollbar online, but I don't want to confuse any users with these --- book/doctrine.rst | 10 ++++------ book/installation.rst | 3 +-- book/templating.rst | 3 +-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index b8bf6b9a8a1..357f5e21e6c 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -208,13 +208,12 @@ just a simple PHP class. .. tip:: Once you learn the concepts behind Doctrine, you can have Doctrine create - simple entity classes for you: + simple entity classes for you. This will ask you interactive questions + to help you build any entity: .. code-block:: bash - $ php app/console doctrine:generate:entity \ - --entity="AcmeStoreBundle:Product" \ - --fields="name:string(255) price:float description:text" + $ php app/console doctrine:generate:entity .. index:: single: Doctrine; Adding mapping metadata @@ -899,8 +898,7 @@ you can let Doctrine create the class for you. .. code-block:: bash - $ php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Category" \ - --fields="name:string(255)" + $ php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Category" --fields="name:string(255)" This task generates the ``Category`` entity for you, with an ``id`` field, a ``name`` field and the associated getter and setter functions. diff --git a/book/installation.rst b/book/installation.rst index 045146c69db..4f1ad34198b 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -57,8 +57,7 @@ Distribution: .. code-block:: bash - $ php composer.phar create-project \ - symfony/framework-standard-edition /path/to/webroot/Symfony 2.2.0 + $ php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.2.0 .. tip:: diff --git a/book/templating.rst b/book/templating.rst index e369e3ab522..4aea82e0de2 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -1430,8 +1430,7 @@ console command: .. code-block:: bash # You can check by filename: - $ php app/console twig:lint \ - src/Acme/ArticleBundle/Resources/views/Article/recentList.html.twig + $ php app/console twig:lint src/Acme/ArticleBundle/Resources/views/Article/recentList.html.twig # or by directory: $ php app/console twig:lint src/Acme/ArticleBundle/Resources/views From 1d00f06bfd8431a64689a9ae66c8202815030e25 Mon Sep 17 00:00:00 2001 From: gondo Date: Wed, 12 Jun 2013 08:21:14 -0500 Subject: [PATCH 0371/2078] Fixing Security Entity Provider tutorial for more info see #2756 --- book/doctrine.rst | 4 + cookbook/security/entity_provider.rst | 157 ++++++++++++++------------ 2 files changed, 91 insertions(+), 70 deletions(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index 357f5e21e6c..c6b98b75228 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -364,6 +364,8 @@ see the :ref:`book-doctrine-field-types` section. class Product // ... +.. _book-doctrine-generating-getters-and-setters: + Generating Getters and Setters ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -426,6 +428,8 @@ mapping information) of a bundle or an entire namespace: The getters and setters are generated here only because you'll need them to interact with your PHP object. +.. _book-doctrine-creating-the-database-tables-schema: + Creating the Database Tables/Schema ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index b43a4e09ce3..c0a5a1fe409 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -197,24 +197,32 @@ For more details on each of these, see :class:`Symfony\\Component\\Security\\Cor because the :method:`Symfony\\Bridge\\Doctrine\\Security\\User\\EntityUserProvider::refreshUser` method reloads the user on each request by using the ``id``. -Below is an export of my ``User`` table from MySQL. For details on how to -create user records and encode their password, see :ref:`book-security-encoding-user-password`. +.. tip:: + + To generate missing setters and getters for your ``User`` entity, you + can use ``php app/console doctrine:generate:entities Acme/UserBundle/Entity/User``. + For more details, see Doctrine's :ref:`book-doctrine-generating-getters-and-setters`. + +Below is an export of my ``User`` table from MySQL with user `admin` +and password `admin`. For details on how to create user records and +encode their password, see :ref:`book-security-encoding-user-password`. .. code-block:: bash - $ mysql> select * from user; - +----+----------+----------------------------------+------------------------------------------+--------------------+-----------+ - | id | username | salt | password | email | is_active | - +----+----------+----------------------------------+------------------------------------------+--------------------+-----------+ - | 1 | hhamon | 7308e59b97f6957fb42d66f894793079 | 09610f61637408828a35d7debee5b38a8350eebe | hhamon@example.com | 1 | - | 2 | jsmith | ce617a6cca9126bf4036ca0c02e82dee | 8390105917f3a3d533815250ed7c64b4594d7ebf | jsmith@example.com | 1 | - | 3 | maxime | cd01749bb995dc658fa56ed45458d807 | 9764731e5f7fb944de5fd8efad4949b995b72a3c | maxime@example.com | 0 | - | 4 | donald | 6683c2bfd90c0426088402930cadd0f8 | 5c3bcec385f59edcc04490d1db95fdb8673bf612 | donald@example.com | 1 | - +----+----------+----------------------------------+------------------------------------------+--------------------+-----------+ - 4 rows in set (0.00 sec) - -The database now contains four users with different usernames, emails and -statuses. The next part will focus on how to authenticate one of these users + $ mysql> select * from acme_users; + +----+----------+------+------------------------------------------+--------------------+-----------+ + | id | username | salt | password | email | is_active | + +----+----------+------+------------------------------------------+--------------------+-----------+ + | 1 | admin | | d033e22ae348aeb5660fc2140aec35850c4da997 | admin@example.com | 1 | + +----+----------+------+------------------------------------------+--------------------+-----------+ + +.. tip:: + + To generate database table from your ``User`` entity, you can run + ``php app/console doctrine:schema:update --force``. + For mor details, see Doctrine's :ref:`book-doctrine-creating-the-database-tables-schema`. + +The next part will focus on how to authenticate one of these users thanks to the Doctrine entity user provider and a couple of lines of configuration. @@ -329,9 +337,8 @@ entity user provider to load User entity objects from the database by using the ``username`` unique field. In other words, this tells Symfony how to fetch the user from the database before checking the password validity. -This code and configuration works but it's not enough to secure the application -for **active** users. As of now, you can still authenticate with ``maxime``. The -next section explains how to forbid non active users. +This code is not enough to secure the application for **active** users. +The next section explains how to forbid non active users. Forbid non Active Users ----------------------- @@ -361,10 +368,10 @@ For this example, the first three methods will return ``true`` whereas the // src/Acme/UserBundle/Entity/User.php namespace Acme\UserBundle\Entity; - // ... + use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Security\Core\User\AdvancedUserInterface; - class User implements AdvancedUserInterface + class User implements AdvancedUserInterface, \Serializable { // ... @@ -389,10 +396,8 @@ For this example, the first three methods will return ``true`` whereas the } } -If you try to authenticate as ``maxime``, the access is now forbidden as this -user does not have an enabled account. The next session will focus on how -to write a custom entity provider to authenticate a user with his username -or his email address. +The next session will focus on how to write a custom entity provider +to authenticate a user with his username or his email address. Authenticating Someone with a Custom Entity Provider ---------------------------------------------------- @@ -434,8 +439,7 @@ The code below shows the implementation of the ->where('u.username = :username OR u.email = :email') ->setParameter('username', $username) ->setParameter('email', $username) - ->getQuery() - ; + ->getQuery(); try { // The Query::getSingleResult() method throws an exception @@ -543,10 +547,11 @@ about in this section. authenticated at all. In this example, the ``AcmeUserBundle:User`` entity class defines a -many-to-many relationship with a ``AcmeUserBundle:Group`` entity class. A user -can be related to several groups and a group can be composed of one or -more users. As a group is also a role, the previous ``getRoles()`` method now -returns the list of related groups:: +many-to-many relationship with a ``AcmeUserBundle:Role`` entity class. +A user can be related to several roles and a role can be composed of +one or more users. The previous ``getRoles()`` method now returns +the list of related roles. +Notice that methods ``__construcotor()`` and ``getRoles()`` had changed:: // src/Acme/UserBundle/Entity/User.php namespace Acme\UserBundle\Entity; @@ -556,63 +561,46 @@ returns the list of related groups:: class User implements AdvancedUserInterface, \Serializable { + //... + /** - * @ORM\ManyToMany(targetEntity="Group", inversedBy="users") + * @ORM\ManyToMany(targetEntity="Role", inversedBy="users") * */ - private $groups; + private $roles; public function __construct() { - $this->groups = new ArrayCollection(); + $this->roles = new ArrayCollection(); } - // ... - public function getRoles() { - return $this->groups->toArray(); - } - - /** - * @see \Serializable::serialize() - */ - public function serialize() - { - return serialize(array( - $this->id, - )); + return $this->roles->toArray(); } + + // ... - /** - * @see \Serializable::unserialize() - */ - public function unserialize($serialized) - { - list ( - $this->id, - ) = unserialize($serialized); - } } -The ``AcmeUserBundle:Group`` entity class defines three table fields (``id``, +The ``AcmeUserBundle:Role`` entity class defines three table fields (``id``, ``name`` and ``role``). The unique ``role`` field contains the role name used by the Symfony security layer to secure parts of the application. The most -important thing to notice is that the ``AcmeUserBundle:Group`` entity class +important thing to notice is that the ``AcmeUserBundle:Role`` entity class extends the :class:`Symfony\\Component\\Security\\Core\\Role\\Role`:: - // src/Acme/Bundle/UserBundle/Entity/Group.php + // src/Acme/Bundle/UserBundle/Entity/Role.php namespace Acme\UserBundle\Entity; - use Symfony\Component\Security\Core\Role\Role; + use Symfony\Component\Security\Core\Role\RoleInterface; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; /** - * @ORM\Table(name="acme_groups") + * @ORM\Table(name="acme_roles") * @ORM\Entity() */ - class Group extends Role + class Role implements RoleInterface { /** * @ORM\Column(name="id", type="integer") @@ -632,7 +620,7 @@ extends the :class:`Symfony\\Component\\Security\\Core\\Role\\Role`:: private $role; /** - * @ORM\ManyToMany(targetEntity="User", mappedBy="groups") + * @ORM\ManyToMany(targetEntity="User", mappedBy="roles") */ private $users; @@ -641,8 +629,6 @@ extends the :class:`Symfony\\Component\\Security\\Core\\Role\\Role`:: $this->users = new ArrayCollection(); } - // ... getters and setters for each property - /** * @see RoleInterface */ @@ -650,12 +636,20 @@ extends the :class:`Symfony\\Component\\Security\\Core\\Role\\Role`:: { return $this->role; } + + // ... getters and setters for each property } -To improve performances and avoid lazy loading of groups when retrieving a user -from the custom entity provider, the best solution is to join the groups +.. tip:: + + To generate missing setters and getters for your ``Role`` entity, you + can use ``php app/console doctrine:generate:entities Acme/UserBundle/Entity/User``. + For more details, see Doctrine's :ref:`book-doctrine-generating-getters-and-setters`. + +To improve performances and avoid lazy loading of roles when retrieving a user +from the custom entity provider, the best solution is to join the roles relationship in the ``UserRepository::loadUserByUsername()`` method. This will -fetch the user and his associated roles / groups with a single query:: +fetch the user and his associated roles with a single query:: // src/Acme/UserBundle/Entity/UserRepository.php namespace Acme\UserBundle\Entity; @@ -668,8 +662,8 @@ fetch the user and his associated roles / groups with a single query:: { $q = $this ->createQueryBuilder('u') - ->select('u, g') - ->leftJoin('u.groups', 'g') + ->select('u, r') + ->leftJoin('u.roles', 'r') ->where('u.username = :username OR u.email = :email') ->setParameter('username', $username) ->setParameter('email', $username) @@ -681,6 +675,29 @@ fetch the user and his associated roles / groups with a single query:: // ... } -The ``QueryBuilder::leftJoin()`` method joins and fetches related groups from +The ``QueryBuilder::leftJoin()`` method joins and fetches related roles from the ``AcmeUserBundle:User`` model class when a user is retrieved with his email address or username. + +To re-generate all database tables, you can run ``php app/console doctrine:schema:update --force``. +This will also create additional table ``user_role`` what holds +relations between users and roles. +For mor details, see Doctrine's :ref:`book-doctrine-creating-the-database-tables-schema`. + +Below is an export of my ``Roles`` and ``user_role`` tables from MySQL: + +.. code-block:: bash + + $ mysql> select * from acme_users; + +----+-------+------------+ + | id | name | role | + +----+-------+------------+ + | 1 | admin | ROLE_ADMIN | + +----+-------+------------+ + + mysql> select * from user_role; + +---------+---------+ + | user_id | role_id | + +---------+---------+ + | 1 | 1 | + +---------+---------+ From 7a376518c6b292a5d6d1dee5062d419544732cc7 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 18:43:03 -0500 Subject: [PATCH 0372/2078] [#2765] WIP Tweaks to changes made to entity provider entry --- cookbook/security/entity_provider.rst | 51 ++++++++++++++++----------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index c0a5a1fe409..09069426eb8 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -40,6 +40,15 @@ To make it shorter, the getter and setter methods for each have been removed to focus on the most important methods that come from the :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface`. +.. tip:: + + You can :ref:`generate the missing getter and setters` + by running: + + .. code-block:: bash + + $ php app/console doctrine:generate:entities Acme/UserBundle/Entity/User + .. code-block:: php // src/Acme/UserBundle/Entity/User.php @@ -154,6 +163,15 @@ focus on the most important methods that come from the } } +.. tip:: + + :ref:`Generate the database table` + for your ``User`` entity by running: + + .. code-block:: bash + + $ php app/console doctrine:schema:update --force + In order to use an instance of the ``AcmeUserBundle:User`` class in the Symfony security layer, the entity class must implement the :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface`. This @@ -197,15 +215,9 @@ For more details on each of these, see :class:`Symfony\\Component\\Security\\Cor because the :method:`Symfony\\Bridge\\Doctrine\\Security\\User\\EntityUserProvider::refreshUser` method reloads the user on each request by using the ``id``. -.. tip:: - - To generate missing setters and getters for your ``User`` entity, you - can use ``php app/console doctrine:generate:entities Acme/UserBundle/Entity/User``. - For more details, see Doctrine's :ref:`book-doctrine-generating-getters-and-setters`. - -Below is an export of my ``User`` table from MySQL with user `admin` -and password `admin`. For details on how to create user records and -encode their password, see :ref:`book-security-encoding-user-password`. +Below is an export of the ``User`` table from MySQL with user ``admin`` and +password ``admin`` (which has been encoded). For details on how to create +user records and encode their password, see :ref:`book-security-encoding-user-password`. .. code-block:: bash @@ -216,12 +228,6 @@ encode their password, see :ref:`book-security-encoding-user-password`. | 1 | admin | | d033e22ae348aeb5660fc2140aec35850c4da997 | admin@example.com | 1 | +----+----------+------+------------------------------------------+--------------------+-----------+ -.. tip:: - - To generate database table from your ``User`` entity, you can run - ``php app/console doctrine:schema:update --force``. - For mor details, see Doctrine's :ref:`book-doctrine-creating-the-database-tables-schema`. - The next part will focus on how to authenticate one of these users thanks to the Doctrine entity user provider and a couple of lines of configuration. @@ -337,13 +343,15 @@ entity user provider to load User entity objects from the database by using the ``username`` unique field. In other words, this tells Symfony how to fetch the user from the database before checking the password validity. -This code is not enough to secure the application for **active** users. -The next section explains how to forbid non active users. +Forbid Inactive Users +--------------------- -Forbid non Active Users ------------------------ +If a User's ``isActive`` property is set to ``false`` (i.e. ``is_active`` +is 0 in the database), the user will still be able to login access the site +normally. To prevent "inactive" users from logging in, you'll need to do a +little more work. -The easiest way to exclude non active users is to implement the +The easiest way to exclude inactive users is to implement the :class:`Symfony\\Component\\Security\\Core\\User\\AdvancedUserInterface` interface that takes care of checking the user's account status. The :class:`Symfony\\Component\\Security\\Core\\User\\AdvancedUserInterface` @@ -396,6 +404,9 @@ For this example, the first three methods will return ``true`` whereas the } } +Now, if you try to authenticate as a user who's ``is_active`` database field +is set to 0, you won't be allowed. + The next session will focus on how to write a custom entity provider to authenticate a user with his username or his email address. From c10c405f8b4eea5b89d458b4bc8a950e46c7c83e Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 19:02:56 -0500 Subject: [PATCH 0373/2078] [#2765] Reading through and refactoring changes to the entity_provider entry --- cookbook/security/entity_provider.rst | 99 +++++++++++++++++---------- 1 file changed, 62 insertions(+), 37 deletions(-) diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index 09069426eb8..e228cc14157 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -561,8 +561,8 @@ In this example, the ``AcmeUserBundle:User`` entity class defines a many-to-many relationship with a ``AcmeUserBundle:Role`` entity class. A user can be related to several roles and a role can be composed of one or more users. The previous ``getRoles()`` method now returns -the list of related roles. -Notice that methods ``__construcotor()`` and ``getRoles()`` had changed:: +the list of related roles. Notice that ``__construct()`` and ``getRoles()`` +methods have changed:: // src/Acme/UserBundle/Entity/User.php namespace Acme\UserBundle\Entity; @@ -572,7 +572,7 @@ Notice that methods ``__construcotor()`` and ``getRoles()`` had changed:: class User implements AdvancedUserInterface, \Serializable { - //... + // ... /** * @ORM\ManyToMany(targetEntity="Role", inversedBy="users") @@ -594,11 +594,10 @@ Notice that methods ``__construcotor()`` and ``getRoles()`` had changed:: } -The ``AcmeUserBundle:Role`` entity class defines three table fields (``id``, -``name`` and ``role``). The unique ``role`` field contains the role name used by -the Symfony security layer to secure parts of the application. The most -important thing to notice is that the ``AcmeUserBundle:Role`` entity class -extends the :class:`Symfony\\Component\\Security\\Core\\Role\\Role`:: +The ``AcmeUserBundle:Role`` entity class defines three fields (``id``, +``name`` and ``role``). The unique ``role`` field contains the role name +(e.g. ``ROLE_ADMIN``) used by the Symfony security layer to secure parts +of the application:: // src/Acme/Bundle/UserBundle/Entity/Role.php namespace Acme\UserBundle\Entity; @@ -651,14 +650,63 @@ extends the :class:`Symfony\\Component\\Security\\Core\\Role\\Role`:: // ... getters and setters for each property } -.. tip:: +For brevity, the getter and setter methods are hidden, but you can +:ref:`generate them `: + +.. code-block:: bas + + $ php app/console doctrine:generate:entities Acme/UserBundle/Entity/User + +Don't forget also to update your database schema: + +.. code-block:: bash + + php app/console doctrine:schema:update --force + +This will create the ``acme_role`` table and a ``user_role`` that stores +the many-to-many relationship between ``acme_user`` and ``acme_role``. If +you had one user linked to one role, your database might look something like +this: + +.. code-block:: text + + $ mysql> select * from acme_users; + +----+-------+------------+ + | id | name | role | + +----+-------+------------+ + | 1 | admin | ROLE_ADMIN | + +----+-------+------------+ + + mysql> select * from user_role; + +---------+---------+ + | user_id | role_id | + +---------+---------+ + | 1 | 1 | + +---------+---------+ + +And that's it! When the user logs in, Symfony security system will call the +``User::getRoles`` method. This will return an array of ``Role`` objects +that Symfony will use to determine if the user should have access to certain +parts of the system. + +.. sidebar:: What's the purpose of the RoleInterface? - To generate missing setters and getters for your ``Role`` entity, you - can use ``php app/console doctrine:generate:entities Acme/UserBundle/Entity/User``. - For more details, see Doctrine's :ref:`book-doctrine-generating-getters-and-setters`. + Notice that the ``Role`` class implements + :class:`Symfony\\Component\\Security\\Core\\Role\\RoleInterface`. This is + because Symfony's security system requires that the ``User::getRoles`` method + returns an array of either role strings or objects that implement this interface. + If ``Role`` didn't implement this interface, then ``User::getRoles`` + would need to iterate over all the ``Role`` objects, call ``getRole`` + on each, and create an array of strings to return. Both approaches are + valid and equivalent. -To improve performances and avoid lazy loading of roles when retrieving a user -from the custom entity provider, the best solution is to join the roles +.. _cookbook-doctrine-entity-provider-role-db-schema: + +Improving Performance with a Join +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To improve performance and avoid lazy loading of roles when retrieving a user +from the custom entity provider, you can use a Doctrine join to the roles relationship in the ``UserRepository::loadUserByUsername()`` method. This will fetch the user and his associated roles with a single query:: @@ -689,26 +737,3 @@ fetch the user and his associated roles with a single query:: The ``QueryBuilder::leftJoin()`` method joins and fetches related roles from the ``AcmeUserBundle:User`` model class when a user is retrieved with his email address or username. - -To re-generate all database tables, you can run ``php app/console doctrine:schema:update --force``. -This will also create additional table ``user_role`` what holds -relations between users and roles. -For mor details, see Doctrine's :ref:`book-doctrine-creating-the-database-tables-schema`. - -Below is an export of my ``Roles`` and ``user_role`` tables from MySQL: - -.. code-block:: bash - - $ mysql> select * from acme_users; - +----+-------+------------+ - | id | name | role | - +----+-------+------------+ - | 1 | admin | ROLE_ADMIN | - +----+-------+------------+ - - mysql> select * from user_role; - +---------+---------+ - | user_id | role_id | - +---------+---------+ - | 1 | 1 | - +---------+---------+ From 4bfa22484b21e5933f2156e3ad75b1e54e380f5c Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 20:39:18 -0500 Subject: [PATCH 0374/2078] [#2669] Tweak thanks to @WouterJ --- cookbook/doctrine/mapping_model_classes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/doctrine/mapping_model_classes.rst b/cookbook/doctrine/mapping_model_classes.rst index f72b6939e38..619c5da835f 100644 --- a/cookbook/doctrine/mapping_model_classes.rst +++ b/cookbook/doctrine/mapping_model_classes.rst @@ -30,7 +30,7 @@ register the mappings for your model classes. In your bundle class, write the following code to register the compiler pass. -This one is written for the ``FOSUserBundle``, so parts of it will need to +This one is written for the FOSUserBundle, so parts of it will need to be adapted for your case:: use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass; From 45e147041ea7b51ae69ec2932d186cdd43c730c2 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 30 Jun 2013 21:24:30 -0500 Subject: [PATCH 0375/2078] Removing note that used to be attached to a versionadded before it that was removed (and so this note should have been removed too) --- cookbook/security/entity_provider.rst | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index 2d14c500acc..41a1c56c24a 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -185,21 +185,6 @@ interface forces the class to implement the five following methods: For more details on each of these, see :class:`Symfony\\Component\\Security\\Core\\User\\UserInterface`. -.. code-block:: php - - // src/Acme/UserBundle/Entity/User.php - - namespace Acme\UserBundle\Entity; - - use Symfony\Component\Security\Core\User\EquatableInterface; - - // ... - - public function isEqualTo(UserInterface $user) - { - return $this->id === $user->getId(); - } - .. note:: The :phpclass:`Serializable` interface and its ``serialize`` and ``unserialize`` From 1df5e91a827d24f7b7c3234bc12c439956b6482e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Quatannens?= Date: Wed, 3 Jul 2013 14:06:16 +0200 Subject: [PATCH 0376/2078] Cookbook/Console/ConsoleCommand : Adding option/argument example in test See comments in the PR #2792 I made on 2.1 branch --- cookbook/console/console_command.rst | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cookbook/console/console_command.rst b/cookbook/console/console_command.rst index 47afaccfaaf..5e48ecd6b89 100644 --- a/cookbook/console/console_command.rst +++ b/cookbook/console/console_command.rst @@ -104,7 +104,13 @@ instead of $command = $application->find('demo:greet'); $commandTester = new CommandTester($command); - $commandTester->execute(array('command' => $command->getName())); + $commandTester->execute( + array( + 'command' => $command->getName(), + 'name' => 'Fabien', + '--yell' => true, + ) + ); $this->assertRegExp('/.../', $commandTester->getDisplay()); @@ -133,7 +139,13 @@ you can extend your test from $command = $application->find('demo:greet'); $commandTester = new CommandTester($command); - $commandTester->execute(array('command' => $command->getName())); + $commandTester->execute( + array( + 'command' => $command->getName(), + 'name' => 'Fabien', + '--yell' => true, + ) + ); $this->assertRegExp('/.../', $commandTester->getDisplay()); From c5682f74e28852e5410d246f6c10284591f14ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Quatannens?= Date: Wed, 3 Jul 2013 15:00:12 +0200 Subject: [PATCH 0377/2078] Adding a note to specify that parameter/option are not mandatory --- cookbook/console/console_command.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cookbook/console/console_command.rst b/cookbook/console/console_command.rst index 5e48ecd6b89..3a251784b51 100644 --- a/cookbook/console/console_command.rst +++ b/cookbook/console/console_command.rst @@ -118,6 +118,11 @@ instead of } } +.. note:: + + In the specific case above, the ``name`` parameter and the ``--yell`` option are not + mandatory for the command to work well, but they are shown for the example. + To be able to use the fully set up service container for your console tests you can extend your test from :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\WebTestCase`:: From 0acdd1117c1f2c2feb32e3fa353210da8bdf7dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Quatannens?= Date: Thu, 4 Jul 2013 13:40:48 +0200 Subject: [PATCH 0378/2078] Reference/forms/type/country : Minor bad copy/paste fix --- reference/forms/types/country.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/country.rst b/reference/forms/types/country.rst index eecf3d668b0..99381c12a18 100644 --- a/reference/forms/types/country.rst +++ b/reference/forms/types/country.rst @@ -50,8 +50,8 @@ choices **default**: ``Symfony\Component\Intl\Intl::getRegionBundle()->getCountryNames()`` -The country type defaults the ``choices`` option to the all locales. -It uses the default locale to determine the language. +The country type defaults the ``choices`` option to the whole list of countries. +It uses the default locale to determine which language to use. Inherited options ----------------- From 84951f4bac98e7ee4db5fb34931382f039f6bf40 Mon Sep 17 00:00:00 2001 From: thewilkybarkid Date: Thu, 4 Jul 2013 13:34:33 +0100 Subject: [PATCH 0379/2078] Correct former TypeTestCase namespace --- cookbook/form/unit_testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/unit_testing.rst b/cookbook/form/unit_testing.rst index 00b9e7f25d0..a17ad3d72da 100644 --- a/cookbook/form/unit_testing.rst +++ b/cookbook/form/unit_testing.rst @@ -23,7 +23,7 @@ test the core types and you can use it to test your types too. .. versionadded:: 2.3 The ``TypeTestCase`` has moved to the ``Symfony\Component\Form\Test`` namespace in 2.3. Previously, the class was located in - ``Symfony\Component\Form\Tests\Core\Extension\Type``. + ``Symfony\Component\Form\Tests\Extension\Core\Type``. The Basics ---------- From 95ba03b6512d42316ef304716b89bf249c366d0e Mon Sep 17 00:00:00 2001 From: John Bafford Date: Thu, 4 Jul 2013 10:48:44 -0400 Subject: [PATCH 0380/2078] Reorganize and expand quickstart big picture docs on environments * Add Environments section under "Understanding the Fundamentals" to introduce environments. This uses the glossary definition as a starting point and expands on it a little. * Move the Web Profiler discussion out of Working with Environments into a separate section, and add a paragraph briefly summarizing what the profiler can do. * Improve the Working with Environments section. * Original changes from PR #2683 rebased on 2.2 --- quick_tour/the_big_picture.rst | 135 +++++++++++++++++++++------------ 1 file changed, 86 insertions(+), 49 deletions(-) diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index 9b7f4f3a087..0f1991e1822 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -403,54 +403,79 @@ have seen so far. All the code you write for your application is organized in bundles. In Symfony2 speak, a bundle is a structured set of files (PHP files, stylesheets, JavaScripts, images, ...) that implements a single feature (a blog, a forum, ...) and which can be easily shared with other developers. As -of now, you have manipulated one bundle, ``AcmeDemoBundle``. You will learn +of now, you have manipulated one bundle, AcmeDemoBundle. You will learn more about bundles in the last chapter of this tutorial. +Environments +~~~~~~~~~~~~ + +Every Symfony application runs within an :term:`environment`. An environment +is a specific set of configuration and loaded bundles, represented by a string. +The same application can be run with different configurations by running the +application in different environments. Symfony2 comes with three environments +defined — ``dev``, ``test`` and ``prod`` — but you can create your own as well. + +Environments are useful by allowing a single application to have a dev environment +built for debugging and a production environment optimized for speed. You might +also load specific bundles based on the selected environment. For example, +Symfony2 comes with the WebProfilerBundle (described below), enabled only +in the ``dev`` and ``test`` environments. + .. _quick-tour-big-picture-environments: Working with Environments ------------------------- -Now that you have a better understanding of how Symfony2 works, take a closer -look at the bottom of any Symfony2 rendered page. You should notice a small -bar with the Symfony2 logo. This is called the "Web Debug Toolbar" and it -is the developer's best friend. +Symfony2 loads configuration based on the name of the environment. Typically, +you put your common configuration in ``config.yml`` and override where necessary +in the configuration for each environment. For example: -.. image:: /images/quick_tour/web_debug_toolbar.png - :align: center - -But what you see initially is only the tip of the iceberg; click on the long -hexadecimal number (the session token) to reveal yet another very useful -Symfony2 debugging tool: the profiler. +.. code-block:: yaml -.. image:: /images/quick_tour/profiler.png - :align: center + # app/config/config_dev.yml + imports: + - { resource: config.yml } -.. note:: + web_profiler: + toolbar: true + intercept_redirects: false - You can get more information quickly by hovering over the items on the - Web Debug Toolbar. +In this example, the ``dev`` environment loads the ``config_dev.yml`` configuration +file, which itself imports the global ``config.yml`` file and then modifies it by +enabling the web debug toolbar. -Of course, you won't want to show these tools when you deploy your application -to production. That's why you will find another front controller in the -``web/`` directory (``app.php``), which is optimized for the production environment. -The ``AcmeDemoBundle`` is normally only available in the dev environment (see -the note below), but if you were to add it to the production environment, you -could go here: +To make your application respond faster, Symfony2 maintains a cache under the +``app/cache/`` directory. In the ``dev`` environment, this cache is flushed +automatically whenever you make changes to any code or configuration. But that's +not the case in the ``prod`` environment, where performance is key. That's why you +should always use the development environment when developing your application. + +Symfony2 comes with two web-accessible front controllers: ``app_dev.php`` +provides the ``dev`` environment, and ``app.php`` provides the ``prod`` environment. +All web accesses to Symfony2 normally go through one of these front controllers. +(The ``test`` environment is normally only used when running unit tests, and so +doesn't have a dedicated front controller. The console tool also provides a +front controller that can be used with any environment.) + +The AcmeDemoBundle is normally only available in the dev environment, but +if you were to add it (and its routes) to the production environment, you could +go here: .. code-block:: text http://localhost/app.php/demo/hello/Fabien -And if you use Apache with ``mod_rewrite`` enabled, you can even omit the -``app.php`` part of the URL: +If instead of using php's built-in webserver, you use Apache with ``mod_rewrite`` +enabled and take advantage of the ``.htaccess`` file Symfony2 provides +in ``web/``, you can even omit the ``app.php`` part of the URL. The default +``.htaccess`` points all requests to the ``app.php`` front controller: .. code-block:: text http://localhost/demo/hello/Fabien -Last but not least, on production servers, you should point your web root -directory to the ``web/`` directory to secure your installation and have an +Finally, on production servers, you should point your web root directory +to the ``web/`` directory to better secure your installation and have an even better looking URL: .. code-block:: text @@ -461,35 +486,47 @@ even better looking URL: Note that the three URLs above are provided here only as **examples** of how a URL looks like when the production front controller is used (with or - without mod_rewrite). If you actually try them in an out of the box - installation of *Symfony Standard Edition* you will get a 404 error as - *AcmeDemoBundle* is enabled only in dev environment and its routes imported - in *app/config/routing_dev.yml*. + without mod_rewrite). If you actually try them in an out-of-the-box + installation of *Symfony Standard Edition*, you will get a 404 error since + *AcmeDemoBundle* is enabled only in the dev environment and its routes imported + from *app/config/routing_dev.yml*. -To make your application respond faster, Symfony2 maintains a cache under the -``app/cache/`` directory. In the development environment (``app_dev.php``), -this cache is flushed automatically whenever you make changes to any code or -configuration. But that's not the case in the production environment -(``app.php``) where performance is key. That's why you should always use -the development environment when developing your application. +.. _quick-tour-big-picture-web-debug-toolbar: -Different :term:`environments` of a given application differ -only in their configuration. In fact, a configuration can inherit from another -one: +The Web Debug Toolbar and Profiler +---------------------------------- -.. code-block:: yaml - # app/config/config_dev.yml - imports: - - { resource: config.yml } +Now that you have a better understanding of how Symfony2 works, take a closer +look at the bottom of any Symfony2 rendered page. You should notice a small +bar with the Symfony2 logo. This is the "Web Debug Toolbar", and it is a +Symfony2 developer's best friend. - web_profiler: - toolbar: true - intercept_redirects: false +.. image:: /images/quick_tour/web_debug_toolbar.png + :align: center + +What you see initially is only the tip of the iceberg; click on the long +hexadecimal number (the session token) to reveal yet another very useful +Symfony2 debugging tool: the profiler. + +.. image:: /images/quick_tour/profiler.png + :align: center + +When enabled (by default in the dev and test environments), the Profiler +records a great deal of information on each request made to your application. +It allows you to view details of each request, including, but not limited to, +GET or POST parameters and the request headers; logs; an execution timeline; +information on the currently logged in user; Doctrine queries; and more. + +Of course, it would be unwise to have these tools enabled when you deploy +your application, so by default, the profiler is not enabled in the ``prod`` +environment. (In fact, its bundle is not even loaded). + +.. note:: + + You can get more information quickly by hovering over the items on the + Web Debug Toolbar. -The ``dev`` environment (which loads the ``config_dev.yml`` configuration file) -imports the global ``config.yml`` file and then modifies it by, in this example, -enabling the web debug toolbar. Final Thoughts -------------- From 76896ed186008b4feb80b4ba65080720d49806e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Ja=CC=88ger?= Date: Fri, 5 Jul 2013 15:25:41 +0200 Subject: [PATCH 0381/2078] fix xml service definition | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.3 | Fixed tickets | n.a. --- cookbook/service_container/scopes.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cookbook/service_container/scopes.rst b/cookbook/service_container/scopes.rst index e779bc933b9..cf468d195b0 100644 --- a/cookbook/service_container/scopes.rst +++ b/cookbook/service_container/scopes.rst @@ -157,10 +157,11 @@ your code. This should also be taken into account when declaring your service: - - - + > + + + + .. code-block:: php From b6edce3bdca7357df7b32d0d821f791d4bfbc56b Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 5 Jul 2013 16:17:52 +0200 Subject: [PATCH 0382/2078] remove useless use of variable --- cookbook/form/dynamic_form_modification.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 3e72de980d4..047bf52400b 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -419,7 +419,7 @@ sport like this:: $builder->addEventListener( FormEvents::PRE_SET_DATA, - function(FormEvent $event) use($user, $factory){ + function(FormEvent $event) use($factory){ $form = $event->getForm(); // this would be your entity, i.e. SportMeetup From 652850154d2a2843151832ea67dd019198ccebdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Quatannens?= Date: Sat, 6 Jul 2013 19:13:16 +0200 Subject: [PATCH 0383/2078] Change to @Wouterj proposal which is better --- reference/forms/types/country.rst | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/reference/forms/types/country.rst b/reference/forms/types/country.rst index 99381c12a18..c2486d6011a 100644 --- a/reference/forms/types/country.rst +++ b/reference/forms/types/country.rst @@ -45,34 +45,7 @@ you should just use the ``choice`` type directly. Overridden Options ------------------ -choices -~~~~~~~ - -**default**: ``Symfony\Component\Intl\Intl::getRegionBundle()->getCountryNames()`` - -The country type defaults the ``choices`` option to the whole list of countries. -It uses the default locale to determine which language to use. - -Inherited options ------------------ - -These options inherit from the :doc:`choice` type: - -.. include:: /reference/forms/types/options/multiple.rst.inc - -.. include:: /reference/forms/types/options/expanded.rst.inc - -.. include:: /reference/forms/types/options/preferred_choices.rst.inc - -.. include:: /reference/forms/types/options/empty_value.rst.inc - -.. include:: /reference/forms/types/options/error_bubbling.rst.inc - -.. include:: /reference/forms/types/options/error_mapping.rst.inc - -These options inherit from the :doc:`date` type: - -.. include:: /reference/forms/types/options/required.rst.inc +choicesttes/options/required.rst.inc .. include:: /reference/forms/types/options/label.rst.inc From 01bb29e83715562d641aebf0446fbd92a0fb37ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Quatannens?= Date: Sat, 6 Jul 2013 19:18:57 +0200 Subject: [PATCH 0384/2078] Fixing mishandling (sorry) --- reference/forms/types/country.rst | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/reference/forms/types/country.rst b/reference/forms/types/country.rst index c2486d6011a..bf30de44364 100644 --- a/reference/forms/types/country.rst +++ b/reference/forms/types/country.rst @@ -45,7 +45,34 @@ you should just use the ``choice`` type directly. Overridden Options ------------------ -choicesttes/options/required.rst.inc +choices +~~~~~~~ + +**default**: ``Symfony\Component\Intl\Intl::getRegionBundle()->getCountryNames()`` + +The country type defaults the ``choices`` option to the whole list of countries. +The locale is used to translate the countries names. + +Inherited options +----------------- + +These options inherit from the :doc:`choice` type: + +.. include:: /reference/forms/types/options/multiple.rst.inc + +.. include:: /reference/forms/types/options/expanded.rst.inc + +.. include:: /reference/forms/types/options/preferred_choices.rst.inc + +.. include:: /reference/forms/types/options/empty_value.rst.inc + +.. include:: /reference/forms/types/options/error_bubbling.rst.inc + +.. include:: /reference/forms/types/options/error_mapping.rst.inc + +These options inherit from the :doc:`date` type: + +.. include:: /reference/forms/types/options/required.rst.inc .. include:: /reference/forms/types/options/label.rst.inc From 587d5f0d80987e9ab3c7123de629a9d6d4ddab16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Quatannens?= Date: Sat, 6 Jul 2013 19:20:21 +0200 Subject: [PATCH 0385/2078] Rephrase the sentence about locale and language --- reference/forms/types/language.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/language.rst b/reference/forms/types/language.rst index 322995d5cb4..edc365770d3 100644 --- a/reference/forms/types/language.rst +++ b/reference/forms/types/language.rst @@ -51,8 +51,8 @@ choices **default**: ``Symfony\Component\Intl\Intl::getLanguageBundle()->getLanguageNames()``. -The choices option defaults to all languages. It uses the default locale to -specify the language. +The choices option defaults to all languages. +The default locale is used to translate the languages names. Inherited Options ----------------- From 7a60abd12f88a5b357619b0ce6c75637bb65a6d8 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 9 Jul 2013 12:28:06 +0200 Subject: [PATCH 0386/2078] remove remaining references to the virtual option --- reference/forms/types/date.rst | 3 --- reference/forms/types/time.rst | 3 --- 2 files changed, 6 deletions(-) diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index 4418a5bdc96..ebf56690399 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -38,7 +38,6 @@ day, and year) or three select boxes (see the `widget_` option). | | - `disabled`_ | | | - `mapped`_ | | | - `inherit_data`_ | -| | - `virtual`_ | | | - `error_mapping`_ | +----------------------+-----------------------------------------------------------------------------+ | Parent type | ``field`` (if text), ``form`` otherwise | @@ -151,6 +150,4 @@ These options inherit from the :doc:`field` type: .. include:: /reference/forms/types/options/inherit_data.rst.inc -.. include:: /reference/forms/types/options/virtual.rst.inc - .. include:: /reference/forms/types/options/error_mapping.rst.inc diff --git a/reference/forms/types/time.rst b/reference/forms/types/time.rst index ebb35fc8670..5e9a4599c2c 100644 --- a/reference/forms/types/time.rst +++ b/reference/forms/types/time.rst @@ -34,7 +34,6 @@ as a ``DateTime`` object, a string, a timestamp or an array. | | - `disabled`_ | | | - `mapped`_ | | | - `inherit_data`_ | -| | - `virtual`_ | | | - `error_mapping`_ | +----------------------+-----------------------------------------------------------------------------+ | Parent type | form | @@ -152,6 +151,4 @@ These options inherit from the :doc:`field` type: .. include:: /reference/forms/types/options/inherit_data.rst.inc -.. include:: /reference/forms/types/options/virtual.rst.inc - .. include:: /reference/forms/types/options/error_mapping.rst.inc From a5c5f279e28b0dc7e3c41605361354ebbe0e07b7 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Thu, 11 Jul 2013 15:27:31 +0200 Subject: [PATCH 0387/2078] added empty_value --- reference/forms/types/birthday.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/reference/forms/types/birthday.rst b/reference/forms/types/birthday.rst index 8d6af04af6d..fc1b58378be 100644 --- a/reference/forms/types/birthday.rst +++ b/reference/forms/types/birthday.rst @@ -24,6 +24,7 @@ option defaults to 120 years ago to the current year. +----------------------+-------------------------------------------------------------------------------+ | Inherited Options | - `widget`_ | | | - `input`_ | +| | - `empty_value`_ | | | - `months`_ | | | - `days`_ | | | - `format`_ | @@ -61,6 +62,8 @@ These options inherit from the :doc:`date` type: .. include:: /reference/forms/types/options/date_input.rst.inc +.. include:: /reference/forms/types/options/empty_value.rst.inc + .. include:: /reference/forms/types/options/months.rst.inc .. include:: /reference/forms/types/options/days.rst.inc From 6f63b0cce50e4145805f76a27f8b3b239bd1561b Mon Sep 17 00:00:00 2001 From: Richard Miller Date: Fri, 12 Jul 2013 14:26:01 +0100 Subject: [PATCH 0388/2078] Add submit buttons to form building examples --- book/forms.rst | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/book/forms.rst b/book/forms.rst index 4185231accf..609713db6a0 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -654,6 +654,7 @@ guess from the validation rules that both the ``task`` field is a normal $form = $this->createFormBuilder($task) ->add('task') ->add('dueDate', null, array('widget' => 'single_text')) + ->add('save', 'submit') ->getForm(); } @@ -918,6 +919,7 @@ ways. If you build your form in the controller, you can use ``setAction()`` and ->setMethod('GET') ->add('task', 'text') ->add('dueDate', 'date') + ->add('save', 'submit') ->getForm(); .. note:: @@ -991,8 +993,9 @@ that will house the logic for building the task form:: { public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('task'); - $builder->add('dueDate', null, array('widget' => 'single_text')); + $builder->add('task') + ->add('dueDate', null, array('widget' => 'single_text')) + ->add('save', 'submit'); } public function getName() @@ -1057,8 +1060,9 @@ the choice is ultimately up to you. public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('task'); - $builder->add('dueDate', null, array('mapped' => false)); + $builder->add('task') + ->add('dueDate', null, array('mapped' => false)) + ->add('save', 'submit'); } Additionally, if there are any fields on the form that aren't included in @@ -1731,6 +1735,7 @@ an array of the submitted data. This is actually really easy:: ->add('name', 'text') ->add('email', 'email') ->add('message', 'textarea') + ->add('send', 'submit') ->getForm(); $form->handleRequest($request); From 9690dceee07358c8d5342255ca06c2e26814d800 Mon Sep 17 00:00:00 2001 From: John Bafford Date: Fri, 12 Jul 2013 19:45:39 -0400 Subject: [PATCH 0389/2078] Big Picture Environments cleanups * Move the environments and front controller discussions to book/page_creation * This allows for the debug toolbar discussion to be more prominent --- book/page_creation.rst | 34 ++++++++++++ quick_tour/the_big_picture.rst | 94 ++++++++++++---------------------- 2 files changed, 66 insertions(+), 62 deletions(-) diff --git a/book/page_creation.rst b/book/page_creation.rst index fec9ae35c41..3250094d68c 100644 --- a/book/page_creation.rst +++ b/book/page_creation.rst @@ -22,6 +22,40 @@ HTTP response. Symfony2 follows this philosophy and provides you with tools and conventions to keep your application organized as it grows in users and complexity. +.. index:: + single: Page creation; Environments & Front Controllers + +.. _page-creation-environments: + +Environments & Front Controllers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Every Symfony application runs within an :term:`environment`. An environment +is a specific set of configuration and loaded bundles, represented by a string. +The same application can be run with different configurations by running the +application in different environments. Symfony2 comes with three environments +defined — ``dev``, ``test`` and ``prod`` — but you can create your own as well. + +Environments are useful by allowing a single application to have a dev environment +built for debugging and a production environment optimized for speed. You might +also load specific bundles based on the selected environment. For example, +Symfony2 comes with the WebProfilerBundle (described below), enabled only +in the ``dev`` and ``test`` environments. + +To make your application respond faster, Symfony2 maintains a cache under the +``app/cache/`` directory. In the ``dev`` environment, this cache is flushed +automatically whenever you make changes to any code or configuration. But that's +not the case in the ``prod`` environment, where performance is key. That's why you +should always use the development environment when developing your application. + +Symfony2 comes with two web-accessible front controllers: ``app_dev.php`` +provides the ``dev`` environment, and ``app.php`` provides the ``prod`` environment. +All web accesses to Symfony2 normally go through one of these front controllers. +(The ``test`` environment is normally only used when running unit tests, and so +doesn't have a dedicated front controller. The console tool also provides a +front controller that can be used with any environment.) + + .. index:: single: Page creation; Example diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index 0f1991e1822..f72200e6b29 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -406,26 +406,41 @@ blog, a forum, ...) and which can be easily shared with other developers. As of now, you have manipulated one bundle, AcmeDemoBundle. You will learn more about bundles in the last chapter of this tutorial. -Environments -~~~~~~~~~~~~ - -Every Symfony application runs within an :term:`environment`. An environment -is a specific set of configuration and loaded bundles, represented by a string. -The same application can be run with different configurations by running the -application in different environments. Symfony2 comes with three environments -defined — ``dev``, ``test`` and ``prod`` — but you can create your own as well. - -Environments are useful by allowing a single application to have a dev environment -built for debugging and a production environment optimized for speed. You might -also load specific bundles based on the selected environment. For example, -Symfony2 comes with the WebProfilerBundle (described below), enabled only -in the ``dev`` and ``test`` environments. - .. _quick-tour-big-picture-environments: Working with Environments ------------------------- +Now that you have a better understanding of how Symfony2 works, take a closer +look at the bottom of any Symfony2 rendered page. You should notice a small +bar with the Symfony2 logo. This is the "Web Debug Toolbar", and it is a +Symfony2 developer's best friend. + +.. image:: /images/quick_tour/web_debug_toolbar.png + :align: center + +What you see initially is only the tip of the iceberg; click on the long +hexadecimal number (the session token) to reveal yet another very useful +Symfony2 debugging tool: the profiler. + +.. image:: /images/quick_tour/profiler.png + :align: center + +.. note:: + + You can also get more information quickly by hovering over the items + on the Web Debug Toolbar. + +When enabled (by default in the dev and test environments), the Profiler +records a great deal of information on each request made to your application. +It allows you to view details of each request, including, but not limited to, +GET or POST parameters and the request headers; logs; an execution timeline; +information on the currently logged in user; Doctrine queries; and more. + +Of course, it would be unwise to have these tools enabled when you deploy +your application, so by default, the profiler is not enabled in the ``prod`` +environment. (In fact, its bundle is not even loaded). + Symfony2 loads configuration based on the name of the environment. Typically, you put your common configuration in ``config.yml`` and override where necessary in the configuration for each environment. For example: @@ -444,18 +459,9 @@ In this example, the ``dev`` environment loads the ``config_dev.yml`` configurat file, which itself imports the global ``config.yml`` file and then modifies it by enabling the web debug toolbar. -To make your application respond faster, Symfony2 maintains a cache under the -``app/cache/`` directory. In the ``dev`` environment, this cache is flushed -automatically whenever you make changes to any code or configuration. But that's -not the case in the ``prod`` environment, where performance is key. That's why you -should always use the development environment when developing your application. +.. tip:: -Symfony2 comes with two web-accessible front controllers: ``app_dev.php`` -provides the ``dev`` environment, and ``app.php`` provides the ``prod`` environment. -All web accesses to Symfony2 normally go through one of these front controllers. -(The ``test`` environment is normally only used when running unit tests, and so -doesn't have a dedicated front controller. The console tool also provides a -front controller that can be used with any environment.) + For more details on environments, see ":ref:`Environments & Front Controllers`". The AcmeDemoBundle is normally only available in the dev environment, but if you were to add it (and its routes) to the production environment, you could @@ -491,42 +497,6 @@ even better looking URL: *AcmeDemoBundle* is enabled only in the dev environment and its routes imported from *app/config/routing_dev.yml*. -.. _quick-tour-big-picture-web-debug-toolbar: - -The Web Debug Toolbar and Profiler ----------------------------------- - - -Now that you have a better understanding of how Symfony2 works, take a closer -look at the bottom of any Symfony2 rendered page. You should notice a small -bar with the Symfony2 logo. This is the "Web Debug Toolbar", and it is a -Symfony2 developer's best friend. - -.. image:: /images/quick_tour/web_debug_toolbar.png - :align: center - -What you see initially is only the tip of the iceberg; click on the long -hexadecimal number (the session token) to reveal yet another very useful -Symfony2 debugging tool: the profiler. - -.. image:: /images/quick_tour/profiler.png - :align: center - -When enabled (by default in the dev and test environments), the Profiler -records a great deal of information on each request made to your application. -It allows you to view details of each request, including, but not limited to, -GET or POST parameters and the request headers; logs; an execution timeline; -information on the currently logged in user; Doctrine queries; and more. - -Of course, it would be unwise to have these tools enabled when you deploy -your application, so by default, the profiler is not enabled in the ``prod`` -environment. (In fact, its bundle is not even loaded). - -.. note:: - - You can get more information quickly by hovering over the items on the - Web Debug Toolbar. - Final Thoughts -------------- From 97eebea203f8774d1a5d08499b66e1be9c3d31c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Quatannens?= Date: Mon, 15 Jul 2013 13:54:15 +0200 Subject: [PATCH 0390/2078] Removing duplicate content The same content can be found at the end of the "Configuration and setup" section. I've removed the more recent content, and because I think the right place is in the "configuration" section. --- book/installation.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/book/installation.rst b/book/installation.rst index 4f1ad34198b..459c98a11f8 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -127,12 +127,6 @@ All public files and the front controller that handles incoming requests in a Symfony2 application live in the ``Symfony/web/`` directory. So, assuming you unpacked the archive into your web server's or virtual host's document root, your application's URLs will start with ``http://localhost/Symfony/web/``. -To get nice and short URLs you should point the document root of your web -server or virtual host to the ``Symfony/web/`` directory. Though this is not -required for development it is recommended when your application goes into -production as all system and configuration files become inaccessible to clients. -For information on configuring your specific web server document root, see -the following documentation: `Apache`_ | `Nginx`_ . .. note:: From 171be4e778dce41051152aa9df3b1c57831b5c29 Mon Sep 17 00:00:00 2001 From: c33s Date: Tue, 16 Jul 2013 20:15:09 +0200 Subject: [PATCH 0391/2078] fixed external link to form_div_layout.html.twig from 2.2 to 2.3 --- cookbook/form/form_customization.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index 0c316eff91c..f1585e0513d 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -948,4 +948,4 @@ customizations directly. Look at the following example: The array passed as the second argument contains form "variables". For more details about this concept in Twig, see :ref:`twig-reference-form-variables`. -.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/2.2/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/2.3/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig From 18f1a2e3f08f39fef99160881de55989fb4ba2b0 Mon Sep 17 00:00:00 2001 From: Alexey Bakulin Date: Tue, 25 Jun 2013 19:55:51 +0400 Subject: [PATCH 0392/2078] Fixed AcceptHeader use example --- components/http_foundation/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index f10dc557b07..03f018ef357 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -251,7 +251,7 @@ If you need to get full access to parsed data from ``Accept``, ``Accept-Language $accept = AcceptHeader::fromString($request->headers->get('Accept')); if ($accept->has('text/html')) { - $item = $accept->get('html'); + $item = $accept->get('text/html'); $charset = $item->getAttribute('charset', 'utf-8'); $quality = $item->getQuality(); } From f1483240e88722bb53b8d22bd479944ba48d8047 Mon Sep 17 00:00:00 2001 From: Joe Robles Date: Wed, 26 Jun 2013 15:57:38 -0500 Subject: [PATCH 0393/2078] Added node_paths /usr/lib/node_modules REQUIRED I was testing, testing and testing one and another method or posibility, until I reached that page: https://github.com/kriswallsmith/assetic/issues/185 that opened my eyes, and one value was missing: node_paths /usr/lib/node_modules I continously received: [exception] 500 | Internal Server Error | Assetic\Exception\FilterException [message] An error occurred while running: '/usr/bin/node' '/tmp/assetic_styluswWvcnS' Error Output: module.js:340 throw err; ^ Error: Cannot find module 'stylus' so, this fixes and finishes my 6 hours quest. --- cookbook/assetic/apply_to_option.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cookbook/assetic/apply_to_option.rst b/cookbook/assetic/apply_to_option.rst index 68558b2e3a1..a1e93b70c6b 100644 --- a/cookbook/assetic/apply_to_option.rst +++ b/cookbook/assetic/apply_to_option.rst @@ -9,8 +9,8 @@ as you'll see here, files that have a specific extension. To show you how to handle each option, let's suppose that you want to use Assetic's CoffeeScript filter, which compiles CoffeeScript files into Javascript. -The main configuration is just the paths to coffee and node. These default -respectively to ``/usr/bin/coffee`` and ``/usr/bin/node``: +The main configuration is just the paths to coffee, node and node_modules. These default +respectively to ``/usr/bin/coffee``, ``/usr/bin/node`` and ``/usr/lib/node_modules``: .. configuration-block:: @@ -22,6 +22,7 @@ respectively to ``/usr/bin/coffee`` and ``/usr/bin/node``: coffee: bin: /usr/bin/coffee node: /usr/bin/node + node_paths: [ /usr/lib/node_modules/ ] .. code-block:: xml @@ -30,7 +31,8 @@ respectively to ``/usr/bin/coffee`` and ``/usr/bin/node``: + node="/usr/bin/node" + node_paths="/usr/lib/node_modules/"/> .. code-block:: php @@ -41,6 +43,7 @@ respectively to ``/usr/bin/coffee`` and ``/usr/bin/node``: 'coffee' => array( 'bin' => '/usr/bin/coffee', 'node' => '/usr/bin/node', + 'node_paths' => '/usr/lib/node_modules/', ), ), )); @@ -128,6 +131,7 @@ applied to all ``.coffee`` files: coffee: bin: /usr/bin/coffee node: /usr/bin/node + node_paths: [ /usr/lib/node_modules/ ] apply_to: "\.coffee$" .. code-block:: xml @@ -138,6 +142,7 @@ applied to all ``.coffee`` files: name="coffee" bin="/usr/bin/coffee" node="/usr/bin/node" + node_paths="/usr/lib/node_modules/" apply_to="\.coffee$" /> @@ -149,6 +154,7 @@ applied to all ``.coffee`` files: 'coffee' => array( 'bin' => '/usr/bin/coffee', 'node' => '/usr/bin/node', + 'node_paths' => '/usr/lib/node_modules/', 'apply_to' => '\.coffee$', ), ), From 6fe451047cdda7fd737a9b85acee85fc35b15f2a Mon Sep 17 00:00:00 2001 From: Joe Robles Date: Thu, 27 Jun 2013 20:34:27 -0500 Subject: [PATCH 0394/2078] Updated for php array, pending review of xml --- cookbook/assetic/apply_to_option.rst | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cookbook/assetic/apply_to_option.rst b/cookbook/assetic/apply_to_option.rst index a1e93b70c6b..ab833cf4cdc 100644 --- a/cookbook/assetic/apply_to_option.rst +++ b/cookbook/assetic/apply_to_option.rst @@ -28,11 +28,12 @@ respectively to ``/usr/bin/coffee``, ``/usr/bin/node`` and ``/usr/lib/node_modul - + bin="/usr/bin/coffee/" + node="/usr/bin/node/"> + /usr/lib/node_modules/ + .. code-block:: php @@ -43,7 +44,7 @@ respectively to ``/usr/bin/coffee``, ``/usr/bin/node`` and ``/usr/lib/node_modul 'coffee' => array( 'bin' => '/usr/bin/coffee', 'node' => '/usr/bin/node', - 'node_paths' => '/usr/lib/node_modules/', + 'node_paths' => array('/usr/lib/node_modules/'), ), ), )); @@ -142,10 +143,10 @@ applied to all ``.coffee`` files: name="coffee" bin="/usr/bin/coffee" node="/usr/bin/node" - node_paths="/usr/lib/node_modules/" apply_to="\.coffee$" /> + /usr/lib/node_modules/ - + .. code-block:: php // app/config/config.php @@ -154,7 +155,7 @@ applied to all ``.coffee`` files: 'coffee' => array( 'bin' => '/usr/bin/coffee', 'node' => '/usr/bin/node', - 'node_paths' => '/usr/lib/node_modules/', + 'node_paths' => array('/usr/lib/node_modules/'), 'apply_to' => '\.coffee$', ), ), From fa6358635dae23b6465b192cebc7bb9ec0d0c1a7 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 17 Jul 2013 21:15:07 -0500 Subject: [PATCH 0395/2078] [#2775] Slight tweak because the node_paths actually has no default value --- cookbook/assetic/apply_to_option.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/assetic/apply_to_option.rst b/cookbook/assetic/apply_to_option.rst index ab833cf4cdc..b7a540aad71 100644 --- a/cookbook/assetic/apply_to_option.rst +++ b/cookbook/assetic/apply_to_option.rst @@ -9,8 +9,8 @@ as you'll see here, files that have a specific extension. To show you how to handle each option, let's suppose that you want to use Assetic's CoffeeScript filter, which compiles CoffeeScript files into Javascript. -The main configuration is just the paths to coffee, node and node_modules. These default -respectively to ``/usr/bin/coffee``, ``/usr/bin/node`` and ``/usr/lib/node_modules``: +The main configuration is just the paths to coffee, node and node_modules. +An example configuration might look like this: .. configuration-block:: From 465afe8087b1b2e635cf3d39886b761554270f34 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Thu, 27 Jun 2013 12:41:59 +0200 Subject: [PATCH 0396/2078] Mentioning the include of ocramius/proxy-manager for full-stack framework --- components/dependency_injection/lazy_services.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/dependency_injection/lazy_services.rst b/components/dependency_injection/lazy_services.rst index 88ad0c51f59..240ed227cc4 100644 --- a/components/dependency_injection/lazy_services.rst +++ b/components/dependency_injection/lazy_services.rst @@ -34,9 +34,13 @@ the `ProxyManager bridge`_: .. note:: - If you're using the full-stack framework, this package is not included - and needs to be added to ``composer.json`` and installed (which is what - the above command does). + If you're using the full-stack framework, the proxy manager bridge is already + included but the actual proxy manager needs to be included. Therefore add + + "ocramius/proxy-manager": ">=0.3.1,<0.4-dev" + + to your ``composer.json``. Afterwards compile your container and check if you + get a proxy for your lazy services. Configuration ------------- @@ -89,4 +93,4 @@ in the `documentation of ProxyManager`_. .. _`ProxyManager bridge`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bridge/ProxyManager .. _`proxy`: http://en.wikipedia.org/wiki/Proxy_pattern -.. _`documentation of ProxyManager`: https://github.com/Ocramius/ProxyManager/blob/master/docs/lazy-loading-value-holder.md \ No newline at end of file +.. _`documentation of ProxyManager`: https://github.com/Ocramius/ProxyManager/blob/master/docs/lazy-loading-value-holder.md From 00153ac95755e89c74b29337b3fc652c981e9749 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Sat, 29 Jun 2013 10:29:31 +0200 Subject: [PATCH 0397/2078] Updated to version 0.4.x and added code-block --- components/dependency_injection/lazy_services.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/dependency_injection/lazy_services.rst b/components/dependency_injection/lazy_services.rst index 240ed227cc4..3279c627f56 100644 --- a/components/dependency_injection/lazy_services.rst +++ b/components/dependency_injection/lazy_services.rst @@ -37,7 +37,11 @@ the `ProxyManager bridge`_: If you're using the full-stack framework, the proxy manager bridge is already included but the actual proxy manager needs to be included. Therefore add - "ocramius/proxy-manager": ">=0.3.1,<0.4-dev" + .. code-block:: json + + "require": { + "ocramius/proxy-manager": "0.4.*" + } to your ``composer.json``. Afterwards compile your container and check if you get a proxy for your lazy services. From 9abf823004ec00d0bdbc0ff0e6eb74dfd6dd5a81 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Sat, 29 Jun 2013 14:02:02 +0200 Subject: [PATCH 0398/2078] Added information about how to test if lazy loaded services are working --- components/dependency_injection/lazy_services.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/dependency_injection/lazy_services.rst b/components/dependency_injection/lazy_services.rst index 3279c627f56..a0e8a800b24 100644 --- a/components/dependency_injection/lazy_services.rst +++ b/components/dependency_injection/lazy_services.rst @@ -79,6 +79,14 @@ the same signature of the class representing the service. You can also inject the service just like normal into other services. The object that's actually injected will be the proxy. +To check if your proxy works you can simply check the interface of the +received object. + + var_dump(class_implements($service)); + +If the class implements the ProxyManager\Proxy\LazyLoadingInterface your lazy +loaded services will work as expected. + .. note:: If you don't install the `ProxyManager bridge`_, the container will just From 89f0a81117c0d4af0edf3ba739d19ee7cddba6ee Mon Sep 17 00:00:00 2001 From: peterrehm Date: Sat, 29 Jun 2013 14:02:59 +0200 Subject: [PATCH 0399/2078] Added php code block --- components/dependency_injection/lazy_services.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/dependency_injection/lazy_services.rst b/components/dependency_injection/lazy_services.rst index a0e8a800b24..3c8cb53f10d 100644 --- a/components/dependency_injection/lazy_services.rst +++ b/components/dependency_injection/lazy_services.rst @@ -82,7 +82,8 @@ injected will be the proxy. To check if your proxy works you can simply check the interface of the received object. - var_dump(class_implements($service)); + .. code-block:: php + var_dump(class_implements($service)); If the class implements the ProxyManager\Proxy\LazyLoadingInterface your lazy loaded services will work as expected. From 9b8cbf438f3802cc107270b17d206f47530845e6 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Sat, 29 Jun 2013 15:46:44 +0200 Subject: [PATCH 0400/2078] Updated formatting --- components/dependency_injection/lazy_services.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/dependency_injection/lazy_services.rst b/components/dependency_injection/lazy_services.rst index 3c8cb53f10d..e0bdbd6c9a5 100644 --- a/components/dependency_injection/lazy_services.rst +++ b/components/dependency_injection/lazy_services.rst @@ -82,10 +82,11 @@ injected will be the proxy. To check if your proxy works you can simply check the interface of the received object. - .. code-block:: php - var_dump(class_implements($service)); +.. code-block:: php + + var_dump(class_implements($service)); -If the class implements the ProxyManager\Proxy\LazyLoadingInterface your lazy +If the class implements the "ProxyManager\Proxy\LazyLoadingInterface" your lazy loaded services will work as expected. .. note:: From a5a1b164f1cf1219b0c081e5df2f535ada8f6243 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 17 Jul 2013 21:20:52 -0500 Subject: [PATCH 0401/2078] [#2778] Small language tweaks! --- components/dependency_injection/lazy_services.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/dependency_injection/lazy_services.rst b/components/dependency_injection/lazy_services.rst index e0bdbd6c9a5..8f80997777b 100644 --- a/components/dependency_injection/lazy_services.rst +++ b/components/dependency_injection/lazy_services.rst @@ -43,8 +43,8 @@ the `ProxyManager bridge`_: "ocramius/proxy-manager": "0.4.*" } - to your ``composer.json``. Afterwards compile your container and check if you - get a proxy for your lazy services. + to your ``composer.json``. Afterwards compile your container and check + to make sure that you get a proxy for your lazy services. Configuration ------------- @@ -87,7 +87,7 @@ received object. var_dump(class_implements($service)); If the class implements the "ProxyManager\Proxy\LazyLoadingInterface" your lazy -loaded services will work as expected. +loaded services are working. .. note:: From 83d2de8b9db3d1e66b7c50348f784b7749116551 Mon Sep 17 00:00:00 2001 From: Sebastian Grodzicki Date: Fri, 28 Jun 2013 20:55:51 +0200 Subject: [PATCH 0402/2078] Meet PSR-2 visibility requirements --- cookbook/security/voters.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cookbook/security/voters.rst b/cookbook/security/voters.rst index f4d93ce6011..1db4a93d264 100644 --- a/cookbook/security/voters.rst +++ b/cookbook/security/voters.rst @@ -25,9 +25,9 @@ which requires the following three methods: interface VoterInterface { - function supportsAttribute($attribute); - function supportsClass($class); - function vote(TokenInterface $token, $object, array $attributes); + public function supportsAttribute($attribute); + public function supportsClass($class); + public function vote(TokenInterface $token, $object, array $attributes); } The ``supportsAttribute()`` method is used to check if the voter supports @@ -85,7 +85,7 @@ and compare the IP address against a set of blacklisted IP addresses: return true; } - function vote(TokenInterface $token, $object, array $attributes) + public function vote(TokenInterface $token, $object, array $attributes) { $request = $this->container->get('request'); if (in_array($request->getClientIp(), $this->blacklistedIp)) { From c556752d3e04e53d946887ef07bdc6148e14b7ff Mon Sep 17 00:00:00 2001 From: Sebastian Grodzicki Date: Fri, 28 Jun 2013 21:04:33 +0200 Subject: [PATCH 0403/2078] Required parameter $property missing --- reference/constraints/UniqueEntity.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index 27c0204c7a8..06249efc636 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -99,7 +99,7 @@ table: 'message' => 'This email already exists.', ))); - $metadata->addPropertyConstraint(new Assert\Email()); + $metadata->addPropertyConstraint('email', new Assert\Email()); } } From 41f8ff4d872cb499760fcfda15a9d2c82264db14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Chy=C5=82ek?= Date: Sat, 29 Jun 2013 20:27:02 +0200 Subject: [PATCH 0404/2078] Change Polish documentation repository --- contributing/documentation/translations.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing/documentation/translations.rst b/contributing/documentation/translations.rst index 937f5e87a82..5787e773c5e 100644 --- a/contributing/documentation/translations.rst +++ b/contributing/documentation/translations.rst @@ -20,7 +20,7 @@ for. Here is the list of the official *master* repositories: * *French*: https://github.com/symfony-fr/symfony-docs-fr * *Italian*: https://github.com/garak/symfony-docs-it * *Japanese*: https://github.com/symfony-japan/symfony-docs-ja -* *Polish*: https://github.com/ampluso/symfony-docs-pl +* *Polish*: https://github.com/symfony-docs-pl/symfony-docs-pl * *Portuguese (Brazilian)*: https://github.com/andreia/symfony-docs-pt-BR * *Spanish*: https://github.com/gitnacho/symfony-docs-es From 80046ce090b1746b7db0e31423a11f20a6d4daf2 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 29 Jun 2013 20:30:07 +0200 Subject: [PATCH 0405/2078] Documented service name conventions --- contributing/code/standards.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/contributing/code/standards.rst b/contributing/code/standards.rst index 88106afb078..4f8c858931b 100644 --- a/contributing/code/standards.rst +++ b/contributing/code/standards.rst @@ -134,6 +134,16 @@ Naming Conventions * Don't forget to look at the more verbose :doc:`conventions` document for more subjective naming considerations. +Service Naming Conventions +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* A service name contains groups, seperated by dots; +* The DI alias of the bundle is the first group (e.g. ``fos_user``); +* Use lowercase letters for service and parameter names; +* A group name uses the underscore notation; +* Each service has a coresponding parameter containing the class name, + following the ``%service name%.class`` convention. + Documentation ------------- From 30ce181600ad20481bd882fb7380048b1afbebaf Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 17 Jul 2013 21:37:39 -0500 Subject: [PATCH 0406/2078] [#2782] Fixing a few typos --- contributing/code/standards.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contributing/code/standards.rst b/contributing/code/standards.rst index 4f8c858931b..49f92b77035 100644 --- a/contributing/code/standards.rst +++ b/contributing/code/standards.rst @@ -137,12 +137,12 @@ Naming Conventions Service Naming Conventions ~~~~~~~~~~~~~~~~~~~~~~~~~~ -* A service name contains groups, seperated by dots; +* A service name contains groups, separated by dots; * The DI alias of the bundle is the first group (e.g. ``fos_user``); * Use lowercase letters for service and parameter names; * A group name uses the underscore notation; -* Each service has a coresponding parameter containing the class name, - following the ``%service name%.class`` convention. +* Each service has a corresponding parameter containing the class name, + following the ``SERVICE NAME.class`` convention. Documentation ------------- From 76a19dd5b36bd8616ce7ebe992a29bc5cdd20728 Mon Sep 17 00:00:00 2001 From: Douglas Greenshields Date: Mon, 1 Jul 2013 10:26:57 +0100 Subject: [PATCH 0407/2078] small grammar fix --- cookbook/controller/service.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/controller/service.rst b/cookbook/controller/service.rst index 69f6bf19c49..96a2d755265 100644 --- a/cookbook/controller/service.rst +++ b/cookbook/controller/service.rst @@ -257,7 +257,7 @@ inject *only* the exact service(s) that you need directly into the controller. This does not mean that you cannot extend these controllers from your own base controller. The move away from the standard base controller is because - its helper method rely on having the container available which is not + its helper methods rely on having the container available which is not the case for controllers that are defined as services. It may be a good idea to extract common code into a service that's injected rather than place that code into a base controller that you extend. Both approaches @@ -265,4 +265,4 @@ inject *only* the exact service(s) that you need directly into the controller. you. .. _`Controller class source code`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php -.. _`base Controller class`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php \ No newline at end of file +.. _`base Controller class`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php From 83f703828e7fa9d9245727728e37b23c941dec66 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 1 Jul 2013 16:55:05 +0200 Subject: [PATCH 0408/2078] Fixed a minor XML typo --- book/forms.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/forms.rst b/book/forms.rst index 2d334bf415d..5a71b220b37 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -329,7 +329,7 @@ object. \DateTime - + .. code-block:: php From 16e557750186fe690a8af61a1cb47742d8da2d05 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 17 Jul 2013 21:48:15 -0500 Subject: [PATCH 0409/2078] [#2793] Tweaking language and removing unnecessary command argument per @stof --- cookbook/console/console_command.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cookbook/console/console_command.rst b/cookbook/console/console_command.rst index 3a251784b51..83033761feb 100644 --- a/cookbook/console/console_command.rst +++ b/cookbook/console/console_command.rst @@ -106,7 +106,6 @@ instead of $commandTester = new CommandTester($command); $commandTester->execute( array( - 'command' => $command->getName(), 'name' => 'Fabien', '--yell' => true, ) @@ -120,8 +119,9 @@ instead of .. note:: - In the specific case above, the ``name`` parameter and the ``--yell`` option are not - mandatory for the command to work well, but they are shown for the example. + In the specific case above, the ``name`` parameter and the ``--yell`` option + are not mandatory for the command to work, but are shown so you can see + how to customize them when calling the command. To be able to use the fully set up service container for your console tests you can extend your test from @@ -146,7 +146,6 @@ you can extend your test from $commandTester = new CommandTester($command); $commandTester->execute( array( - 'command' => $command->getName(), 'name' => 'Fabien', '--yell' => true, ) From 106a73bf1804d43d69cce409f6b526277fcb06a9 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 3 Jul 2013 15:37:21 +0300 Subject: [PATCH 0410/2078] Little typo in assert annotations Missing comma in annotation provokes an exception "[Syntax Error] Expected Doctrine\Common\Annotations\DocLexer::T_CLOSE_CURLY_BRACES..." --- reference/constraints/All.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/constraints/All.rst b/reference/constraints/All.rst index d270fa0d4d6..89cf5669594 100644 --- a/reference/constraints/All.rst +++ b/reference/constraints/All.rst @@ -44,8 +44,8 @@ entry in that array: { /** * @Assert\All({ - * @Assert\NotBlank - * @Assert\Length(min = "5"), + * @Assert\NotBlank, + * @Assert\Length(min = "5") * }) */ protected $favoriteColors = array(); From 682052f989a73f35ed6034f053b93c109cdc0704 Mon Sep 17 00:00:00 2001 From: Diego Saint Esteben Date: Fri, 5 Jul 2013 10:43:02 -0300 Subject: [PATCH 0411/2078] Fixed typo | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | master | Fixed tickets | - --- components/dependency_injection/definitions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dependency_injection/definitions.rst b/components/dependency_injection/definitions.rst index 100da379123..2b1dbac6d43 100644 --- a/components/dependency_injection/definitions.rst +++ b/components/dependency_injection/definitions.rst @@ -66,7 +66,7 @@ To get an array of the constructor arguments for a definition you can use:: or to get a single argument by its position:: $definition->getArgument($index); - //e.g. $definition->getArguments(0) for the first argument + //e.g. $definition->getArgument(0) for the first argument You can add a new argument to the end of the arguments array using:: From 202171b6b0cce944be477cbf99b160b1fb986dd8 Mon Sep 17 00:00:00 2001 From: John Bafford Date: Thu, 18 Jul 2013 21:31:54 -0400 Subject: [PATCH 0412/2078] Changes for correctness --- book/page_creation.rst | 14 ++++++++------ quick_tour/the_big_picture.rst | 21 ++++++++++++--------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/book/page_creation.rst b/book/page_creation.rst index 3250094d68c..b037cfd5224 100644 --- a/book/page_creation.rst +++ b/book/page_creation.rst @@ -42,12 +42,6 @@ also load specific bundles based on the selected environment. For example, Symfony2 comes with the WebProfilerBundle (described below), enabled only in the ``dev`` and ``test`` environments. -To make your application respond faster, Symfony2 maintains a cache under the -``app/cache/`` directory. In the ``dev`` environment, this cache is flushed -automatically whenever you make changes to any code or configuration. But that's -not the case in the ``prod`` environment, where performance is key. That's why you -should always use the development environment when developing your application. - Symfony2 comes with two web-accessible front controllers: ``app_dev.php`` provides the ``dev`` environment, and ``app.php`` provides the ``prod`` environment. All web accesses to Symfony2 normally go through one of these front controllers. @@ -55,6 +49,14 @@ All web accesses to Symfony2 normally go through one of these front controllers. doesn't have a dedicated front controller. The console tool also provides a front controller that can be used with any environment.) +When the front controller initializes the kernel, it provides two parameters: +the environment, and also whether the kernel should run in debug mode. +To make your application respond faster, Symfony2 maintains a cache under the +``app/cache/`` directory. When in debug mode is enabled (such as ``app_dev.php`` +does by default), this cache is flushed automatically whenever you make changes +to any code or configuration. When running in debug mode, Symfony2 runs +slower, but your changes are reflected without having to manually clear the +cache. .. index:: single: Page creation; Example diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index f72200e6b29..eb0db4aa602 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -419,7 +419,7 @@ Symfony2 developer's best friend. .. image:: /images/quick_tour/web_debug_toolbar.png :align: center -What you see initially is only the tip of the iceberg; click on the long +What you see initially is only the tip of the iceberg; click on the hexadecimal number (the session token) to reveal yet another very useful Symfony2 debugging tool: the profiler. @@ -429,14 +429,17 @@ Symfony2 debugging tool: the profiler. .. note:: You can also get more information quickly by hovering over the items - on the Web Debug Toolbar. - -When enabled (by default in the dev and test environments), the Profiler -records a great deal of information on each request made to your application. -It allows you to view details of each request, including, but not limited to, -GET or POST parameters and the request headers; logs; an execution timeline; -information on the currently logged in user; Doctrine queries; and more. - + on the Web Debug Toolbar, or clicking them to go to their respective + pages in the profiler. + +When loaded (by default in the dev and test environments), and enabled +(by default, only in the dev environment) the Profiler provides an interface +to view a great deal of information recorded on each request made to your +application. It allows you to view details of each request, including, but +not limited to, GET or POST parameters and the request headers; logs; an +execution timeline; information on the currently logged in user; Doctrine +queries; and more. + Of course, it would be unwise to have these tools enabled when you deploy your application, so by default, the profiler is not enabled in the ``prod`` environment. (In fact, its bundle is not even loaded). From 34da94e949656cc9aaec5d858f82fca92708bbc1 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 18 Jul 2013 21:43:37 -0500 Subject: [PATCH 0413/2078] Fixing old render syntax thanks to @oscherler --- book/templating.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index 4aea82e0de2..40990c1dbcf 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -677,13 +677,15 @@ Asynchronous Content with hinclude.js Controllers can be embedded asynchronously using the hinclude.js_ javascript library. As the embedded content comes from another page (or controller for that matter), -Symfony2 uses the standard ``render`` helper to configure ``hinclude`` tags: +Symfony2 uses a version of the standard ``render`` function to configure ``hinclude`` +tags: .. configuration-block:: .. code-block:: jinja - {% render url('...') with {}, {'standalone': 'js'} %} + {{ render_hinclude(controller('...')) %} + {{ render_hinclude(url('...')) %} .. code-block:: php From 4eeec12fa9509ab0d2488791aed98591480c2b13 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 18 Jul 2013 21:56:35 -0500 Subject: [PATCH 0414/2078] [#2832][#2775] Slight fix thanks to @WouterJ --- cookbook/assetic/apply_to_option.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/assetic/apply_to_option.rst b/cookbook/assetic/apply_to_option.rst index b7a540aad71..60d9829b3a6 100644 --- a/cookbook/assetic/apply_to_option.rst +++ b/cookbook/assetic/apply_to_option.rst @@ -32,7 +32,7 @@ An example configuration might look like this: name="coffee" bin="/usr/bin/coffee/" node="/usr/bin/node/"> - /usr/lib/node_modules/ + /usr/lib/node_modules/ From 13f57a2967360e45efa4a27e421b36152af2cef0 Mon Sep 17 00:00:00 2001 From: alcaeus Date: Wed, 19 Jun 2013 19:14:36 +0200 Subject: [PATCH 0415/2078] [fixed] Fixed example code so that custom authentication providers only clear their own tokens --- cookbook/security/custom_authentication_provider.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cookbook/security/custom_authentication_provider.rst b/cookbook/security/custom_authentication_provider.rst index fb676007b89..0625bf48e56 100644 --- a/cookbook/security/custom_authentication_provider.rst +++ b/cookbook/security/custom_authentication_provider.rst @@ -144,7 +144,11 @@ set an authenticated token in the security context if successful. // ... you might log something here // To deny the authentication clear the token. This will redirect to the login page. - // $this->securityContext->setToken(null); + // Make sure to only clear your token, not those of other authentication listeners. + // $token = $this->securityContext->getToken(); + // if ($token instanceof WsseUserToken && $this->providerKey === $token->getProviderKey()) { + // $this->securityContext->setToken(null); + // } // return; // Deny authentication with a '403 Forbidden' HTTP response From d86e61ec6ed20860c7cd55db27c30e77ddfd216a Mon Sep 17 00:00:00 2001 From: John Bafford Date: Fri, 19 Jul 2013 19:25:38 -0400 Subject: [PATCH 0416/2078] Fix doubled words --- book/templating.rst | 2 +- components/dependency_injection/advanced.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index 40990c1dbcf..787e4aad46f 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -1401,7 +1401,7 @@ Debugging When using PHP, you can use ``var_dump()`` if you need to quickly find the value of a variable passed. This is useful, for example, inside your controller. -The same can be achieved when using Twig thanks to the the debug extension. +The same can be achieved when using Twig thanks to the debug extension. Template parameters can then be dumped using the ``dump`` function: diff --git a/components/dependency_injection/advanced.rst b/components/dependency_injection/advanced.rst index 4766bc8011e..7bed45e2021 100644 --- a/components/dependency_injection/advanced.rst +++ b/components/dependency_injection/advanced.rst @@ -66,7 +66,7 @@ Synthetic services are services that are injected into the container instead of being created by the container. For example, if you're using the :doc:`HttpKernel` -component with the DependencyInjection component, then the the ``request`` +component with the DependencyInjection component, then the ``request`` service is injected in the :method:`ContainerAwareHttpKernel::handle() ` method when entering the request :doc:`scope `. From da6c3fd25812ebc0b4e9a6ac1a07d9f0fa512848 Mon Sep 17 00:00:00 2001 From: Diego Saint Esteben Date: Sat, 20 Jul 2013 16:48:15 -0300 Subject: [PATCH 0417/2078] New ANSICON link --- components/console/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 8661df71ea1..fa7344c7826 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -486,4 +486,4 @@ Learn More! * :doc:`/components/console/single_command_tool` .. _Packagist: https://packagist.org/packages/symfony/console -.. _ANSICON: http://adoxa.3eeweb.com/ansicon/ +.. _ANSICON: https://github.com/adoxa/ansicon/downloads From 3bc15b7f2f3d5815ad57164d07ca37c96ada77e7 Mon Sep 17 00:00:00 2001 From: Markus Lanthaler Date: Mon, 8 Jul 2013 15:10:53 +0200 Subject: [PATCH 0418/2078] Fix typo --- components/dependency_injection/advanced.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dependency_injection/advanced.rst b/components/dependency_injection/advanced.rst index 4766bc8011e..7bed45e2021 100644 --- a/components/dependency_injection/advanced.rst +++ b/components/dependency_injection/advanced.rst @@ -66,7 +66,7 @@ Synthetic services are services that are injected into the container instead of being created by the container. For example, if you're using the :doc:`HttpKernel` -component with the DependencyInjection component, then the the ``request`` +component with the DependencyInjection component, then the ``request`` service is injected in the :method:`ContainerAwareHttpKernel::handle() ` method when entering the request :doc:`scope `. From c06ccf97c18218685b5f090fb0bdf10706473654 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 9 Jul 2013 17:21:56 +0200 Subject: [PATCH 0419/2078] Update service_container_parameters.rst --- cookbook/routing/service_container_parameters.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cookbook/routing/service_container_parameters.rst b/cookbook/routing/service_container_parameters.rst index d7dbd5a6199..29edf772c1c 100644 --- a/cookbook/routing/service_container_parameters.rst +++ b/cookbook/routing/service_container_parameters.rst @@ -119,3 +119,7 @@ path): Just like in normal service container configuration files, if you actually need a ``%`` in your route, you can escape the percent sign by doubling it, e.g. ``/score-50%%``, which would resolve to ``/score-50%``. + + However, as the ``%`` characters included in any URL are automatically encoded, + the resulting URL of this example would be ``/score-50%25`` (``%25`` is the + result of encoding the ``%`` character). From ad2501ad446e223bdb677d175da4aaa7576c2adb Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Tue, 9 Jul 2013 23:42:11 -0500 Subject: [PATCH 0420/2078] better grammar --- book/templating.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/templating.rst b/book/templating.rst index 40990c1dbcf..269f2757750 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -6,7 +6,7 @@ Creating and using Templates As you know, the :doc:`controller ` is responsible for handling each request that comes into a Symfony2 application. In reality, -the controller delegates the most of the heavy work to other places so that +the controller delegates most of the heavy work to other places so that code can be tested and reused. When a controller needs to generate HTML, CSS or any other content, it hands the work off to the templating engine. In this chapter, you'll learn how to write powerful templates that can be From 6e5b8ef40451037f82c72f14f6a76c5a89f9dce4 Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Wed, 10 Jul 2013 00:17:00 -0500 Subject: [PATCH 0421/2078] a bit of indentation --- book/templating.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index 269f2757750..71524b70e30 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -204,10 +204,10 @@ First, build a base layout file:

From cac7c2e94e73d169620cd9b2c094017023256c0c Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Wed, 10 Jul 2013 00:43:10 -0500 Subject: [PATCH 0422/2078] moving reference from debugging to templating formats to fix problem with note giving wrong link --- book/templating.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index 71524b70e30..e53d08a8b47 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -1394,8 +1394,6 @@ in a JavaScript string, use the ``js`` context: .. index:: single: Templating; Formats -.. _template-formats: - Debugging --------- @@ -1440,6 +1438,8 @@ console command: # or using the bundle name: $ php app/console twig:lint @AcmeArticleBundle +.. _template-formats: + Template Formats ---------------- From cf952da9a77947b16d00c8ca8ca8ee83d1cac99f Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Wed, 10 Jul 2013 01:00:36 -0500 Subject: [PATCH 0423/2078] clarification difference between function and tag includes --- book/templating.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index e53d08a8b47..16cc9af84d9 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -561,8 +561,10 @@ Including this template from any other template is simple: The template is included using the ``{{ include() }}`` function. Notice that the template name follows the same typical convention. The ``articleDetails.html.twig`` -template uses an ``article`` variable. This is passed in by the ``list.html.twig`` -template using the ``with`` command. +template uses an ``article`` variable. This could be passed in by the ``list.html.twig`` +template using the ``with`` command supported on a twig ``include`` tag. In this +case however, we opt to use the twig ``include`` function which passes context automatically +and passes also optional hashes. .. tip:: From 08f682ea12cfab204c46ffa77a4952215b1a4ca6 Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Wed, 10 Jul 2013 08:23:39 -0500 Subject: [PATCH 0424/2078] update according to stofs comments --- book/templating.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index 16cc9af84d9..0faacdf72c6 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -563,8 +563,8 @@ The template is included using the ``{{ include() }}`` function. Notice that the template name follows the same typical convention. The ``articleDetails.html.twig`` template uses an ``article`` variable. This could be passed in by the ``list.html.twig`` template using the ``with`` command supported on a twig ``include`` tag. In this -case however, we opt to use the twig ``include`` function which passes context automatically -and passes also optional hashes. +case however, we chose to use the twig ``include`` function which also passes context +by default and passes also optional hashes however without the need for a ``with`` keyword. .. tip:: From d1ca623223e38336861b1d66e2c2b69ab325b0f5 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 20 Jul 2013 15:21:16 -0500 Subject: [PATCH 0425/2078] [#2813] Tweaks to explaining how variables are passed into included templates and making references to older include tag easier to get more information about --- book/templating.rst | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index 0faacdf72c6..3482976789b 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -561,10 +561,10 @@ Including this template from any other template is simple: The template is included using the ``{{ include() }}`` function. Notice that the template name follows the same typical convention. The ``articleDetails.html.twig`` -template uses an ``article`` variable. This could be passed in by the ``list.html.twig`` -template using the ``with`` command supported on a twig ``include`` tag. In this -case however, we chose to use the twig ``include`` function which also passes context -by default and passes also optional hashes however without the need for a ``with`` keyword. +template uses an ``article`` variable, which we pass to it. In this case, +you could avoid doing this entirely, as all of the variables available in +``list.html.twig`` are also available in ``articleDetails.html.twig`` (unless +you set `with_context`_ to false). .. tip:: @@ -573,8 +573,9 @@ by default and passes also optional hashes however without the need for a ``with elements, it would look like this: ``{'foo': foo, 'bar': bar}``. .. versionadded:: 2.2 - The ``include()`` function is a new Twig feature that's available in - Symfony 2.2. Prior, the ``{% include %}`` tag was used. + The `include()`_ function is a new Twig feature + that's available in Symfony 2.2. Prior, the `{% include %}`_ + tag was used. .. index:: single: Templating; Embedding action @@ -1537,3 +1538,5 @@ Learn more from the Cookbook .. _`filters`: http://twig.sensiolabs.org/doc/filters/index.html .. _`add your own extensions`: http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension .. _`hinclude.js`: http://mnot.github.com/hinclude/ +.. _`twig_include_function`: http://twig.sensiolabs.org/doc/functions/include.html +.. _`twig_include_tag`: http://twig.sensiolabs.org/doc/tags/include.html \ No newline at end of file From 5c0e52c22e93902322e9f9fbe6dd232b1a5b7465 Mon Sep 17 00:00:00 2001 From: John Kary Date: Thu, 11 Jul 2013 11:56:47 -0500 Subject: [PATCH 0426/2078] EventDispatch implements the Mediator pattern, not the Observer pattern --- components/event_dispatcher/introduction.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/event_dispatcher/introduction.rst b/components/event_dispatcher/introduction.rst index f5087431642..6e5f5a88600 100644 --- a/components/event_dispatcher/introduction.rst +++ b/components/event_dispatcher/introduction.rst @@ -20,7 +20,7 @@ or after a method is executed, without interfering with other plugins. This is not an easy problem to solve with single inheritance, and multiple inheritance (were it possible with PHP) has its own drawbacks. -The Symfony2 Event Dispatcher component implements the `Observer`_ pattern in +The Symfony2 Event Dispatcher component implements the `Mediator`_ pattern in a simple and effective way to make all these things possible and to make your projects truly extensible. @@ -597,7 +597,7 @@ part of the listener's processing logic:: } } -.. _Observer: http://en.wikipedia.org/wiki/Observer_pattern +.. _Mediator: http://en.wikipedia.org/wiki/Mediator_pattern .. _Closures: http://php.net/manual/en/functions.anonymous.php .. _PHP callable: http://www.php.net/manual/en/language.pseudo-types.php#language.types.callback .. _Packagist: https://packagist.org/packages/symfony/event-dispatcher From 401e518c5b17bf9a5b228ad882e60dbc2a2667f7 Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Thu, 11 Jul 2013 22:26:23 -0500 Subject: [PATCH 0427/2078] some corrections --- book/doctrine.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index c6b98b75228..b19b6e290a3 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -960,7 +960,7 @@ To relate the ``Category`` and ``Product`` entities, start by creating a @@ -988,7 +988,7 @@ makes sense in the application for each ``Category`` to hold an array of .. tip:: The targetEntity value in the decorator used above can reference any entity - with a valid namespace, not just entities defined in the same class. To + with a valid namespace, not just entities defined in the same namespace. To relate to an entity defined in a different class or bundle, enter a full namespace as the targetEntity. @@ -1038,7 +1038,8 @@ object, you'll want to add a ``$category`` property to the ``Product`` class: Date: Thu, 11 Jul 2013 22:47:54 -0500 Subject: [PATCH 0428/2078] improvements and typos --- book/doctrine.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index b19b6e290a3..dfa06d4e247 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -1206,14 +1206,14 @@ to the given ``Category`` object via their ``category_id`` value. The proxy classes are generated by Doctrine and stored in the cache directory. And though you'll probably never even notice that your ``$category`` - object is actually a proxy object, it's important to keep in mind. + object is actually a proxy object, it's important to keep it in mind. In the next section, when you retrieve the product and category data all at once (via a *join*), Doctrine will return the *true* ``Category`` object, since nothing needs to be lazily loaded. -Joining to Related Records -~~~~~~~~~~~~~~~~~~~~~~~~~~ +Joining Related Records +~~~~~~~~~~~~~~~~~~~~~~~ In the above examples, two queries were made - one for the original object (e.g. a ``Category``) and one for the related object(s) (e.g. the ``Product`` @@ -1305,7 +1305,7 @@ callbacks. This is not necessary if you're using YAML or XML for your mapping: } Now, you can tell Doctrine to execute a method on any of the available lifecycle -events. For example, suppose you want to set a ``created`` date column to +events. For example, suppose you want to set a ``createdAt`` date column to the current date, only when the entity is first persisted (i.e. inserted): .. configuration-block:: @@ -1315,9 +1315,9 @@ the current date, only when the entity is first persisted (i.e. inserted): /** * @ORM\PrePersist */ - public function setCreatedValue() + public function setCreatedAtValue() { - $this->created = new \DateTime(); + $this->createdAt = new \DateTime(); } .. code-block:: yaml @@ -1327,7 +1327,7 @@ the current date, only when the entity is first persisted (i.e. inserted): type: entity # ... lifecycleCallbacks: - prePersist: [setCreatedValue] + prePersist: [setCreatedAtValue] .. code-block:: xml @@ -1340,18 +1340,18 @@ the current date, only when the entity is first persisted (i.e. inserted): + method="setCreatedAtValue" /> .. note:: - The above example assumes that you've created and mapped a ``created`` + The above example assumes that you've created and mapped a ``createdAt`` property (not shown here). Now, right before the entity is first persisted, Doctrine will automatically -call this method and the ``created`` field will be set to the current date. +call this method and the ``createdAt`` field will be set to the current date. This can be repeated for any of the other lifecycle events, which include: From 2c9f14cf3edc5c458e96c894bef94edae90e8b2c Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Thu, 11 Jul 2013 22:57:02 -0500 Subject: [PATCH 0429/2078] updates various --- book/doctrine.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index dfa06d4e247..a91c3368f7c 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -1369,7 +1369,7 @@ in general, see Doctrine's `Lifecycle Events documentation`_ .. sidebar:: Lifecycle Callbacks and Event Listeners - Notice that the ``setCreatedValue()`` method receives no arguments. This + Notice that the ``setCreatedAtValue()`` method receives no arguments. This is always the case for lifecycle callbacks and is intentional: lifecycle callbacks should be simple methods that are concerned with internally transforming data in the entity (e.g. setting a created/updated field, From 8d60db50a0f9651ebe5bd7483ee35a6d85265a6f Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Fri, 12 Jul 2013 08:59:21 -0500 Subject: [PATCH 0430/2078] some typos --- book/propel.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/propel.rst b/book/propel.rst index 8fb113b88d9..0fae0621b22 100644 --- a/book/propel.rst +++ b/book/propel.rst @@ -353,7 +353,7 @@ Create the classes: $ php app/console propel:model:build -Assuming you have products in your database, you don't want lose them. Thanks to +Assuming you have products in your database, you don't want tp lose them. Thanks to migrations, Propel will be able to update your database without losing existing data. @@ -362,7 +362,7 @@ data. $ php app/console propel:migration:generate-diff $ php app/console propel:migration:migrate -Your database has been updated, you can continue to write your application. +Your database has been updated, you can continue writing your application. Saving Related Objects ~~~~~~~~~~~~~~~~~~~~~~ From e862ef6f3ef88219f1fbbfd9597501ad2169386a Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Fri, 12 Jul 2013 09:00:31 -0500 Subject: [PATCH 0431/2078] Update propel.rst --- book/propel.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/propel.rst b/book/propel.rst index 0fae0621b22..900d0d81847 100644 --- a/book/propel.rst +++ b/book/propel.rst @@ -353,7 +353,7 @@ Create the classes: $ php app/console propel:model:build -Assuming you have products in your database, you don't want tp lose them. Thanks to +Assuming you have products in your database, you don't want to lose them. Thanks to migrations, Propel will be able to update your database without losing existing data. From 2d25811719eaa280363194e6fceba37ae7da93ae Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 20 Jul 2013 15:51:50 -0500 Subject: [PATCH 0432/2078] Fixing some syntax errors I caused --- book/templating.rst | 12 ++++++------ reference/constraints/UniqueEntity.rst | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index 3482976789b..e6da2dc2a98 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -564,7 +564,7 @@ template name follows the same typical convention. The ``articleDetails.html.twi template uses an ``article`` variable, which we pass to it. In this case, you could avoid doing this entirely, as all of the variables available in ``list.html.twig`` are also available in ``articleDetails.html.twig`` (unless -you set `with_context`_ to false). +you set `with_context`_ to false). .. tip:: @@ -573,9 +573,8 @@ you set `with_context`_ to false). elements, it would look like this: ``{'foo': foo, 'bar': bar}``. .. versionadded:: 2.2 - The `include()`_ function is a new Twig feature - that's available in Symfony 2.2. Prior, the `{% include %}`_ - tag was used. + The `include() function`_ is a new Twig feature that's available in Symfony + 2.2. Prior, the `{% include %} tag`_ tag was used. .. index:: single: Templating; Embedding action @@ -1538,5 +1537,6 @@ Learn more from the Cookbook .. _`filters`: http://twig.sensiolabs.org/doc/filters/index.html .. _`add your own extensions`: http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension .. _`hinclude.js`: http://mnot.github.com/hinclude/ -.. _`twig_include_function`: http://twig.sensiolabs.org/doc/functions/include.html -.. _`twig_include_tag`: http://twig.sensiolabs.org/doc/tags/include.html \ No newline at end of file +.. _`with_context`: http://twig.sensiolabs.org/doc/functions/include.html +.. _`include() function`: http://twig.sensiolabs.org/doc/functions/include.html +.. _`{% include %} tag`: http://twig.sensiolabs.org/doc/tags/include.html \ No newline at end of file diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index e9715e58eb4..dc30616c881 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -155,7 +155,7 @@ method should return a countable result. errorPath ~~~~~~~~~ -**type**: ``string`` **default**: The name of the first `field`_ +**type**: ``string`` **default**: The name of the first field in `fields`_ .. versionadded:: 2.1 The ``errorPath`` option was added in Symfony 2.1. From 35db2025726d4e2541c73adfc2f84b1ca5178ae0 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 20 Jul 2013 15:52:12 -0500 Subject: [PATCH 0433/2078] Fixing typo --- cookbook/security/entity_provider.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index e228cc14157..bd87aef3694 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -653,7 +653,7 @@ of the application:: For brevity, the getter and setter methods are hidden, but you can :ref:`generate them `: -.. code-block:: bas +.. code-block:: bash $ php app/console doctrine:generate:entities Acme/UserBundle/Entity/User From 72072e956b8713adb813a4e2979d7e0aea6c1385 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 20 Jul 2013 16:33:32 -0500 Subject: [PATCH 0434/2078] [#2823] Complete re-reading of the big picture quick tour document * Making things shorter where possible * Being more consistent in web server setup and URLs * Improving language, wording, etc --- components/http_foundation/introduction.rst | 4 + quick_tour/the_big_picture.rst | 212 ++++++++------------ 2 files changed, 93 insertions(+), 123 deletions(-) diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 03f018ef357..f244a1d7770 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -24,6 +24,8 @@ You can install the component in 2 different ways: * Use the official Git repository (https://github.com/symfony/HttpFoundation); * :doc:`Install it via Composer ` (``symfony/http-foundation`` on `Packagist`_). +.. _component-http-foundation-request: + Request ------- @@ -267,6 +269,8 @@ request information. Have a look at :class:`the Request API` for more information about them. +.. _component-http-foundation-response: + Response -------- diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index eb0db4aa602..7e220ea2451 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -21,28 +21,17 @@ Apache) with PHP 5.3.3 or higher. .. tip:: - If you have PHP 5.4, you could use the built-in web server. The built-in - server should be used only for development purpose, but it can help you - to start your project quickly and easily. + If you have PHP 5.4, you could use the built-in web server to start trying + things out. We'll tell you how to start the built-in web server + :ref:`after downloading Symfony`. - Just use this command to launch the server: - - .. code-block:: bash - - $ php -S localhost:80 -t /path/to/www - - where "/path/to/www" is the path to some directory on your machine that - you'll extract Symfony into so that the eventual URL to your application - is "http://localhost/Symfony/app_dev.php". You can also extract Symfony - first and then start the web server in the Symfony "web" directory. If - you do this, the URL to your application will be "http://localhost/app_dev.php". - -Ready? Start by downloading the "`Symfony2 Standard Edition`_", a Symfony +Ready? Start by downloading the "`Symfony2 Standard Edition`_": a Symfony :term:`distribution` that is preconfigured for the most common use cases and also contains some code that demonstrates how to use Symfony2 (get the archive with the *vendors* included to get started even faster). -After unpacking the archive under your web server root directory, you should +After unpacking the archive under your web server root directory (if you'll +use the built-in PHP web server, you can unpack it anywhere), you should have a ``Symfony/`` directory that looks like this: .. code-block:: text @@ -71,35 +60,40 @@ have a ``Symfony/`` directory that looks like this: .. note:: - If you are familiar with Composer, you can run the following command - instead of downloading the archive: + If you are familiar with `Composer`_, you can download Composer and then + run the following command instead of downloading the archive (replacing + ``2.2.0`` with the latest Symfony release like ``2.2.1``): .. code-block:: bash - $ composer.phar create-project symfony/framework-standard-edition path/to/install 2.2.0 + $ php composer.phar create-project symfony/framework-standard-edition Symfony 2.2.0 - # remove the Git history - $ rm -rf .git +.. _`quick-tour-big-picture-built-in-server`: - For an exact version, replace `2.2.0` with the latest Symfony version - (e.g. 2.1.1). For details, see the `Symfony Installation Page`_ +If you have PHP 5.4, you can use the built-in web server: -.. tip:: +.. code-block:: bash - If you have PHP 5.4, you can use the built-in web server: + # check your PHP CLI configuration + $ php php app/check.php - .. code-block:: bash + # run the built-in web server + $ php php app/console server:run - # check your PHP CLI configuration - $ php ./app/check.php +Then the URL to your application will be "http://localhost:8000/app_dev.php" - # run the built-in web server - $ php ./app/console server:run +The built-in server should be used only for development purpose, but it +can help you to start your project quickly and easily. - Then the URL to your application will be "http://localhost:8000/app_dev.php" +If you're using a traditional web server like Apache, your URL depends on +your configuration. If you've unzipped Symfony under your web root into a +``Symfony`` directory, then the URL to your application will be: +"http://localhost/Symfony/web/app_dev.php". - The built-in server should be used only for development purpose, but it - can help you to start your project quickly and easily. +.. note:: + + Read more in our :doc:`/cookbook/configuration/web_server_configuration` + section. Checking the Configuration -------------------------- @@ -114,31 +108,13 @@ URL to see the diagnostics for your machine: .. note:: - All of the example URLs assume that you've downloaded and unzipped Symfony - directly into the web server web root. If you've followed the directions - above and unzipped the `Symfony` directory into your web root, then add - `/Symfony/web` after `localhost` for all the URLs you see: - - .. code-block:: text - - http://localhost/Symfony/web/config.php - -.. note:: - - All of the example URLs assume that you've downloaded and unzipped ``Symfony`` - directly into the web server web root. If you've followed the directions - above and done this, then add ``/Symfony/web`` after ``localhost`` for all - the URLs you see: - - .. code-block:: text - - http://localhost/Symfony/web/config.php - - To get nice and short urls you should point the document root of your - webserver or virtual host to the ``Symfony/web/`` directory. In that - case, your URLs will look like ``http://localhost/config.php`` or - ``http://site.local/config.php``, if you created a virtual host to a - local domain called, for example, ``site.local``. + All of the example URLs assume you've setup your web server to point + directly to the ``web/`` directory of your new project, which is different + and a bit more advanced than the process shown above. So, the URL on your + machine will vary - e.g. ``http://localhost:8000/config.php`` + or ``http://localhost/Symfony/web/config.php``. See the + :ref:`above section` for details + on what your URL should be and use it below in all of the examples. If there are any outstanding issues listed, correct them. You might also tweak your configuration by following any given recommendations. When everything is @@ -196,8 +172,8 @@ Routing ~~~~~~~ Symfony2 routes the request to the code that handles it by trying to match the -requested URL against some configured paths. By default, these paths -(called routes) are defined in the ``app/config/routing.yml`` configuration +requested URL (i.e. the virtual path) against some configured paths. By default, +these paths (called routes) are defined in the ``app/config/routing.yml`` configuration file. When you're in the ``dev`` :ref:`environment` - indicated by the app_**dev**.php front controller - the ``app/config/routing_dev.yml`` configuration file is also loaded. In the Standard Edition, the routes to @@ -224,12 +200,12 @@ will be executed. In the next section, you'll learn exactly what that means. .. tip:: - The Symfony2 Standard Edition uses `YAML`_ for its configuration files, - but Symfony2 also supports XML, PHP, and annotations natively. The - different formats are compatible and may be used interchangeably within an - application. Also, the performance of your application does not depend on - the configuration format you choose as everything is cached on the very - first request. + The Symfony2 Standard Edition uses :doc:`YAML` + for its configuration files, but Symfony2 also supports XML, PHP, and + annotations natively. The different formats are compatible and may be + used interchangeably within an application. Also, the performance of + your application does not depend on the configuration format you choose + as everything is cached on the very first request. Controllers ~~~~~~~~~~~ @@ -237,8 +213,8 @@ Controllers A controller is a fancy name for a PHP function or method that handles incoming *requests* and returns *responses* (often HTML code). Instead of using the PHP global variables and functions (like ``$_GET`` or ``header()``) to manage -these HTTP messages, Symfony uses objects: :class:`Symfony\\Component\\HttpFoundation\\Request` -and :class:`Symfony\\Component\\HttpFoundation\\Response`. The simplest possible +these HTTP messages, Symfony uses objects: :ref:`Request` +and :ref:`Response`. The simplest possible controller might create the response by hand, based on the request:: use Symfony\Component\HttpFoundation\Response; @@ -281,11 +257,10 @@ the ``Acme\DemoBundle\Controller\WelcomeController`` class:: The ``WelcomeController`` class extends the built-in ``Controller`` class, which provides useful shortcut methods, like the -:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::render` -method that loads and renders a template -(``AcmeDemoBundle:Welcome:index.html.twig``). The returned value is a Response -object populated with the rendered content. So, if the needs arise, the -Response can be tweaked before it is sent to the browser:: +:ref:`render()` method that loads and renders +a template (``AcmeDemoBundle:Welcome:index.html.twig``). The returned value +is a Response object populated with the rendered content. So, if the need +arises, the Response can be tweaked before it is sent to the browser:: public function indexAction() { @@ -308,10 +283,9 @@ return the contents of a JPG image with a ``Content-Type`` header of ``image/jpg everything about Symfony2 controllers. The template name, ``AcmeDemoBundle:Welcome:index.html.twig``, is the template -*logical name* and it references the -``Resources/views/Welcome/index.html.twig`` file inside the ``AcmeDemoBundle`` -(located at ``src/Acme/DemoBundle``). The bundles section below will explain -why this is useful. +*logical name* and it references the ``Resources/views/Welcome/index.html.twig`` +file inside the ``AcmeDemoBundle`` (located at ``src/Acme/DemoBundle``). +The `Bundles`_ section below will explain why this is useful. Now, take a look at the routing configuration again and find the ``_demo`` key: @@ -355,9 +329,9 @@ you can see, its value can be retrieved through the ``$name`` method argument. .. note:: - Even if annotations are not natively supported by PHP, you use them - extensively in Symfony2 as a convenient way to configure the framework - behavior and keep the configuration next to the code. + Even if annotations are not natively supported by PHP, you can use them + in Symfony2 as a convenient way to configure the framework behavior and + keep the configuration next to the code. If you take a closer look at the controller code, you can see that instead of rendering a template and returning a ``Response`` object like before, it @@ -370,15 +344,14 @@ template is rendered (located at ``src/Acme/DemoBundle/Resources/views/Demo/hell .. tip:: The ``@Route()`` and ``@Template()`` annotations are more powerful than - the simple examples shown in this tutorial. Learn more about "`annotations - in controllers`_" in the official documentation. + the simple examples shown in this tutorial. Learn more about "`annotations in controllers`_" + in the official documentation. Templates ~~~~~~~~~ -The controller renders the -``src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig`` template (or -``AcmeDemoBundle:Demo:hello.html.twig`` if you use the logical name): +The controller renders the ``src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig`` +template (or ``AcmeDemoBundle:Demo:hello.html.twig`` if you use the logical name): .. code-block:: jinja @@ -398,13 +371,13 @@ templates work in Symfony2. Bundles ~~~~~~~ -You might have wondered why the :term:`bundle` word is used in many names you +You might have wondered why the :term:`Bundle` word is used in many names you have seen so far. All the code you write for your application is organized in bundles. In Symfony2 speak, a bundle is a structured set of files (PHP files, stylesheets, JavaScripts, images, ...) that implements a single feature (a blog, a forum, ...) and which can be easily shared with other developers. As of now, you have manipulated one bundle, AcmeDemoBundle. You will learn -more about bundles in the last chapter of this tutorial. +more about bundles in the :doc:`last chapter of this tutorial`. .. _quick-tour-big-picture-environments: @@ -414,12 +387,12 @@ Working with Environments Now that you have a better understanding of how Symfony2 works, take a closer look at the bottom of any Symfony2 rendered page. You should notice a small bar with the Symfony2 logo. This is the "Web Debug Toolbar", and it is a -Symfony2 developer's best friend. +Symfony2 developer's best friend! .. image:: /images/quick_tour/web_debug_toolbar.png :align: center -What you see initially is only the tip of the iceberg; click on the +But what you see initially is only the tip of the iceberg; click on the hexadecimal number (the session token) to reveal yet another very useful Symfony2 debugging tool: the profiler. @@ -432,21 +405,23 @@ Symfony2 debugging tool: the profiler. on the Web Debug Toolbar, or clicking them to go to their respective pages in the profiler. -When loaded (by default in the dev and test environments), and enabled -(by default, only in the dev environment) the Profiler provides an interface -to view a great deal of information recorded on each request made to your -application. It allows you to view details of each request, including, but -not limited to, GET or POST parameters and the request headers; logs; an -execution timeline; information on the currently logged in user; Doctrine -queries; and more. +When loaded and enabled (by default in the ``dev`` :ref:`environment`), +the Profiler provides a web interface for a *huge* amount of information recorded +on each request, including logs, a timeline of the request, GET or POST parameters, +security details, database queries and more! Of course, it would be unwise to have these tools enabled when you deploy your application, so by default, the profiler is not enabled in the ``prod`` -environment. (In fact, its bundle is not even loaded). +environment. + +.. _quick-tour-big-picture-environments-intro: -Symfony2 loads configuration based on the name of the environment. Typically, -you put your common configuration in ``config.yml`` and override where necessary -in the configuration for each environment. For example: +So what *is* an environment? An :term:`Environment` is a simple string (e.g. +``dev`` or ``prod``) that represents a group of configuration that's used +to run your application. + +Typically, you put your common configuration in ``config.yml`` and override +where necessary in the configuration for each environment. For example: .. code-block:: yaml @@ -462,13 +437,12 @@ In this example, the ``dev`` environment loads the ``config_dev.yml`` configurat file, which itself imports the global ``config.yml`` file and then modifies it by enabling the web debug toolbar. -.. tip:: - - For more details on environments, see ":ref:`Environments & Front Controllers`". - -The AcmeDemoBundle is normally only available in the dev environment, but -if you were to add it (and its routes) to the production environment, you could -go here: +When you visit the ``app_dev.php`` file in your browser, you're executing +your Symfony application in the ``dev`` environment. To visit your application +in the ``prod`` environment, visit the ``app.php`` file instead. The demo +routes in our application are only available in the ``dev`` environment, but +if those routes were available in the ``prod`` environment, you would be able +to visit them in the ``prod`` environment by going to: .. code-block:: text @@ -479,27 +453,19 @@ enabled and take advantage of the ``.htaccess`` file Symfony2 provides in ``web/``, you can even omit the ``app.php`` part of the URL. The default ``.htaccess`` points all requests to the ``app.php`` front controller: -.. code-block:: text - - http://localhost/demo/hello/Fabien - -Finally, on production servers, you should point your web root directory -to the ``web/`` directory to better secure your installation and have an -even better looking URL: - .. code-block:: text http://localhost/demo/hello/Fabien .. note:: - Note that the three URLs above are provided here only as **examples** of - how a URL looks like when the production front controller is used (with or - without mod_rewrite). If you actually try them in an out-of-the-box - installation of *Symfony Standard Edition*, you will get a 404 error since - *AcmeDemoBundle* is enabled only in the dev environment and its routes imported - from *app/config/routing_dev.yml*. + Note that the two URLs above are provided here only as **examples** of + how a URL looks like when the ``prod`` front controller is used. If you + actually try them in an out-of-the-box installation of *Symfony Standard Edition*, + you will get a 404 error since the *AcmeDemoBundle* is enabled only in + the ``dev`` environment and its routes imported from ``app/config/routing_dev.yml``. +For more details on environments, see ":ref:`Environments & Front Controllers`". Final Thoughts -------------- @@ -512,8 +478,8 @@ are eager to learn more about Symfony2, dive into the next section: .. _Symfony2 Standard Edition: http://symfony.com/download .. _Symfony in 5 minutes: http://symfony.com/symfony-in-five-minutes +.. _`Composer`: http://getcomposer.org/ .. _Separation of Concerns: http://en.wikipedia.org/wiki/Separation_of_concerns -.. _YAML: http://www.yaml.org/ .. _annotations in controllers: http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/index.html#annotations-for-controllers .. _Twig: http://twig.sensiolabs.org/ .. _`Symfony Installation Page`: http://symfony.com/download From 713dfe3b509e8d0337def8f501f857132b5a98e9 Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Sat, 13 Jul 2013 14:32:54 -0400 Subject: [PATCH 0435/2078] fixed inconsistency in code examples. --- book/http_fundamentals.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index 66509d13f15..8ead7a1299b 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -430,7 +430,7 @@ by adding an entry for ``/contact`` to your routing configuration file: .. code-block:: xml - AcmeBlogBundle:Main:contact + AcmeDemoBundle:Main:contact .. code-block:: php @@ -441,7 +441,7 @@ by adding an entry for ``/contact`` to your routing configuration file: $collection = new RouteCollection(); $collection->add('contact', new Route('/contact', array( - '_controller' => 'AcmeBlogBundle:Main:contact', + '_controller' => 'AcmeDemoBundle:Main:contact', ))); return $collection; From 5e6f783639ae9fd1a550307c652a82a3bb6662f1 Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Sun, 14 Jul 2013 17:11:40 -0500 Subject: [PATCH 0436/2078] fix brace on the next line to be on the same line --- book/testing.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/book/testing.rst b/book/testing.rst index c572bcd842d..05037850bcd 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -530,8 +530,7 @@ narrow down your node selection by chaining the method calls:: $crawler ->filter('h1') - ->reduce(function ($node, $i) - { + ->reduce(function ($node, $i) { if (!$node->getAttribute('class')) { return false; } From 69f4c95062f0022deeeca73e973ab06c51b613a9 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 17 Jul 2013 11:03:39 +0100 Subject: [PATCH 0437/2078] Update monolog_email.rst Added caution note regarding monolog spooling based on the docs example. https://github.com/symfony/symfony-standard/issues/425 --- cookbook/logging/monolog_email.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cookbook/logging/monolog_email.rst b/cookbook/logging/monolog_email.rst index b429bc8c588..56c5a3f0ba0 100644 --- a/cookbook/logging/monolog_email.rst +++ b/cookbook/logging/monolog_email.rst @@ -107,6 +107,13 @@ to and from addresses and the subject. You can combine these handlers with other handlers so that the errors still get logged on the server as well as the emails being sent: +.. caution:: + + The default spool setting for swiftmailer is to use memory, however + this does not work in the case of buffered logs at present. In order + to enable email of logs as per the example below you are required to + comment out spool: { type: memory } in the config.yml file. + .. configuration-block:: .. code-block:: yaml From b51c7a0d5c386d24b9ec1233ddb6a248ddd643aa Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 20 Jul 2013 16:48:21 -0500 Subject: [PATCH 0438/2078] [#2830] Slight rewording --- cookbook/logging/monolog_email.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cookbook/logging/monolog_email.rst b/cookbook/logging/monolog_email.rst index 56c5a3f0ba0..69e723f6fc6 100644 --- a/cookbook/logging/monolog_email.rst +++ b/cookbook/logging/monolog_email.rst @@ -109,10 +109,11 @@ get logged on the server as well as the emails being sent: .. caution:: - The default spool setting for swiftmailer is to use memory, however - this does not work in the case of buffered logs at present. In order - to enable email of logs as per the example below you are required to - comment out spool: { type: memory } in the config.yml file. + The default spool setting for swiftmailer is set to ``memory``, which + means that emails are sent at the very end of the request. However, this + does not work with buffered logs at the moment. In order to enable emailing + logs per the example below, you are must comment out the ``spool: { type: memory }`` + line in the ``config.yml`` file. .. configuration-block:: From 6501e958cc77b4c57c1bf3b4bb4e1708ed317473 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 20 Jul 2013 14:33:50 +0200 Subject: [PATCH 0439/2078] fix security context example code --- components/security/firewall.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/components/security/firewall.rst b/components/security/firewall.rst index 0251cb269f1..fe9b5c3760d 100644 --- a/components/security/firewall.rst +++ b/components/security/firewall.rst @@ -10,10 +10,16 @@ steps in the process of authenticating the user have been taken successfully, you can ask the security context if the authenticated user has access to a certain action or resource of the application:: - use Symfony\Component\Security\SecurityContext; + use Symfony\Component\Security\Core\SecurityContext; use Symfony\Component\Security\Core\Exception\AccessDeniedException; + + // instance of Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface + $authenticationManager = ...; - $securityContext = new SecurityContext(); + // instance of Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface + $accessDecisionManager = ...; + + $securityContext = new SecurityContext($authenticationManager, $accessDecisionManager); // ... authenticate the user @@ -21,6 +27,11 @@ certain action or resource of the application:: throw new AccessDeniedException(); } +.. note:: + + Read the dedicated sections to learn more about :doc:`/components/security/authentication` + and :doc:`/components/security/authorization`. + .. _firewall: A Firewall for HTTP Requests From 4c2abe73577d601381acc4f503812ee99473184a Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 Jul 2013 10:20:02 +0200 Subject: [PATCH 0440/2078] add YAML and XML example for Required and Optional field constraints in a Collection constraint --- reference/constraints/Collection.rst | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/reference/constraints/Collection.rst b/reference/constraints/Collection.rst index 4e709f1d9c0..1dde4458f85 100644 --- a/reference/constraints/Collection.rst +++ b/reference/constraints/Collection.rst @@ -179,6 +179,22 @@ field is optional but must be a valid email if supplied, you can do the followin .. configuration-block:: + .. code-block:: yaml + + # src/Acme/BlogBundle/Resources/config/validation.yml + Acme\BlogBundle\Entity\Author: + properties: + profile_data: + - Collection: + fields: + personal_email: + - Collection\Required + - NotBlank: ~ + - Email: ~ + alternate_email: + - Collection\Optional: + - Email: ~ + .. code-block:: php-annotations // src/Acme/BlogBundle/Entity/Author.php @@ -200,6 +216,35 @@ field is optional but must be a valid email if supplied, you can do the followin 'personal_email', ); } + + .. code-block:: xml + + + + + + + + + + + + + .. code-block:: php From 33ad9d2ee4b077bf3e88e20d0d915ce8092e9eed Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 Jul 2013 10:47:06 +0200 Subject: [PATCH 0441/2078] complete constraint XML examples --- reference/constraints/All.rst | 30 ++++++----- reference/constraints/Blank.rst | 16 ++++-- reference/constraints/Callback.rst | 46 ++++++++++------ reference/constraints/CardScheme.rst | 26 +++++---- reference/constraints/Choice.rst | 74 ++++++++++++++++---------- reference/constraints/Collection.rst | 44 ++++++++------- reference/constraints/Count.rst | 26 +++++---- reference/constraints/Country.rst | 16 ++++-- reference/constraints/Date.rst | 16 ++++-- reference/constraints/DateTime.rst | 16 ++++-- reference/constraints/False.rst | 20 ++++--- reference/constraints/File.rst | 30 ++++++----- reference/constraints/Image.rst | 26 +++++---- reference/constraints/Ip.rst | 16 ++++-- reference/constraints/Language.rst | 16 ++++-- reference/constraints/Length.rst | 26 +++++---- reference/constraints/Locale.rst | 16 ++++-- reference/constraints/Luhn.rst | 28 ++++++---- reference/constraints/Max.rst | 22 +++++--- reference/constraints/MaxLength.rst | 20 ++++--- reference/constraints/Min.rst | 22 +++++--- reference/constraints/MinLength.rst | 22 +++++--- reference/constraints/NotBlank.rst | 16 ++++-- reference/constraints/NotNull.rst | 16 ++++-- reference/constraints/Null.rst | 16 ++++-- reference/constraints/Range.rst | 26 +++++---- reference/constraints/Regex.rst | 44 +++++++++------ reference/constraints/Time.rst | 16 ++++-- reference/constraints/True.rst | 20 ++++--- reference/constraints/Type.rst | 22 +++++--- reference/constraints/UniqueEntity.rst | 25 +++++---- reference/constraints/Url.rst | 16 ++++-- reference/constraints/UserPassword.rst | 16 ++++-- reference/constraints/Valid.rst | 68 +++++++++++++---------- 34 files changed, 555 insertions(+), 320 deletions(-) diff --git a/reference/constraints/All.rst b/reference/constraints/All.rst index 89cf5669594..64af3c51c41 100644 --- a/reference/constraints/All.rst +++ b/reference/constraints/All.rst @@ -54,18 +54,24 @@ entry in that array: .. code-block:: xml - - - - - - - + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Blank.rst b/reference/constraints/Blank.rst index 34a841858b5..1461ee6b180 100644 --- a/reference/constraints/Blank.rst +++ b/reference/constraints/Blank.rst @@ -50,11 +50,17 @@ of an ``Author`` class were blank, you could do the following: .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Callback.rst b/reference/constraints/Callback.rst index 20695037743..a367ac9f5d5 100644 --- a/reference/constraints/Callback.rst +++ b/reference/constraints/Callback.rst @@ -57,13 +57,19 @@ Setup .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php @@ -159,16 +165,22 @@ process. Each method can be one of the following formats: .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/CardScheme.rst b/reference/constraints/CardScheme.rst index 76427cb137a..77447ecedce 100644 --- a/reference/constraints/CardScheme.rst +++ b/reference/constraints/CardScheme.rst @@ -40,16 +40,22 @@ on an object that will contain a credit card number. .. code-block:: xml - - - - - - - - + + + + + + + + + + + + .. code-block:: php-annotations diff --git a/reference/constraints/Choice.rst b/reference/constraints/Choice.rst index 00504eec65e..ab4571b7b57 100644 --- a/reference/constraints/Choice.rst +++ b/reference/constraints/Choice.rst @@ -64,17 +64,23 @@ If your valid choice list is simple, you can pass them in directly via the .. code-block:: xml - - - - - - - - + + + + + + + + + + + + .. code-block:: php @@ -149,13 +155,19 @@ constraint. .. code-block:: xml - - - - - - - + + + + + + + + + + + .. code-block:: php @@ -208,16 +220,22 @@ you can pass the class name and the method as an array. .. code-block:: xml - - - - - - - + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Collection.rst b/reference/constraints/Collection.rst index 4e709f1d9c0..5a207c79ad0 100644 --- a/reference/constraints/Collection.rst +++ b/reference/constraints/Collection.rst @@ -101,25 +101,31 @@ blank but is no longer than 100 characters in length, you would do the following .. code-block:: xml - - - - - - - - + + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Count.rst b/reference/constraints/Count.rst index 9c808e9576d..7bf7763cf7b 100644 --- a/reference/constraints/Count.rst +++ b/reference/constraints/Count.rst @@ -64,16 +64,22 @@ you might add the following: .. code-block:: xml - - - - - - - - - - + + + + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Country.rst b/reference/constraints/Country.rst index cc5ec176fb0..3843891ebad 100644 --- a/reference/constraints/Country.rst +++ b/reference/constraints/Country.rst @@ -44,11 +44,17 @@ Basic Usage .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Date.rst b/reference/constraints/Date.rst index 293ed88bc35..d6816777b06 100644 --- a/reference/constraints/Date.rst +++ b/reference/constraints/Date.rst @@ -46,11 +46,17 @@ Basic Usage .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/DateTime.rst b/reference/constraints/DateTime.rst index 11d3a237677..7a13b8044c0 100644 --- a/reference/constraints/DateTime.rst +++ b/reference/constraints/DateTime.rst @@ -46,11 +46,17 @@ Basic Usage .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/False.rst b/reference/constraints/False.rst index 118999cede0..339128cef66 100644 --- a/reference/constraints/False.rst +++ b/reference/constraints/False.rst @@ -71,13 +71,19 @@ method returns **false**: .. code-block:: xml - - - - - - - + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/File.rst b/reference/constraints/File.rst index d5d1605f99d..c54d70fc0db 100644 --- a/reference/constraints/File.rst +++ b/reference/constraints/File.rst @@ -102,18 +102,24 @@ below a certain file size and a valid PDF, add the following: .. code-block:: xml - - - - - - - - - + + + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Image.rst b/reference/constraints/Image.rst index ca90c6476c7..f3a0cae3c62 100644 --- a/reference/constraints/Image.rst +++ b/reference/constraints/Image.rst @@ -100,16 +100,22 @@ it is between a certain size, add the following: .. code-block:: xml - - - - - - - - - - + + + + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Ip.rst b/reference/constraints/Ip.rst index ede78b3efea..b4ef5e28378 100644 --- a/reference/constraints/Ip.rst +++ b/reference/constraints/Ip.rst @@ -47,11 +47,17 @@ Basic Usage .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Language.rst b/reference/constraints/Language.rst index 7d4639802bb..de1f33560e8 100644 --- a/reference/constraints/Language.rst +++ b/reference/constraints/Language.rst @@ -44,11 +44,17 @@ Basic Usage .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Length.rst b/reference/constraints/Length.rst index cb5a1ce84f1..54d32ef62fa 100644 --- a/reference/constraints/Length.rst +++ b/reference/constraints/Length.rst @@ -64,16 +64,22 @@ To verify that the ``firstName`` field length of a class is between "2" and .. code-block:: xml - - - - - - - - - - + + + + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Locale.rst b/reference/constraints/Locale.rst index b841651577b..6f1e992adc7 100644 --- a/reference/constraints/Locale.rst +++ b/reference/constraints/Locale.rst @@ -48,11 +48,17 @@ Basic Usage .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Luhn.rst b/reference/constraints/Luhn.rst index 8d6e789d0d3..2c7d261e434 100644 --- a/reference/constraints/Luhn.rst +++ b/reference/constraints/Luhn.rst @@ -35,17 +35,6 @@ will contain a credit card number. - Luhn: message: Please check your credit card number. - .. code-block:: xml - - - - - - - - - - .. code-block:: php-annotations // src/Acme/SubscriptionBundle/Entity/Transaction.php @@ -61,6 +50,23 @@ will contain a credit card number. protected $cardNumber; } + .. code-block:: xml + + + + + + + + + + + + + + .. code-block:: php // src/Acme/SubscriptionBundle/Entity/Transaction.php diff --git a/reference/constraints/Max.rst b/reference/constraints/Max.rst index 2873badd137..93723ef35db 100644 --- a/reference/constraints/Max.rst +++ b/reference/constraints/Max.rst @@ -55,14 +55,20 @@ add the following: .. code-block:: xml - - - - - - - - + + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/MaxLength.rst b/reference/constraints/MaxLength.rst index 54c6fd4d95d..786b90f10d1 100644 --- a/reference/constraints/MaxLength.rst +++ b/reference/constraints/MaxLength.rst @@ -52,13 +52,19 @@ Basic Usage .. code-block:: xml - - - - - - - + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Min.rst b/reference/constraints/Min.rst index a42d5fd76c0..232ee37652d 100644 --- a/reference/constraints/Min.rst +++ b/reference/constraints/Min.rst @@ -55,14 +55,20 @@ the following: .. code-block:: xml - - - - - - - - + + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/MinLength.rst b/reference/constraints/MinLength.rst index b9ad5afd075..373c5039cd7 100644 --- a/reference/constraints/MinLength.rst +++ b/reference/constraints/MinLength.rst @@ -55,14 +55,20 @@ Basic Usage .. code-block:: xml - - - - - - - - + + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/NotBlank.rst b/reference/constraints/NotBlank.rst index bcb6628f0b0..b7d7bec9e2b 100644 --- a/reference/constraints/NotBlank.rst +++ b/reference/constraints/NotBlank.rst @@ -49,11 +49,17 @@ were not blank, you could do the following: .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/NotNull.rst b/reference/constraints/NotNull.rst index 1bd63d7cc55..b038d92fd8c 100644 --- a/reference/constraints/NotNull.rst +++ b/reference/constraints/NotNull.rst @@ -49,11 +49,17 @@ were not strictly equal to ``null``, you would: .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Null.rst b/reference/constraints/Null.rst index 0d34cb6311d..bbf3d0939ef 100644 --- a/reference/constraints/Null.rst +++ b/reference/constraints/Null.rst @@ -49,11 +49,17 @@ of an ``Author`` class exactly equal to ``null``, you could do the following: .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Range.rst b/reference/constraints/Range.rst index 891c1ec8331..b47eb6d6440 100644 --- a/reference/constraints/Range.rst +++ b/reference/constraints/Range.rst @@ -63,16 +63,22 @@ the following: .. code-block:: xml - - - - - - - - - - + + + + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Regex.rst b/reference/constraints/Regex.rst index 426bd72f196..d50dcb6428f 100644 --- a/reference/constraints/Regex.rst +++ b/reference/constraints/Regex.rst @@ -51,13 +51,19 @@ characters at the beginning of your string: .. code-block:: xml - - - - - - - + + + + + + + + + + + .. code-block:: php @@ -117,15 +123,21 @@ message: .. code-block:: xml - - - - - - - - - + + + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Time.rst b/reference/constraints/Time.rst index 82267074381..0ada2796e26 100644 --- a/reference/constraints/Time.rst +++ b/reference/constraints/Time.rst @@ -49,11 +49,17 @@ of the day when the event starts: .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/True.rst b/reference/constraints/True.rst index 682f3c12a55..ba5ca5997d8 100644 --- a/reference/constraints/True.rst +++ b/reference/constraints/True.rst @@ -75,13 +75,19 @@ Then you can constrain this method with ``True``. .. code-block:: xml - - - - - - - + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Type.rst b/reference/constraints/Type.rst index cf2024c6236..41849ba3086 100644 --- a/reference/constraints/Type.rst +++ b/reference/constraints/Type.rst @@ -49,14 +49,20 @@ Basic Usage .. code-block:: xml - - - - - - - - + + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index dc30616c881..c6376469403 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -70,15 +70,22 @@ table: .. code-block:: xml - - - - - - - - - + + + + + + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Url.rst b/reference/constraints/Url.rst index 2b6614f59d9..51f5d8c093e 100644 --- a/reference/constraints/Url.rst +++ b/reference/constraints/Url.rst @@ -45,11 +45,17 @@ Basic Usage .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/UserPassword.rst b/reference/constraints/UserPassword.rst index 0ad827ac4c7..3fcf47ea9c1 100644 --- a/reference/constraints/UserPassword.rst +++ b/reference/constraints/UserPassword.rst @@ -70,11 +70,17 @@ password: .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php diff --git a/reference/constraints/Valid.rst b/reference/constraints/Valid.rst index f34908c6285..70110f8da26 100644 --- a/reference/constraints/Valid.rst +++ b/reference/constraints/Valid.rst @@ -109,29 +109,35 @@ an ``Address`` instance in the ``$address`` property. .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + .. code-block:: php @@ -208,11 +214,17 @@ property. .. code-block:: xml - - - - - + + + + + + + + + .. code-block:: php From e2ba3a04ab0949f9f5c273d5df9e752a7f2866c3 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 Jul 2013 12:28:03 +0200 Subject: [PATCH 0442/2078] fix label --- components/dom_crawler.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index 95fdfacf608..d0df2ee208c 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -194,7 +194,7 @@ and :phpclass:`DOMNode` objects: $crawler->addNode($node); $crawler->add($document); -.. component-dom-crawler-dumping: +.. _component-dom-crawler-dumping: .. sidebar:: Manipulating and Dumping a ``Crawler`` From 00b5b1dcbea6a55dbd3662159632073ec2b2f42c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 Jul 2013 12:58:53 +0200 Subject: [PATCH 0443/2078] fix cookbook article link since the virtual option doesn't no longer exist --- reference/forms/types/form.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index 97451e3c39c..708021b49c9 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -31,8 +31,8 @@ on all fields. .. include:: /reference/forms/types/options/translation_domain.rst.inc -virtual +inherit_data ------- -See :doc:`How to use the Virtual Form Field Option` +See :doc:`/cookbook/form/inherit_data_option`. From ea7b6309790a31c8c295fd440f00d7f73a78d322 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 Jul 2013 13:17:14 +0200 Subject: [PATCH 0444/2078] fixing link to the translation domain section in cookbook article --- book/translation.rst | 3 +++ cookbook/bundles/override.rst | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/book/translation.rst b/book/translation.rst index e2b51c43729..58add6ec2c8 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -470,6 +470,9 @@ Symfony2 will discover these files and use them when translating either .. index:: single: Translations; Message domains + +.. _using-message-domains: + Using Message Domains --------------------- diff --git a/cookbook/bundles/override.rst b/cookbook/bundles/override.rst index 4354ddfa558..a78bb9fc062 100644 --- a/cookbook/bundles/override.rst +++ b/cookbook/bundles/override.rst @@ -129,7 +129,7 @@ Translations Translations are not related to bundles, but to domains. That means that you can override the translations from any translation file, as long as it is in -:ref:`the correct domain `. +:ref:`the correct domain `. .. caution:: From 9bef433ae9efec43177ae4f99531da33ff28226b Mon Sep 17 00:00:00 2001 From: Diego Saint Esteben Date: Mon, 22 Jul 2013 15:24:43 -0300 Subject: [PATCH 0445/2078] Fixed TwigExtractor API link --- reference/dic_tags.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index 6968e6dcaa4..78e2792e544 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -944,7 +944,7 @@ translation.extractor When executing the ``translation:update`` command, it uses extractors to extract translation messages from a file. By default, the Symfony2 framework -has a :class:`Symfony\\Bridge\\TwigBridge\\Translation\\TwigExtractor` and a +has a :class:`Symfony\\Bridge\\Twig\\Translation\\TwigExtractor` and a :class:`Symfony\\Bundle\\FrameworkBundle\\Translation\\PhpExtractor`, which help to find and extract translation keys from Twig templates and PHP files. From b0a2b1f3fe73084a0aab413c0de4086bc720120a Mon Sep 17 00:00:00 2001 From: Philippe Gamache Date: Tue, 23 Jul 2013 10:23:37 -0400 Subject: [PATCH 0446/2078] Optimisation of Setting Up Permission Replace www-data by the current user running apache using command line --- book/installation.rst | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/book/installation.rst b/book/installation.rst index 459c98a11f8..a10af7612f3 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -219,41 +219,27 @@ If there are any issues, correct them now before moving on. .. sidebar:: Setting up Permissions + One common issue is that the ``app/cache`` and ``app/logs`` directories must be writable both by the web server and the command line user. On a UNIX system, if your web server user is different from your command line user, you can run the following commands just once in your project to ensure that permissions will be setup properly. - **Note that not all web servers run as the user** ``www-data`` as in the examples - below. Instead, check which user *your* web server is being run as and - use it in place of ``www-data``. - - On a UNIX system, this can be done with one of the following commands: - - .. code-block:: bash - - $ ps aux | grep httpd - - or - - .. code-block:: bash - - $ ps aux | grep apache - **1. Using ACL on a system that supports chmod +a** Many systems allow you to use the ``chmod +a`` command. Try this first, - and if you get an error - try the next method. Be sure to replace ``www-data`` - with your web server user on the first ``chmod`` command: + and if you get an error - try the next method. .. code-block:: bash $ rm -rf app/cache/* $ rm -rf app/logs/* - $ sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs - $ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs + $ APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd' | grep -v root | head -1 | cut -d\ -f1` + $ sudo chmod +a "$APACHEUSER allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs + $ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs + **2. Using Acl on a system that does not support chmod +a** @@ -264,9 +250,10 @@ If there are any issues, correct them now before moving on. .. code-block:: bash - $ sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX app/cache app/logs - $ sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs - + $ APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd' | grep -v root | head -1 | cut -d\ -f1` + $ sudo setfacl -R -m u:$APACHEUSER:rwX -m u:`whoami`:rwX app/cache app/logs + $ sudo setfacl -dR -m u:$APACHEUSER:rwX -m u:`whoami`:rwX app/cache app/logs + **3. Without using ACL** If you don't have access to changing the ACL of the directories, you will From cefeeb887c3b9c4646ae4521215e5801a9cd9e6b Mon Sep 17 00:00:00 2001 From: Drak Date: Thu, 25 Jul 2013 04:59:55 +0100 Subject: [PATCH 0447/2078] Clarify php session bridge cookbook. --- cookbook/session/php_bridge.rst | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cookbook/session/php_bridge.rst b/cookbook/session/php_bridge.rst index c2e6b2596df..a9f3c1f442b 100644 --- a/cookbook/session/php_bridge.rst +++ b/cookbook/session/php_bridge.rst @@ -33,4 +33,14 @@ the example below: storage_id: session.storage.php_bridge handler_id: session.handler.native_file -For more details, see :doc:`/components/http_foundation/session_php_bridge`. \ No newline at end of file +.. note:: + +If the legacy application requires it's own session save-handler, do not +override this, rather set ``handler_id: ~``. Note that a save handler cannot +be changed once the session has been started. If the application starts the +session before Symfony initializes the save-handler will have already been +set. You will need ``handler_id: ~``. Only override the save-handler if you +are sure the legacy application can use the Symfony save-handler without +side effects and that the session has not been started before Symfony inializes. + +For more details, see :doc:`/components/http_foundation/session_php_bridge`. From 3d1f59f410dd8f76c69b30a6b86b2ae8d18b9566 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 28 Jul 2013 17:45:44 -0500 Subject: [PATCH 0448/2078] [#2766] Minor tweaks to group sequence provider, including a few typos and adding the missing interface --- book/validation.rst | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/book/validation.rst b/book/validation.rst index 1dbf0570df5..99a3d7691a1 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -960,10 +960,11 @@ entity and a new constraint group called ``Premium``: private $name; /** - * @Assert\CardScheme( - * schemes={"VISA"}, - * groups={"Premium"}, - * ) + * @Assert\CardScheme( + * schemes={"VISA"}, + * groups={"Premium"}, + * ) + */ private $creditCard; } @@ -1024,14 +1025,14 @@ entity and a new constraint group called ``Premium``: } } -Now, let this class implement -:class:`Symfony\\Componet\\Validation\\GroupSequenceProviderInterface` and -implement a method called -:method:`Symfony\\Componet\\Validation\\GroupSequenceProviderInterface::getGroupSequence`, -which returns an array of groups to use and add the -``@Assert\GroupSequencdeProvider`` annotation to the class. Imagine a method -``isPremium`` returns true if the user is a premium member. Your method looks -like this:: +Now, change the ``User`` class to implement +:class:`Symfony\\Component\\Validation\\GroupSequenceProviderInterface` and +add the +:method:`Symfony\\Component\\Validation\\GroupSequenceProviderInterface::getGroupSequence`, +which should return an array of groups to use. Also, add the +``@Assert\GroupSequenceProvider`` annotation to the class. If you imagine +that a method called ``isPremium`` returns true if the user is a premium member, +then your code might look like this:: // src/Acme/DemoBundle/Entity/User.php namespace Acme\DemoBundle\Entity; @@ -1043,7 +1044,7 @@ like this:: * @Assert\GroupSequenceProvider * ... */ - class User + class User implements GroupSequenceProviderInterface { // ... From f5e9cd12290fa8fe0492138f426a168d325461fc Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 28 Jul 2013 18:37:41 -0500 Subject: [PATCH 0449/2078] [#2844] Fixing minor syntax error --- reference/forms/types/form.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index 708021b49c9..1284ff3db4c 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -32,7 +32,7 @@ on all fields. .. include:: /reference/forms/types/options/translation_domain.rst.inc inherit_data -------- +------------ See :doc:`/cookbook/form/inherit_data_option`. From bafeaafb14e828092af51faf597ee03b112eb443 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 28 Jul 2013 18:45:54 -0500 Subject: [PATCH 0450/2078] [#2851] Minor tweaks to new trick to get the web server user --- book/installation.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/book/installation.rst b/book/installation.rst index a10af7612f3..bde9abf2ccc 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -219,7 +219,6 @@ If there are any issues, correct them now before moving on. .. sidebar:: Setting up Permissions - One common issue is that the ``app/cache`` and ``app/logs`` directories must be writable both by the web server and the command line user. On a UNIX system, if your web server user is different from your command @@ -229,7 +228,8 @@ If there are any issues, correct them now before moving on. **1. Using ACL on a system that supports chmod +a** Many systems allow you to use the ``chmod +a`` command. Try this first, - and if you get an error - try the next method. + and if you get an error - try the next method. This uses a command to + try to determine your web server user and set is as ``APACHEUSER``: .. code-block:: bash @@ -245,8 +245,9 @@ If there are any issues, correct them now before moving on. Some systems don't support ``chmod +a``, but do support another utility called ``setfacl``. You may need to `enable ACL support`_ on your partition - and install setfacl before using it (as is the case with Ubuntu), like - so: + and install setfacl before using it (as is the case with Ubuntu). This + uses a command to try to determine your web server user and set is as + ``APACHEUSER``: .. code-block:: bash From 3d202c5d29d9a568b3b112f3e24d2a91a43e433e Mon Sep 17 00:00:00 2001 From: Tom Corrigan Date: Wed, 24 Jul 2013 18:16:00 +1000 Subject: [PATCH 0451/2078] Fix typehint in example code --- cookbook/form/form_collections.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cookbook/form/form_collections.rst b/cookbook/form/form_collections.rst index bb8a419b64d..506c5c0caf5 100755 --- a/cookbook/form/form_collections.rst +++ b/cookbook/form/form_collections.rst @@ -428,12 +428,12 @@ for the tags in the ``Task`` class:: { // ... - public function addTag($tag) + public function addTag(Tag $tag) { $this->tags->add($tag); } - public function removeTag($tag) + public function removeTag(Tag $tag) { // ... } @@ -539,7 +539,7 @@ we talk about next!). // src/Acme/TaskBundle/Entity/Task.php // ... - public function addTag(ArrayCollection $tag) + public function addTag(Tag $tag) { $tag->addTask($this); @@ -593,7 +593,7 @@ Now, you need to put some code into the ``removeTag`` method of ``Task``:: { // ... - public function removeTag($tag) + public function removeTag(Tag $tag) { $this->tags->removeElement($tag); } From c471fc715228e9c62bc43b5b46ff1bb6f399a538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=A4rtner?= Date: Wed, 24 Jul 2013 22:46:24 +0200 Subject: [PATCH 0452/2078] Added punctuation Just a tiny, tiny, tiny fix. --- components/http_kernel/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/http_kernel/introduction.rst b/components/http_kernel/introduction.rst index 9cb6bb828f9..0541f0dce81 100644 --- a/components/http_kernel/introduction.rst +++ b/components/http_kernel/introduction.rst @@ -128,7 +128,7 @@ For general information on adding listeners to the events below, see **Typical Purposes**: To add more information to the ``Request``, initialize parts of the system, or return a ``Response`` if possible (e.g. a security -layer that denies access) +layer that denies access). :ref:`Kernel Events Information Table` From 8e1553e58ec25453c590a599afda813ee4d10301 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 28 Jul 2013 18:55:13 -0500 Subject: [PATCH 0453/2078] [#2856] Indenting paragraph and fixing a few minor things --- cookbook/session/php_bridge.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cookbook/session/php_bridge.rst b/cookbook/session/php_bridge.rst index a9f3c1f442b..fefdd26e73f 100644 --- a/cookbook/session/php_bridge.rst +++ b/cookbook/session/php_bridge.rst @@ -35,12 +35,13 @@ the example below: .. note:: -If the legacy application requires it's own session save-handler, do not -override this, rather set ``handler_id: ~``. Note that a save handler cannot -be changed once the session has been started. If the application starts the -session before Symfony initializes the save-handler will have already been -set. You will need ``handler_id: ~``. Only override the save-handler if you -are sure the legacy application can use the Symfony save-handler without -side effects and that the session has not been started before Symfony inializes. + If the legacy application requires its own session save-handler, do not + override this. Instead set ``handler_id: ~``. Note that a save handler + cannot be changed once the session has been started. If the application + starts the session before Symfony is initialized, the save-handler will + have already been set. In this case, you will need ``handler_id: ~``. + Only override the save-handler if you are sure the legacy application + can use the Symfony save-handler without side effects and that the session + has not been started before Symfony is initialized. For more details, see :doc:`/components/http_foundation/session_php_bridge`. From c0968521fa328691c775c085908a45be301a7472 Mon Sep 17 00:00:00 2001 From: TomiS Date: Thu, 25 Jul 2013 11:15:56 +0300 Subject: [PATCH 0454/2078] Varnish configuration to ensure routing works --- cookbook/cache/varnish.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index e461e3124ee..0fbf0bf3825 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -176,5 +176,23 @@ that will invalidate the cache for a given resource: } } +Routing +------------------ +To ensure Symfony Router generates urls correctly with Varnish, proper ```X-Forwarded``` headers must be added. Headers depend on how you have configured hosts and ports for the web server and Varnish but this example should work if the web server is using the same IP as Varnish but different port (e.g. 8080). + +.. code-block:: text + + sub vcl_recv { + if (req.http.X-Forwarded-Proto == "https" ) { + set req.http.X-Forwarded-Port = "443"; + } else { + set req.http.X-Forwarded-Port = "80"; + } + } + +.. note:: + + Remember to set framework.trust_proxy_headers: true for this to work. + .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch .. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html From 64fdcd5c8d8525a3c5efcf0ea4f4f468c381bab9 Mon Sep 17 00:00:00 2001 From: TomiS Date: Thu, 25 Jul 2013 11:19:46 +0300 Subject: [PATCH 0455/2078] Try to fix intendation --- cookbook/cache/varnish.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index 0fbf0bf3825..634f248e148 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -183,12 +183,12 @@ To ensure Symfony Router generates urls correctly with Varnish, proper ```X-Forw .. code-block:: text sub vcl_recv { - if (req.http.X-Forwarded-Proto == "https" ) { - set req.http.X-Forwarded-Port = "443"; - } else { - set req.http.X-Forwarded-Port = "80"; - } - } + if (req.http.X-Forwarded-Proto == "https" ) { + set req.http.X-Forwarded-Port = "443"; + } else { + set req.http.X-Forwarded-Port = "80" + } + } .. note:: From d04b9392611ff5919d88eec9e5a1951361bea37b Mon Sep 17 00:00:00 2001 From: TomiS Date: Thu, 25 Jul 2013 11:24:26 +0300 Subject: [PATCH 0456/2078] a bit more --- cookbook/cache/varnish.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index 634f248e148..911995b086a 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -192,7 +192,7 @@ To ensure Symfony Router generates urls correctly with Varnish, proper ```X-Forw .. note:: - Remember to set framework.trust_proxy_headers: true for this to work. + Remember to set framework.trust_proxy_headers: true in Symfony configuration for this to work. .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch .. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html From 1008b83b3650cd3341200f4f89a154965d7bd711 Mon Sep 17 00:00:00 2001 From: TomiS Date: Thu, 25 Jul 2013 13:27:09 +0300 Subject: [PATCH 0457/2078] fix typos --- cookbook/cache/varnish.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index 911995b086a..3013233975c 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -178,7 +178,8 @@ that will invalidate the cache for a given resource: Routing ------------------ -To ensure Symfony Router generates urls correctly with Varnish, proper ```X-Forwarded``` headers must be added. Headers depend on how you have configured hosts and ports for the web server and Varnish but this example should work if the web server is using the same IP as Varnish but different port (e.g. 8080). + +To ensure that the Symfony Router generates urls correctly with Varnish, proper ```X-Forwarded``` headers must be added. Headers depend on how you have configured hosts and ports for the web server and Varnish but this example should work if the web server is using the same IP as Varnish but a different port (e.g. 8080). .. code-block:: text @@ -192,7 +193,8 @@ To ensure Symfony Router generates urls correctly with Varnish, proper ```X-Forw .. note:: - Remember to set framework.trust_proxy_headers: true in Symfony configuration for this to work. + Remember to set framework.trust_proxy_headers: true in the Symfony configuration for this to work. .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch .. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html + From 93402a1cfca14548c54272e665c36b8711083b6c Mon Sep 17 00:00:00 2001 From: TomiS Date: Fri, 26 Jul 2013 10:27:00 +0300 Subject: [PATCH 0458/2078] whitespace characters and line feeds --- cookbook/cache/varnish.rst | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index 3013233975c..f85be6875be 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -179,22 +179,26 @@ that will invalidate the cache for a given resource: Routing ------------------ -To ensure that the Symfony Router generates urls correctly with Varnish, proper ```X-Forwarded``` headers must be added. Headers depend on how you have configured hosts and ports for the web server and Varnish but this example should work if the web server is using the same IP as Varnish but a different port (e.g. 8080). +To ensure that the Symfony Router generates urls correctly with Varnish, +proper ```X-Forwarded``` headers must be added. Headers depend on how you +have configured hosts and ports for the web server and Varnish but this +example should work if the web server is using the same IP as Varnish but +a different port (e.g. 8080). .. code-block:: text - sub vcl_recv { - if (req.http.X-Forwarded-Proto == "https" ) { - set req.http.X-Forwarded-Port = "443"; - } else { - set req.http.X-Forwarded-Port = "80" - } - } + sub vcl_recv { + if (req.http.X-Forwarded-Proto == "https" ) { + set req.http.X-Forwarded-Port = "443"; + } else { + set req.http.X-Forwarded-Port = "80" + } + } .. note:: - Remember to set framework.trust_proxy_headers: true in the Symfony configuration for this to work. + Remember to set framework.trust_proxy_headers: true in the Symfony + configuration for this to work. .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch .. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html - From b3c76a5cb6995446664ce543d825d7ea1f03981a Mon Sep 17 00:00:00 2001 From: TomiS Date: Fri, 26 Jul 2013 11:35:16 +0300 Subject: [PATCH 0459/2078] double backticks --- cookbook/cache/varnish.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index f85be6875be..0ad665ca938 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -197,7 +197,7 @@ a different port (e.g. 8080). .. note:: - Remember to set framework.trust_proxy_headers: true in the Symfony + Remember to set ``framework.trust_proxy_headers: true`` in the Symfony configuration for this to work. .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch From bd63f2648a084f55b8274c6544da8582ede03083 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 28 Jul 2013 19:03:31 -0500 Subject: [PATCH 0460/2078] [#2857] Fixing a few minor errors, adding more details, and using the non-deprecated trusted_proxies config in forwarded headers docs --- cookbook/cache/varnish.rst | 23 +++++++++++++++-------- reference/configuration/framework.rst | 2 ++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index 0ad665ca938..fa2170304f9 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -176,14 +176,20 @@ that will invalidate the cache for a given resource: } } -Routing ------------------- +Routing and X-FORWARDED Headers +------------------------------- To ensure that the Symfony Router generates urls correctly with Varnish, -proper ```X-Forwarded``` headers must be added. Headers depend on how you -have configured hosts and ports for the web server and Varnish but this -example should work if the web server is using the same IP as Varnish but -a different port (e.g. 8080). +proper ```X-Forwarded``` headers must be added so that Symfony is aware of +the original port number of the request. Exactly how this is done depends +on your setup. As a simple example, Varnish and your web server are on the +same machine and that Varnish is listening on one port (e.g. 80) and Apache +on another (e.g. 8080). In this situation, Varnish should add the ``X-Forwarded-Port`` +header so that the Symfony application knows that the original port number +is 80 and not 8080. + +If this header weren't set properly, Symfony may append ``8080`` when generating +absolute URLs: .. code-block:: text @@ -197,8 +203,9 @@ a different port (e.g. 8080). .. note:: - Remember to set ``framework.trust_proxy_headers: true`` in the Symfony - configuration for this to work. + Remember to configure :ref:`framework.trusted_proxies` + in the Symfony configuration so that Varnish is seen as a trusted proxy + and the ``X-Forwarded-`` headers are used. .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch .. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index d7ef213262e..d538d558ba0 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -94,6 +94,8 @@ services related to testing your application (e.g. ``test.client``) are loaded. This setting should be present in your ``test`` environment (usually via ``app/config/config_test.yml``). For more information, see :doc:`/book/testing`. +.. _reference-framework-trusted-proxies: + trusted_proxies ~~~~~~~~~~~~~~~ From cb531fd07db9bdd48982f9abd28c6faeb4db1ced Mon Sep 17 00:00:00 2001 From: Valentin Ferriere Date: Thu, 20 Jun 2013 16:20:22 +0200 Subject: [PATCH 0461/2078] Update custom_authentication_provider.rst Necessary to avoid : Failed to start the session because headers have already been sent --- cookbook/security/custom_authentication_provider.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cookbook/security/custom_authentication_provider.rst b/cookbook/security/custom_authentication_provider.rst index 0625bf48e56..af15a6b1d37 100644 --- a/cookbook/security/custom_authentication_provider.rst +++ b/cookbook/security/custom_authentication_provider.rst @@ -463,12 +463,14 @@ You are finished! You can now define parts of your app as under WSSE protection. firewalls: wsse_secured: pattern: /api/.* + stateless: true wsse: true .. code-block:: xml + @@ -479,6 +481,7 @@ You are finished! You can now define parts of your app as under WSSE protection. 'firewalls' => array( 'wsse_secured' => array( 'pattern' => '/api/.*', + 'stateless' => true, 'wsse' => true, ), ), @@ -563,6 +566,7 @@ set to any desirable value per firewall. firewalls: wsse_secured: pattern: /api/.* + stateless: true wsse: { lifetime: 30 } .. code-block:: xml @@ -571,6 +575,7 @@ set to any desirable value per firewall. + @@ -581,6 +586,7 @@ set to any desirable value per firewall. 'firewalls' => array( 'wsse_secured' => array( 'pattern' => '/api/.*', + 'stateless' => true, 'wsse' => array( 'lifetime' => 30, ), From 7e9233c767c95189eb05c0764744e8a290363059 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Fri, 21 Jun 2013 09:30:44 +0200 Subject: [PATCH 0462/2078] Changed link to docs instead of code --- book/security.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/book/security.rst b/book/security.rst index c64ed317403..edf799f89f0 100644 --- a/book/security.rst +++ b/book/security.rst @@ -25,8 +25,8 @@ application with HTTP Basic authentication. .. note:: - `Symfony's security component`_ is available as a standalone PHP library - for use inside any PHP project. + :doc:`Symfony's security component ` is + available as a standalone PHP library for use inside any PHP project. Basic Example: HTTP Authentication ---------------------------------- @@ -2116,7 +2116,6 @@ Learn more from the Cookbook * :doc:`Access Control Lists (ACLs) ` * :doc:`/cookbook/security/remember_me` -.. _`Symfony's security component`: https://github.com/symfony/Security .. _`JMSSecurityExtraBundle`: http://jmsyst.com/bundles/JMSSecurityExtraBundle/1.2 .. _`FOSUserBundle`: https://github.com/FriendsOfSymfony/FOSUserBundle .. _`implement the \Serializable interface`: http://php.net/manual/en/class.serializable.php From cd5b7c96129a8d3f0720cab1dbec97a7ab7fd6c6 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Fri, 21 Jun 2013 09:30:52 +0200 Subject: [PATCH 0463/2078] Removed repeating text --- book/security.rst | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/book/security.rst b/book/security.rst index edf799f89f0..c69ccd278a2 100644 --- a/book/security.rst +++ b/book/security.rst @@ -686,14 +686,11 @@ see :doc:`/cookbook/security/form_login`. Authorization ------------- -The first step in security is always authentication: the process of verifying -who the user is. With Symfony, authentication can be done in any way - via -a form login, basic HTTP Authentication, or even via Facebook. - -Once the user has been authenticated, authorization begins. Authorization -provides a standard and powerful way to decide if a user can access any resource -(a URL, a model object, a method call, ...). This works by assigning specific -roles to each user, and then requiring different roles for different resources. +The first step in security is always authentication. Once the user has been +authenticated, authorization begins. Authorization provides a standard and +powerful way to decide if a user can access any resource (a URL, a model +object, a method call, ...). This works by assigning specific roles to each +user, and then requiring different roles for different resources. The process of authorization has two different sides: From e8e56a1873dc27b847d1eccb2d42df9668b263b0 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Fri, 21 Jun 2013 14:53:16 +0200 Subject: [PATCH 0464/2078] Removed "see section X" caution Section is the next section after the caution, just 100px below --- book/security.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/book/security.rst b/book/security.rst index c69ccd278a2..f2fa4c44fb7 100644 --- a/book/security.rst +++ b/book/security.rst @@ -709,12 +709,6 @@ URL pattern. You've seen this already in the first example of this chapter, where anything matching the regular expression pattern ``^/admin`` requires the ``ROLE_ADMIN`` role. -.. caution:: - - Understanding exactly how ``access_control`` works is **very** important - to make sure your application is properly secured. See :ref:`security-book-access-control-explanation` - below for detailed information. - You can define as many URL patterns as you need - each is a regular expression. .. configuration-block:: From e2e2036561bddbca40e153aa46515098b55250ff Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 23 Jun 2013 12:53:10 +0200 Subject: [PATCH 0465/2078] Improved list --- book/security.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/book/security.rst b/book/security.rst index f2fa4c44fb7..e966be937f7 100644 --- a/book/security.rst +++ b/book/security.rst @@ -760,12 +760,15 @@ to find *one* that matches the current request. As soon as it finds a matching is used to enforce access. Each ``access_control`` has several options that configure two different -things: (a) :ref:`should the incoming request match this access control entry` -and (b) :ref:`once it matches, should some sort of access restriction be enforced`: +things: + +* :ref:`should the incoming request match this access control entry` +* :ref:`once it matches, should some sort of access restriction be enforced`: .. _security-book-access-control-matching-options: -**(a) Matching Options** +Matching Options +................ Symfony2 creates an instance of :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher` for each ``access_control`` entry, which determines whether or not a given @@ -860,7 +863,8 @@ will match any ``ip``, ``host`` or ``method``: .. _security-book-access-control-enforcement-options: -**(b) Access Enforcement** +Access Enforcement +.................. Once Symfony2 has decided which ``access_control`` entry matches (if any), it then *enforces* access restrictions based on the ``roles`` and ``requires_channel`` From e96d9ffefaae980671a4ee152afcc3b3c6474f6d Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 23 Jun 2013 12:53:21 +0200 Subject: [PATCH 0466/2078] Improved code readability --- book/security.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/book/security.rst b/book/security.rst index e966be937f7..410dd5eca91 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1226,7 +1226,9 @@ class: security: providers: main: - entity: { class: Acme\UserBundle\Entity\User, property: username } + entity: + class: Acme\UserBundle\Entity\User + property: username .. code-block:: xml From 067f205942143f19f0df741b1991900240587c1c Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 29 Jun 2013 20:35:48 +0200 Subject: [PATCH 0467/2078] Moved caution directive to not break colon --- book/security.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/book/security.rst b/book/security.rst index 410dd5eca91..8bb6510504e 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1772,11 +1772,6 @@ Note that you will *not* need to implement a controller for the ``/logout`` URL as the firewall takes care of everything. You *do*, however, need to create a route so that you can use it to generate the URL: -.. caution:: - - As of Symfony 2.1, you *must* have a route that corresponds to your logout - path. Without this route, logging out will not work. - .. configuration-block:: .. code-block:: yaml @@ -1810,6 +1805,11 @@ a route so that you can use it to generate the URL: return $collection; +.. caution:: + + As of Symfony 2.1, you *must* have a route that corresponds to your logout + path. Without this route, logging out will not work. + Once the user has been logged out, he will be redirected to whatever path is defined by the ``target`` parameter above (e.g. the ``homepage``). For more information on configuring the logout, see the From a3a45772d9505b5fa2ec5555b64e15bef8585411 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 29 Jun 2013 20:36:23 +0200 Subject: [PATCH 0468/2078] Do not break twig syntax --- book/security.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/security.rst b/book/security.rst index 8bb6510504e..251452418dd 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1929,7 +1929,7 @@ to show a link to exit impersonation: .. code-block:: html+jinja {% if is_granted('ROLE_PREVIOUS_ADMIN') %} - Exit impersonation + Exit impersonation {% endif %} .. code-block:: html+php From 31443a325d38a4ee26b145318826fdf35f556cdb Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 28 Jul 2013 19:53:10 -0500 Subject: [PATCH 0469/2078] [#2783] Putting back my a/b labels - I think this helps you track the sections and this area - since it deals with security - is very very important --- book/security.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/book/security.rst b/book/security.rst index 251452418dd..d66d79854a5 100644 --- a/book/security.rst +++ b/book/security.rst @@ -762,13 +762,13 @@ is used to enforce access. Each ``access_control`` has several options that configure two different things: -* :ref:`should the incoming request match this access control entry` -* :ref:`once it matches, should some sort of access restriction be enforced`: +* (a) :ref:`should the incoming request match this access control entry` +* (b) :ref:`once it matches, should some sort of access restriction be enforced`: .. _security-book-access-control-matching-options: -Matching Options -................ +(a) Matching Options +.................... Symfony2 creates an instance of :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher` for each ``access_control`` entry, which determines whether or not a given @@ -863,8 +863,8 @@ will match any ``ip``, ``host`` or ``method``: .. _security-book-access-control-enforcement-options: -Access Enforcement -.................. +(b) Access Enforcement +...................... Once Symfony2 has decided which ``access_control`` entry matches (if any), it then *enforces* access restrictions based on the ``roles`` and ``requires_channel`` From 9e536ff4c40544da7f5abbd689dd2b38d4ae15d4 Mon Sep 17 00:00:00 2001 From: Diego Saint Esteben Date: Mon, 29 Jul 2013 13:57:10 -0300 Subject: [PATCH 0470/2078] Referenced oldest but still maintained version in contributing documentation. --- contributing/code/patches.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/contributing/code/patches.rst b/contributing/code/patches.rst index 1ab3fa08fc0..f33c4e36ce6 100644 --- a/contributing/code/patches.rst +++ b/contributing/code/patches.rst @@ -107,13 +107,13 @@ Choose the right Branch Before working on a patch, you must determine on which branch you need to work. The branch should be based on the `master` branch if you want to add a new feature. But if you want to fix a bug, use the oldest but still maintained -version of Symfony where the bug happens (like `2.1`). +version of Symfony where the bug happens (like `2.2`). .. note:: All bug fixes merged into maintenance branches are also merged into more recent branches on a regular basis. For instance, if you submit a patch - for the `2.1` branch, the patch will also be applied by the core team on + for the `2.2` branch, the patch will also be applied by the core team on the `master` branch. Create a Topic Branch @@ -126,18 +126,18 @@ topic branch: $ git checkout -b BRANCH_NAME master -Or, if you want to provide a bugfix for the 2.1 branch, first track the remote -`2.1` branch locally: +Or, if you want to provide a bugfix for the 2.2 branch, first track the remote +`2.2` branch locally: .. code-block:: bash - $ git checkout -t origin/2.1 + $ git checkout -t origin/2.2 -Then create a new branch off the 2.1 branch to work on the bugfix: +Then create a new branch off the 2.2 branch to work on the bugfix: .. code-block:: bash - $ git checkout -b BRANCH_NAME 2.1 + $ git checkout -b BRANCH_NAME 2.2 .. tip:: @@ -230,7 +230,7 @@ while to finish your changes): .. tip:: - Replace `master` with `2.1` if you are working on a bugfix + Replace `master` with `2.2` if you are working on a bugfix When doing the ``rebase`` command, you might have to fix merge conflicts. ``git status`` will show you the *unmerged* files. Resolve all the conflicts, @@ -254,8 +254,8 @@ You can now make a pull request on the ``symfony/symfony`` Github repository. .. tip:: - Take care to point your pull request towards ``symfony:2.1`` if you want - the core team to pull a bugfix based on the 2.1 branch. + Take care to point your pull request towards ``symfony:2.2`` if you want + the core team to pull a bugfix based on the 2.2 branch. To ease the core team work, always include the modified components in your pull request message, like in: From 7a46d3068c0f53e3f4f4701c6012564fab069c1f Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 16 Jun 2013 17:39:08 +0200 Subject: [PATCH 0471/2078] Rewrote Templating Docs --- components/index.rst | 2 +- components/map.rst.inc | 4 +- components/templating.rst | 113 --------------- .../templating/helpers/assetshelper.rst | 102 ++++++++++++++ components/templating/helpers/index.rst | 16 +++ components/templating/helpers/map.rst.inc | 2 + components/templating/helpers/slotshelper.rst | 84 ++++++++++++ components/templating/index.rst | 8 ++ components/templating/introduction.rst | 129 ++++++++++++++++++ cookbook/templating/PHP.rst | 2 +- redirection_map | 1 + 11 files changed, 346 insertions(+), 117 deletions(-) delete mode 100644 components/templating.rst create mode 100644 components/templating/helpers/assetshelper.rst create mode 100644 components/templating/helpers/index.rst create mode 100644 components/templating/helpers/map.rst.inc create mode 100644 components/templating/helpers/slotshelper.rst create mode 100644 components/templating/index.rst create mode 100644 components/templating/introduction.rst diff --git a/components/index.rst b/components/index.rst index 090152afa61..865b2b274e6 100644 --- a/components/index.rst +++ b/components/index.rst @@ -24,7 +24,7 @@ The Components security/index serializer stopwatch - templating + templating/index yaml/index .. include:: /components/map.rst.inc diff --git a/components/map.rst.inc b/components/map.rst.inc index c14df50277c..2e92fbab740 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -102,9 +102,9 @@ * :doc:`/components/security/authentication` * :doc:`/components/security/authorization` -* **Templating** +* :doc:`/components/templating/index` - * :doc:`/components/templating` + * :doc:`/components/templating/introduction` * :doc:`/components/yaml/index` diff --git a/components/templating.rst b/components/templating.rst deleted file mode 100644 index de53eec0cc4..00000000000 --- a/components/templating.rst +++ /dev/null @@ -1,113 +0,0 @@ -.. index:: - single: Templating - single: Components; Templating - -The Templating Component -======================== - - Templating provides all the tools needed to build any kind of template - system. - - It provides an infrastructure to load template files and optionally monitor - them for changes. It also provides a concrete template engine implementation - using PHP with additional tools for escaping and separating templates into - blocks and layouts. - -Installation ------------- - -You can install the component in 2 different ways: - -* Use the official Git repository (https://github.com/symfony/Templating); -* :doc:`Install it via Composer ` (``symfony/templating`` on `Packagist`_). - -Usage ------ - -The :class:`Symfony\\Component\\Templating\\PhpEngine` class is the entry point -of the component. It needs a template name parser -(:class:`Symfony\\Component\\Templating\\TemplateNameParserInterface`) to -convert a template name to a template reference and template loader -(:class:`Symfony\\Component\\Templating\\Loader\\LoaderInterface`) to find the -template associated to a reference:: - - use Symfony\Component\Templating\PhpEngine; - use Symfony\Component\Templating\TemplateNameParser; - use Symfony\Component\Templating\Loader\FilesystemLoader; - - $loader = new FilesystemLoader(__DIR__ . '/views/%name%'); - - $view = new PhpEngine(new TemplateNameParser(), $loader); - - echo $view->render('hello.php', array('firstname' => 'Fabien')); - -The :method:`Symfony\\Component\\Templating\\PhpEngine::render` method executes -the file `views/hello.php` and returns the output text. - -.. code-block:: html+php - - - Hello, ! - -Template Inheritance with Slots -------------------------------- - -The template inheritance is designed to share layouts with many templates. - -.. code-block:: html+php - - - - - <?php $view['slots']->output('title', 'Default title') ?> - - - output('_content') ?> - - - -The :method:`Symfony\\Component\\Templating\\PhpEngine::extend` method is called in the -sub-template to set its parent template. - -.. code-block:: html+php - - - extend('layout.php') ?> - - set('title', $page->title) ?> - -

- title ?> -

-

- body ?> -

- -To use template inheritance, the :class:`Symfony\\Component\\Templating\\Helper\\SlotsHelper` -helper must be registered:: - - use Symfony\Component\Templating\Helper\SlotsHelper; - - $view->set(new SlotsHelper()); - - // Retrieve page object - $page = ...; - - echo $view->render('page.php', array('page' => $page)); - -.. note:: - - Multiple levels of inheritance is possible: a layout can extend an other - layout. - -Output Escaping ---------------- - -This documentation is still being written. - -The Asset Helper ----------------- - -This documentation is still being written. - -.. _Packagist: https://packagist.org/packages/symfony/templating diff --git a/components/templating/helpers/assetshelper.rst b/components/templating/helpers/assetshelper.rst new file mode 100644 index 00000000000..9a35fb90324 --- /dev/null +++ b/components/templating/helpers/assetshelper.rst @@ -0,0 +1,102 @@ +.. index:: + single: Templating Helpers; Assets Helper + +Assets Helper +============= + +The assets helper's main purpose is to make your application more portable by +generating assets' paths: + +.. code-block:: html+php + + + + + +Configure Paths +--------------- + +By default, the assets helper will prefix all paths with a slash. You can +extend this by configuring a basepath in the first argument of the +constructor:: + + use Symfony\Component\Templating\Helper\AssetsHelper; + + // ... + $templateEngine->set(new AssetsHelper('/foo/bar')); + +Now, if you use the helper everything will be prefixed with ``/foo/bar``: + +.. code-block:: html+php + + + + +Absolute Urls +------------- + +You can also specify a url to use in the second parameter of the constructor:: + + // ... + $templateEngine->set(new AssetsHelper(null, 'http://cdn.example.com/')); + +Now urls are rendered like ``http://cdn.example.com/images/logo.png``. + +Versioning +---------- + +To avoid using the cached resource after updating the old resource, you can +use versions which you bump every time you release a new project. The version +can be specified in the third argument:: + + // ... + $templateEngine->set(new AssetsHelper(null, null, '328rad75')); + +Now, every url is suffixed with ``?328rad75``. If you want to have a different +format, you can specify the new format in fourth argument. It's a string that +is used in :phpfunction:`sprintf`. The first argument is the path and the +second is the version. For instance, ``%s?v=%s`` will be rendered as +``/images/logo.png?v=328rad75``. + +Multiple Packages +----------------- + +Paths are internally handled by packages. The component provides 2 packages by +default: + +* :class:`Symfony\\Component\\Templating\\Asset\\PathPackage` +* :class:`Symfony\\Component\\Templating\\Asset\\UrlPackage` + +You can also have multiple packages:: + + // ... + $templateEngine->set(new AssetsHelper()); + + $templateEngine->get('assets')->addPackage('images', new PathPackage('/images/')); + $templateEngine->get('assets')->addPackage('scripts', new PathPackage('/scripts/')); + +This will setup the assets helper with 3 packages: the default package which +defaults to ``/`` (set by the constructor), the images package which prefixes +it with ``/images/`` and the scripts package which prefixes it with +``/scripts/``. + +If you want to set another default package, you can use +:method:`Symfony\\Component\\Templating\\Helper\\AssetsHelper::setDefaultPackage`. + +You can specify which package you want to use in the second argument of +:method:`Symfony\\Component\\Templating\\Helper\\AssetsHelper::getUrl`: + +.. code-block:: php+html + + + + +Custom Packages +--------------- + +You can create your own package by extending +:class:`Symfony\\Component\\Templating\\Package\\Package`. diff --git a/components/templating/helpers/index.rst b/components/templating/helpers/index.rst new file mode 100644 index 00000000000..572c5aebe4d --- /dev/null +++ b/components/templating/helpers/index.rst @@ -0,0 +1,16 @@ +.. index:: + single: Templating; Templating Helpers + +The Templating Helpers +====================== + +.. toctree:: + :hidden: + + slotshelper + assetshelper + +The Templating Component comes with some useful helpers. These helpers contain +functions to ease some common tasks. + +.. include:: map.rst.inc diff --git a/components/templating/helpers/map.rst.inc b/components/templating/helpers/map.rst.inc new file mode 100644 index 00000000000..7af793aaa1c --- /dev/null +++ b/components/templating/helpers/map.rst.inc @@ -0,0 +1,2 @@ +* :doc:`/components/templating/helpers/slotshelper` +* :doc:`/components/templating/helpers/assetshelper` diff --git a/components/templating/helpers/slotshelper.rst b/components/templating/helpers/slotshelper.rst new file mode 100644 index 00000000000..e79cc88c09e --- /dev/null +++ b/components/templating/helpers/slotshelper.rst @@ -0,0 +1,84 @@ +.. index:: + single: Templating Helpers; Slots Helper + +Slots Helper +============ + +More often than not, templates in a project share common elements, like the +well-known header and footer. The static HTML code can be placed in a layout file +and the dynamic sections are replaced by slots, which are filled by the child +template; the layout file decorates the child template. + +Displaying Slots +~~~~~~~~~~~~~~~~ + +The slots are accessible by using the slots helper (``$view['slots']``). Use +:method:`Symfony\\Component\\Templating\\Helper\\SlotsHelper::output` to +display the content of the slot on that place: + +.. code-block:: html+php + + + + + + <?php $view['slots']->output('title', 'Default title') ?> + + + output('_content') ?> + + + +The first argument of the method is the name of the slot. The method has an +optional second argument, which is the default value to use if the slot is not +available. + +The ``_content`` slot is a special slot set by the ``PhpEngine``. It contains +the content of the subtemplate. + +.. caution:: + + If you're using the standalone component, make sure you registered the + :class:`Symfony\\Component\\Templating\\Helper\\SlotsHelper`:: + + use Symfony\Component\Templating\Helper\SlotsHelper; + + // ... + $templateEngine->set(new SlotsHelper()); + +Extending Templates +~~~~~~~~~~~~~~~~~~~ + +The :method:`Symfony\\Component\\Templating\\PhpEngine::extend` method is called in the +sub-template to set its parent template. Then +:method:`$view['slots']->set() +` can be used to +set the content of a slot. All content which is not explicitly set in a slot +is in the ``_content`` slot. + +.. code-block:: html+php + + + extend('layout.php') ?> + + set('title', $page->title) ?> + +

+ title ?> +

+

+ body ?> +

+ +.. note:: + + Multiple levels of inheritance is possible: a layout can extend an other + layout. + +For large slots, there is also an extended syntax: + +.. code-block:: html+php + + start('title') ?> + Some large amount of HTML + stop() ?> diff --git a/components/templating/index.rst b/components/templating/index.rst new file mode 100644 index 00000000000..6db2575e8f6 --- /dev/null +++ b/components/templating/index.rst @@ -0,0 +1,8 @@ +Templating +========== + +.. toctree:: + :maxdepth: 2 + + introduction + helpers/index diff --git a/components/templating/introduction.rst b/components/templating/introduction.rst new file mode 100644 index 00000000000..d6704abb3ac --- /dev/null +++ b/components/templating/introduction.rst @@ -0,0 +1,129 @@ +.. index:: + single: Templating + single: Components; Templating + +The Templating Component +======================== + + The Templating Component provides all the tools needed to build any kind + of template system. + + It provides an infrastructure to load template files and optionally + monitor them for changes. It also provides a concrete template engine + implementation using PHP with additional tools for escaping and separating + templates into blocks and layouts. + +Installation +------------ + +You can install the component in 2 different ways: + +* Use the official Git repository (https://github.com/symfony/Templating); +* :doc:`Install it via Composer ` (``symfony/templating`` on `Packagist`_). + +Usage +----- + +The :class:`Symfony\\Component\\Templating\\PhpEngine` class is the entry point +of the component. It needs a +:class:`template name parser ` +to convert a template name to a +:class:`template reference ` +and :class:`template loader ` +to find the template associated to a reference:: + + use Symfony\Component\Templating\PhpEngine; + use Symfony\Component\Templating\TemplateNameParser; + use Symfony\Component\Templating\Loader\FilesystemLoader; + + $loader = new FilesystemLoader(__DIR__.'/views/%name%'); + + $templating = new PhpEngine(new TemplateNameParser(), $loader); + + echo $templating->render('hello.php', array('firstname' => 'Fabien')); + +.. code-block:: html+php + + + Hello, ! + +The :method:`Symfony\\Component\\Templating\\PhpEngine::render` method parses +the ``views/hello.php`` file and returns the output text. The second argument +of ``render`` is an array of variables to use in the template. In this +example, the result will be ``Hello, Fabien!``. + +The ``$view`` variable +---------------------- + +In all templates parsed by the ``PhpEngine``, you get access to a mysterious +variable called ``$view``. That variable holds the current ``PhpEngine`` +instance. That means you get access to a bunch of methods that makes your life +easier. + +Including Templates +------------------- + +The best way to share a snippet of template code is to define a template that +can then be included into other templates. As the ``$view`` variable is an +instance of ``PhpEngine``, you can use the ``render`` method (which was used +to render the template) inside the template to render another template:: + + + + render('hello.php', array('firstname' => $name)) ?> + + +Output Escaping +--------------- + +When you display variables to the user, you should escape them using the +:method:`Symfony\\Component\\Templating\\PhpEngine::escape` method:: + + escape($firstname) ?> + +By default, the ``escape()`` method assumes that the variable is outputted +within an HTML context. The second argument lets you change the context. For +instance, to output something in a JavaScript script, use the ``js`` context:: + + escape($var, 'js') ?> + +The components comes with a HTML and JS escaper. You can register your own +escaper using the +:method:`Symfony\\Component\\Templating\\PhpEngine::setEscaper` method:: + + $templating->setEscaper('css', function ($value) { + // ... all CSS escaping + + return $escapedValue; + }); + +Helpers +------- + +The Templating component can be easily extended via helpers. The component has +2 build-in helpers: + +* :doc:`/components/helpers/assetshelper` +* :doc:`/components/helpers/slotshelper` + +Before you can use these helpers, you need to register them using +:method:`Symfony\\Component\\Templating\\PhpEngine::set`:: + + use Symfony\Component\Templating\Helper\AssetsHelper; + // ... + + $templating->set(new AssetsHelper()); + +Custom Helpers +~~~~~~~~~~~~~~ + +You can create your own helpers by creating a class which implements +:class:`Symfony\\Component\\Templating\\Helper\\HelperInterface`. However, +most of the time you'll extend +:class:`Symfony\\Component\\Templating\\Helper\\Helper`. + +The ``Helper`` has one required method: +:method:`Symfony\\Component\\Templating\\Helper\\HelperInterface::getName`. +This is the name that is used to get the helper from the ``$view`` object. + +.. _Packagist: https://packagist.org/packages/symfony/templating diff --git a/cookbook/templating/PHP.rst b/cookbook/templating/PHP.rst index 40f03611fd0..24a1b16d488 100644 --- a/cookbook/templating/PHP.rst +++ b/cookbook/templating/PHP.rst @@ -4,7 +4,7 @@ How to use PHP instead of Twig for Templates ============================================ -Even if Symfony2 defaults to Twig for its template engine, you can still use +Symfony2 defaults to Twig for its template engine, but you can still use plain PHP code if you want. Both templating engines are supported equally in Symfony2. Symfony2 adds some nice features on top of PHP to make writing templates with PHP more powerful. diff --git a/redirection_map b/redirection_map index 054ad65c416..36dd9800c63 100644 --- a/redirection_map +++ b/redirection_map @@ -20,3 +20,4 @@ /components/routing /components/routing/introduction /cookbook/console/generating_urls /cookbook/console/sending_emails /components/yaml /components/yaml/introduction +/components/templating /components/templating/introduction From 39e8094035f31632415c28c519ecc8327c476bf8 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 29 Jun 2013 19:53:14 +0200 Subject: [PATCH 0472/2078] Added documentation about profiler matchers --- cookbook/map.rst.inc | 1 + cookbook/profiler/index.rst | 1 + cookbook/profiler/matchers.rst | 164 +++++++++++++++++++++++++++++++++ 3 files changed, 166 insertions(+) create mode 100644 cookbook/profiler/matchers.rst diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index ca5f6610a39..bc45ca0fd89 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -100,6 +100,7 @@ * :doc:`/cookbook/profiler/index` * :doc:`/cookbook/profiler/data_collector` + * :doc:`/cookbook/profiler/matchers` * :doc:`/cookbook/request/index` diff --git a/cookbook/profiler/index.rst b/cookbook/profiler/index.rst index 1e71a47d187..3900380f932 100644 --- a/cookbook/profiler/index.rst +++ b/cookbook/profiler/index.rst @@ -5,3 +5,4 @@ Profiler :maxdepth: 2 data_collector + matchers diff --git a/cookbook/profiler/matchers.rst b/cookbook/profiler/matchers.rst new file mode 100644 index 00000000000..47789b24a96 --- /dev/null +++ b/cookbook/profiler/matchers.rst @@ -0,0 +1,164 @@ +.. index:: + single: Profiling; Matchers + +How to use Matchers to enable the Profiler +========================================== + +By default, the profiler is only activated in the development environment. But +it's imaginable that a developer always wants to see the profiler, even in +production. Another situation may be to show the profiler when an admin has +logged in. You can enable the profiler in these situations by using matchers. + +Using the build-in Matcher +-------------------------- + +Symfony2 provides a +:class:`build-in matcher ` +which can match paths and IPs. For instance, only show the profiler when +accessing the page with the ``168.0.0.1`` ip. Then, the profiler can be +configured to something like this: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + framework: + # ... + profiler: + matcher: + ip: 168.0.0.1 + + .. code-block:: xml + + + + + + + .. code-block:: php + + // app/config/config.php + $container->loadFromExtension('framework', array( + 'profiler' => array( + 'ip' => '168.0.0.1', + ), + )); + +You can also set a ``path`` option to define the path on which the profiler +should be enabled. For instance, setting it to `^/admin/` will enable the +profiler only for the ``/admin/`` urls. + +Creating a Custom Matcher +------------------------- + +You can also create a custom matcher. This is a service that checks whether +the profiler should be enabled or not. To create that service, create a class +which implements +:class:`Symfony\\Component\\HttpFoundation\\RequestMatcherInterface`. This +interface requires one method: +:method:`Symfony\\Component\\HttpFoundation\\RequestMatcherInterface::matches`. +This method returns a falsey value to disable the profiler, any other value +enables the profiler. + +To enable the profiler when a ``ROLE_SUPER_ADMIN`` is logged in, you can use +something like:: + + // src/Acme/DemoBundle/Profiler/SuperAdminMatcher.php + namespace Acme\DemoBundle\Profiler; + + use Symfony\Component\Security\Core\SecurityContext; + use Symfony\Component\HttpFoundation\Request; + use Symfony\Component\HttpFoundation\RequestMatcherInterface; + + class SuperAdminMatcher implements RequestMatcherInterface + { + protected $securityContext; + + public function __construct(SecurityContext $securityContext) + { + $this->securityContext = $securityContext; + } + + public function matches(Request $request) + { + return $this->securityContext->isGranted('ROLE_SUPER_ADMIN'); + } + } + +Then, you need to configure the service: + +.. configuration-block:: + + .. code-block:: yaml + + parameters: + acme_demo.profiler.matcher.super_admin.class: Acme\DemoBundle\Profiler\SuperAdminMatcher + + services: + acme_demo.profiler.matcher.super_admin: + class: "%acme_demo.profiler.matcher.super_admin.class%" + arguments: [@security.context] + + .. code-block:: xml + + + Acme\DemoBundle\Profiler\SuperAdminMatcher + + + + + + + + .. code-block:: php + + use Symfony\Component\DependencyInjection\Definition; + use Symfony\Component\DependencyInjection\Reference; + + $container->setParameter( + 'acme_demo.profiler.matcher.super_admin.class', + 'Acme\DemoBundle\Profiler\SuperAdminMatcher' + ); + + $container->setDefinition('acme_demo.profiler.matcher.super_admin', new Definition( + '%acme_demo.profiler.matcher.super_admin.class%', + array(new Reference('security.context')) + ); + +Now the service is registered, the only thing left to do is configure the +profiler to use this service as the matcher: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + framework: + # ... + profiler: + matcher: + service: acme_demo.profiler.matcher.super_admin + + .. code-block:: xml + + + + + + + .. code-block:: php + + // app/config/config.php + $container->loadFromExtension('framework', array( + 'profiler' => array( + 'service' => 'acme_demo.profiler.matcher.super_admin', + ), + )); From 1038fb80771a8502be0f723633199cd523cf3948 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Tue, 30 Jul 2013 10:10:50 +0200 Subject: [PATCH 0473/2078] Removed duplicated stuff --- book/internals.rst | 87 ++-------------------------------------------- 1 file changed, 2 insertions(+), 85 deletions(-) diff --git a/book/internals.rst b/book/internals.rst index d61951b86fb..43d41a0b4e5 100644 --- a/book/internals.rst +++ b/book/internals.rst @@ -620,91 +620,8 @@ As the profiler adds some overhead, you might want to enable it only under certain circumstances in the production environment. The ``only-exceptions`` settings limits profiling to 500 pages, but what if you want to get information when the client IP comes from a specific address, or for a limited -portion of the website? You can use a request matcher: - -.. configuration-block:: - - .. code-block:: yaml - - # enables the profiler only for request coming for the 192.168.0.0 network - framework: - profiler: - matcher: { ip: 192.168.0.0/24 } - - # enables the profiler only for the /admin URLs - framework: - profiler: - matcher: { path: "^/admin/" } - - # combine rules - framework: - profiler: - matcher: { ip: 192.168.0.0/24, path: "^/admin/" } - - # use a custom matcher instance defined in the "custom_matcher" service - framework: - profiler: - matcher: { service: custom_matcher } - - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .. code-block:: php - - // enables the profiler only for request coming for the 192.168.0.0 network - $container->loadFromExtension('framework', array( - 'profiler' => array( - 'matcher' => array('ip' => '192.168.0.0/24'), - ), - )); - - // enables the profiler only for the /admin URLs - $container->loadFromExtension('framework', array( - 'profiler' => array( - 'matcher' => array('path' => '^/admin/'), - ), - )); - - // combine rules - $container->loadFromExtension('framework', array( - 'profiler' => array( - 'matcher' => array('ip' => '192.168.0.0/24', 'path' => '^/admin/'), - ), - )); - - # use a custom matcher instance defined in the "custom_matcher" service - $container->loadFromExtension('framework', array( - 'profiler' => array( - 'matcher' => array('service' => 'custom_matcher'), - ), - )); +portion of the website? You can use a Profiler Matcher, learn more about that +in ":doc:`/cookbook/profiler/matchers`". Learn more from the Cookbook ---------------------------- From 23dd6385fbdd643656f96ea37ca3b16d21706a48 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Tue, 30 Jul 2013 16:20:17 +0200 Subject: [PATCH 0474/2078] fixed XML examples --- book/controller.rst | 28 +++- book/doctrine.rst | 67 +++++--- book/forms.rst | 64 +++++--- book/http_cache.rst | 31 +++- book/http_fundamentals.rst | 13 +- book/internals.rst | 50 +++--- book/page_creation.rst | 67 ++++---- book/propel.rst | 3 +- book/routing.rst | 29 ++-- book/security.rst | 18 +-- book/service_container.rst | 219 +++++++++++++++++---------- book/templating.rst | 72 +++++++-- book/testing.rst | 8 +- book/translation.rst | 45 ++++-- book/validation.rst | 200 ++++++++++++++---------- reference/configuration/doctrine.rst | 1 + 16 files changed, 594 insertions(+), 321 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 921c1d905a4..f545868bb99 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -156,9 +156,16 @@ to the controller: .. code-block:: xml - - AcmeHelloBundle:Hello:index - + + + + + AcmeHelloBundle:Hello:index + + .. code-block:: php @@ -235,10 +242,17 @@ example: .. code-block:: xml - - AcmeHelloBundle:Hello:index - green - + + + + + AcmeHelloBundle:Hello:index + green + + .. code-block:: php diff --git a/book/doctrine.rst b/book/doctrine.rst index a91c3368f7c..1b96994dff9 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -80,15 +80,24 @@ information. By convention, this information is usually configured in an .. code-block:: xml - - - + + + + + + + + .. code-block:: php @@ -161,13 +170,22 @@ for you: .. code-block:: xml - - - + + + + + + + + .. code-block:: php @@ -299,6 +317,7 @@ in a number of different formats including YAML, XML or directly inside the .. code-block:: xml + + @@ -1332,9 +1353,11 @@ the current date, only when the entity is first persisted (i.e. inserted): .. code-block:: xml - - - + + diff --git a/book/forms.rst b/book/forms.rst index 5a71b220b37..08885c0996b 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -319,7 +319,11 @@ object. - + + @@ -912,10 +916,16 @@ easy to use in your application. .. code-block:: xml - - - + + + + + .. code-block:: php @@ -1375,12 +1385,20 @@ file: .. code-block:: xml - - - AcmeTaskBundle:Form:fields.html.twig - - - + + + + + + AcmeTaskBundle:Form:fields.html.twig + + + + .. code-block:: php @@ -1453,14 +1471,22 @@ file: .. code-block:: xml - - - - AcmeTaskBundle:Form - - - - + + + + + + + AcmeTaskBundle:Form + + + + + .. code-block:: php diff --git a/book/http_cache.rst b/book/http_cache.rst index 1856ee5ce80..356fb03da02 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -845,10 +845,19 @@ First, to use ESI, be sure to enable it in your application configuration: .. code-block:: xml - - - - + + + + + + + + + .. code-block:: php @@ -957,9 +966,17 @@ listener that must be enabled in your configuration: .. code-block:: xml - - - + + + + + + + .. code-block:: php diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index 8ead7a1299b..1654678bffc 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -429,9 +429,16 @@ by adding an entry for ``/contact`` to your routing configuration file: .. code-block:: xml - - AcmeDemoBundle:Main:contact - + + + + + AcmeDemoBundle:Main:contact + + .. code-block:: php diff --git a/book/internals.rst b/book/internals.rst index 17200f86db4..769dc75fedc 100644 --- a/book/internals.rst +++ b/book/internals.rst @@ -566,20 +566,27 @@ the configuration for the development environment: .. code-block:: xml - - - - - - - - - - + + + + + + + + + + + .. code-block:: php @@ -614,10 +621,17 @@ If you enable the web profiler, you also need to mount the profiler routes: .. code-block:: xml - + + + + + .. code-block:: php diff --git a/book/page_creation.rst b/book/page_creation.rst index b037cfd5224..dc100a0c5e4 100644 --- a/book/page_creation.rst +++ b/book/page_creation.rst @@ -147,7 +147,6 @@ an entry when you generated the ``AcmeHelloBundle``: - - - - + + + + + + + + + + + + + + + - - - - - - - - + .. code-block:: php @@ -976,18 +984,25 @@ the configuration file for the ``dev`` environment. .. code-block:: xml - - - - - - - - - - + + + + + + + + + + + + + .. code-block:: php diff --git a/book/propel.rst b/book/propel.rst index 900d0d81847..4c6443f9a01 100644 --- a/book/propel.rst +++ b/book/propel.rst @@ -90,7 +90,7 @@ of your ``AcmeStoreBundle``: .. code-block:: xml - + diff --git a/book/routing.rst b/book/routing.rst index eb7b64fd1b8..edeb3f35826 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -166,10 +166,18 @@ file: .. code-block:: xml - - - - + + + + + + + + .. code-block:: php @@ -207,7 +215,6 @@ A basic route consists of just two parts: the ``path`` to match and a .. code-block:: xml - - - - - - - - - - - - - - - - + xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> @@ -311,16 +308,14 @@ First, enable form login under your firewall: .. code-block:: xml + - - - @@ -387,7 +382,6 @@ submission (i.e. ``/login_check``): - AcmeSecurityBundle:Security:login - + .. code-block:: php @@ -650,7 +644,7 @@ see :doc:`/cookbook/security/form_login`. - + .. code-block:: php @@ -1784,14 +1778,12 @@ a route so that you can use it to generate the URL: - - .. code-block:: php diff --git a/book/service_container.rst b/book/service_container.rst index 29375a6f352..21a83d89379 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -116,11 +116,17 @@ be specified in YAML, XML or PHP: .. code-block:: xml - - - sendmail - - + + + + + + sendmail + + + .. code-block:: php @@ -206,16 +212,22 @@ straightforward. Parameters make defining services more organized and flexible: .. code-block:: xml - - Acme\HelloBundle\Mailer - sendmail - - - - - %my_mailer.transport% - - + + + + + Acme\HelloBundle\Mailer + sendmail + + + + + %my_mailer.transport% + + + .. code-block:: php @@ -349,16 +361,22 @@ directories don't exist, create them. .. code-block:: xml - - Acme\HelloBundle\Mailer - sendmail - - - - - %my_mailer.transport% - - + + + + + Acme\HelloBundle\Mailer + sendmail + + + + + %my_mailer.transport% + + + .. code-block:: php @@ -389,9 +407,15 @@ configuration. .. code-block:: xml - - - + + + + + + + .. code-block:: php @@ -459,12 +483,20 @@ invokes the service container extension inside the ``FrameworkBundle``: .. code-block:: xml - - - - - - + + + + + + + + + + .. code-block:: php @@ -590,19 +622,25 @@ the service container gives you a much more appealing option: .. code-block:: xml - - - Acme\HelloBundle\Newsletter\NewsletterManager - - - - - - - - - - + + + + + + Acme\HelloBundle\Newsletter\NewsletterManager + + + + + + + + + + + .. code-block:: php @@ -681,21 +719,27 @@ Injecting the dependency by the setter method just needs a change of syntax: .. code-block:: xml - - - Acme\HelloBundle\Newsletter\NewsletterManager - - - - - - - - - - - - + + + + + + Acme\HelloBundle\Newsletter\NewsletterManager + + + + + + + + + + + + + .. code-block:: php @@ -748,15 +792,20 @@ it exists and do nothing if it doesn't: .. code-block:: xml - - - - - - - - - + + + + + + + + + + + + .. code-block:: php @@ -854,10 +903,16 @@ Configuring the service container is easy: .. code-block:: xml - - - - + + + + + + + + .. code-block:: php @@ -903,10 +958,16 @@ to be used for a specific purpose. Take the following example: .. code-block:: xml - - - + + + + + + + .. code-block:: php diff --git a/book/templating.rst b/book/templating.rst index adad3623859..83023853559 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -722,9 +722,17 @@ tags: .. code-block:: xml - - - + + + + + + + .. code-block:: php @@ -750,10 +758,18 @@ in your application configuration: .. code-block:: xml - - - + + + + + + + .. code-block:: php @@ -837,9 +853,16 @@ configuration: .. code-block:: xml - - AcmeDemoBundle:Welcome:index - + + + + + AcmeDemoBundle:Welcome:index + + .. code-block:: php @@ -875,9 +898,16 @@ route: .. code-block:: xml - - AcmeArticleBundle:Article:show - + + + + + AcmeArticleBundle:Article:show + + .. code-block:: php @@ -1134,9 +1164,19 @@ configuration file: .. code-block:: xml - - - + + + + + + + + + .. code-block:: php diff --git a/book/testing.rst b/book/testing.rst index 05037850bcd..e015e83228f 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -694,7 +694,13 @@ configuration option: .. code-block:: xml - + + + diff --git a/book/translation.rst b/book/translation.rst index 58add6ec2c8..7abf5c56dda 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -61,9 +61,17 @@ enable the ``Translator`` in your configuration: .. code-block:: xml - - - + + + + + + + .. code-block:: php @@ -546,9 +554,17 @@ by defining a ``default_locale`` for the framework: .. code-block:: xml - - en - + + + + + en + + .. code-block:: php @@ -590,11 +606,18 @@ by the routing system using the special ``_locale`` parameter: .. code-block:: xml - - AcmeDemoBundle:Contact:index - en - en|fr|de - + + + + + AcmeDemoBundle:Contact:index + en + en|fr|de + + .. code-block:: php diff --git a/book/validation.rst b/book/validation.rst index 99a3d7691a1..e33e9b55812 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -263,9 +263,17 @@ annotations if you're using the annotation method to specify your constraints: .. code-block:: xml - - - + + + + + + + .. code-block:: php @@ -526,14 +534,20 @@ class to have at least 3 characters. .. code-block:: xml - - - - - - - - + + + + + + + + + + + + .. code-block:: php @@ -605,13 +619,19 @@ this method must return ``true``: .. code-block:: xml - - - - - - - + + + + + + + + + + + .. code-block:: php @@ -717,33 +737,39 @@ user registers and when a user updates his/her contact information later: .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + .. code-block:: php @@ -874,26 +900,32 @@ username and the password are different only if all other validation passes .. code-block:: xml - - - - - - - - - - - - - - - User - Strict - - + + + + + + + + + + + + + + + + + + User + Strict + + + .. code-block:: php @@ -983,22 +1015,28 @@ entity and a new constraint group called ``Premium``: .. code-block:: xml - - - - - - - - - - - - + + + + + + + + + + + + + + + + .. code-block:: php diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index c2115238e27..2ed564e6200 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -170,6 +170,7 @@ Doctrine Configuration Reference .. code-block:: xml + Date: Fri, 2 Aug 2013 09:57:59 +0200 Subject: [PATCH 0475/2078] fixing commands in the reverse engineering example --- cookbook/doctrine/reverse_engineering.rst | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/cookbook/doctrine/reverse_engineering.rst b/cookbook/doctrine/reverse_engineering.rst index f915a37ce44..0c5c22c355e 100644 --- a/cookbook/doctrine/reverse_engineering.rst +++ b/cookbook/doctrine/reverse_engineering.rst @@ -56,11 +56,11 @@ folder. The first step towards building entity classes from an existing database is to ask Doctrine to introspect the database and generate the corresponding metadata files. Metadata files describe the entity class to generate based on -tables fields. +table fields. .. code-block:: bash - $ php app/console doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine --from-database --force + $ php app/console doctrine:mapping:import --force AcmeBlogBundle xml This command line tool asks Doctrine to introspect the database and generate the XML metadata files under the ``src/Acme/BlogBundle/Resources/config/doctrine`` @@ -69,8 +69,8 @@ folder of your bundle. This generates two files: ``BlogPost.orm.xml`` and .. tip:: - It's also possible to generate metadata class in YAML format by changing the - first argument to ``yml``. + It's also possible to generate the metadata files in YAML format by changing + the last argument to ``yml``. The generated ``BlogPost.orm.xml`` metadata file looks as follows: @@ -78,7 +78,7 @@ The generated ``BlogPost.orm.xml`` metadata file looks as follows: - + @@ -88,13 +88,6 @@ The generated ``BlogPost.orm.xml`` metadata file looks as follows: -Update the namespace in the ``name`` attribute of the ``entity`` element like -this: - -.. code-block:: xml - - - Once the metadata files are generated, you can ask Doctrine to build related entity classes by executing the following two commands. @@ -103,14 +96,14 @@ entity classes by executing the following two commands. $ php app/console doctrine:mapping:convert annotation ./src $ php app/console doctrine:generate:entities AcmeBlogBundle -The first command generates entity classes with an annotations mapping. But +The first command generates entity classes with annotation mappings. But if you want to use yml or xml mapping instead of annotations, you should execute the second command only. .. tip:: - If you want to use annotations, you can safely delete the XML files after - running these two commands. + If you want to use annotations, you can safely delete the XML (or YAML) files + after running these two commands. For example, the newly created ``BlogComment`` entity class looks as follow:: From f73e5ce50444717aa0980ae24210e4a6c53a1092 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 5 Aug 2013 15:14:39 -0700 Subject: [PATCH 0476/2078] Revert "[#2630] Tweaking language" This reverts commit fb1089f837927b6f937914e36645b7269a43cd27. --- reference/twig_reference.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 40354551d55..a6cbfc1d8a4 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -154,7 +154,7 @@ Tags | | current template | +---------------------------------------------------+--------------------------------------------------------------------+ | ``{% stopwatch name %}...{% endstopwatch %}`` | This will time the run time of the code inside it and put that on | -| | the timeline of the profiler. | +| | the timeline of the WebDeveloperBundle. | +---------------------------------------------------+--------------------------------------------------------------------+ Tests From 92c66a58cbf47df070e1964bdd7b4c040aa04a21 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 5 Aug 2013 15:14:56 -0700 Subject: [PATCH 0477/2078] Revert "Added new tag" This reverts commit 26500fbd282a3f545330dcb56a27152a1473156d. --- reference/twig_reference.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index a6cbfc1d8a4..b6960b1e729 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -134,9 +134,6 @@ Filters Tags ---- -.. versionadded:: 2.3 - The stopwatch tag was added in Symfony 2.3 - +---------------------------------------------------+--------------------------------------------------------------------+ | Tag Syntax | Usage | +===================================================+====================================================================+ @@ -153,9 +150,6 @@ Tags | ``{% trans_default_domain language %}`` | This will set the default domain for message catalogues in the | | | current template | +---------------------------------------------------+--------------------------------------------------------------------+ -| ``{% stopwatch name %}...{% endstopwatch %}`` | This will time the run time of the code inside it and put that on | -| | the timeline of the WebDeveloperBundle. | -+---------------------------------------------------+--------------------------------------------------------------------+ Tests ----- From dbafcf9f472ad277d1b2803d03fdadd7266cc1fb Mon Sep 17 00:00:00 2001 From: Epskampie Date: Wed, 7 Aug 2013 14:54:49 +0200 Subject: [PATCH 0478/2078] Clarified how to load translations from db Added link the the translation loader tag documentation. --- book/translation.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/book/translation.rst b/book/translation.rst index 58add6ec2c8..e3bf00079be 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -332,7 +332,8 @@ taste. You can also store translations in a database, or any other storage by providing a custom class implementing the - :class:`Symfony\\Component\\Translation\\Loader\\LoaderInterface` interface. + :class:`Symfony\\Component\\Translation\\Loader\\LoaderInterface` interface. + See the `translation loader tag`_ for more information. .. index:: single: Translations; Creating translation resources @@ -1013,3 +1014,4 @@ steps: .. _`Translatable Extension`: https://github.com/l3pp4rd/DoctrineExtensions .. _`ISO3166 Alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes .. _`ISO639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes +.. _`translation loader tag`: http://symfony.com/doc/current/reference/dic_tags.html#translation-loader From 420c5e272e978778f81166e9d5d8a625d48aaf59 Mon Sep 17 00:00:00 2001 From: Epskampie Date: Wed, 7 Aug 2013 14:58:44 +0200 Subject: [PATCH 0479/2078] Removed trailing whitespace. --- book/translation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/translation.rst b/book/translation.rst index e3bf00079be..2e7233dad70 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -332,7 +332,7 @@ taste. You can also store translations in a database, or any other storage by providing a custom class implementing the - :class:`Symfony\\Component\\Translation\\Loader\\LoaderInterface` interface. + :class:`Symfony\\Component\\Translation\\Loader\\LoaderInterface` interface. See the `translation loader tag`_ for more information. .. index:: From 2684524849bca1fe81c9985d158cfabf9234f3b4 Mon Sep 17 00:00:00 2001 From: Epskampie Date: Wed, 7 Aug 2013 15:04:17 +0200 Subject: [PATCH 0480/2078] Change 'translation loader tag' to 'translation.loader tag' --- book/translation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/translation.rst b/book/translation.rst index 2e7233dad70..a1ba22249c4 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -333,7 +333,7 @@ taste. You can also store translations in a database, or any other storage by providing a custom class implementing the :class:`Symfony\\Component\\Translation\\Loader\\LoaderInterface` interface. - See the `translation loader tag`_ for more information. + See the `translation.loader tag`_ for more information. .. index:: single: Translations; Creating translation resources @@ -1014,4 +1014,4 @@ steps: .. _`Translatable Extension`: https://github.com/l3pp4rd/DoctrineExtensions .. _`ISO3166 Alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes .. _`ISO639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes -.. _`translation loader tag`: http://symfony.com/doc/current/reference/dic_tags.html#translation-loader +.. _`translation.loader tag`: http://symfony.com/doc/current/reference/dic_tags.html#translation-loader From 862da3c5e788fa82b14ba9621120d163264cba74 Mon Sep 17 00:00:00 2001 From: Epskampie Date: Wed, 7 Aug 2013 16:00:46 +0200 Subject: [PATCH 0481/2078] Switched regular link to doc reference --- book/translation.rst | 3 +-- reference/dic_tags.rst | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/book/translation.rst b/book/translation.rst index a1ba22249c4..883062f50a1 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -333,7 +333,7 @@ taste. You can also store translations in a database, or any other storage by providing a custom class implementing the :class:`Symfony\\Component\\Translation\\Loader\\LoaderInterface` interface. - See the `translation.loader tag`_ for more information. + See the :ref:`dic-tags-translation-loader` tag for more information. .. index:: single: Translations; Creating translation resources @@ -1014,4 +1014,3 @@ steps: .. _`Translatable Extension`: https://github.com/l3pp4rd/DoctrineExtensions .. _`ISO3166 Alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes .. _`ISO639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes -.. _`translation.loader tag`: http://symfony.com/doc/current/reference/dic_tags.html#translation-loader diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index 78e2792e544..1e5a8f3e7ac 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -861,6 +861,8 @@ templates): ->addTag('templating.helper', array('alias' => 'alias_name')) ; +.. _dic-tags-translation-loader: + translation.loader ------------------ From 928c736f48aad00056afb199eed5522856298667 Mon Sep 17 00:00:00 2001 From: Nelson da Costa Date: Fri, 2 Aug 2013 21:58:25 +0200 Subject: [PATCH 0482/2078] "be cause" -> "because" --- cookbook/form/dynamic_form_modification.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 4c372540193..5b8d326d520 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -437,7 +437,7 @@ When you're building this form to display to the user for the first time, then this example works perfectly. However, things get more difficult when you handle the form submission. This -is be cause the ``PRE_SET_DATA`` event tells us the data that you're starting +is because the ``PRE_SET_DATA`` event tells us the data that you're starting with (e.g. an empty ``SportMeetup`` object), *not* the submitted data. On a form, we can usually listen to the following events: From 5acc4837a91cd75d2cc53a6ab520cd4da021c45b Mon Sep 17 00:00:00 2001 From: Maks Rafalko Date: Mon, 29 Jul 2013 23:20:20 +0300 Subject: [PATCH 0483/2078] Fixed typo Fixed typo [doubled words] --- cookbook/form/data_transformers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/data_transformers.rst b/cookbook/form/data_transformers.rst index 4a041248e5d..e0bd57113ae 100644 --- a/cookbook/form/data_transformers.rst +++ b/cookbook/form/data_transformers.rst @@ -244,7 +244,7 @@ a field for issue numbers 2) You need to worry about passing in the ``em`` option whenever you're creating a form that uses the transformer. -Because of these, you may choose to create a :doc:`create a custom field type`. +Because of these, you may choose to :doc:`create a custom field type`. First, create the custom field type class:: // src/Acme/TaskBundle/Form/Type/IssueSelectorType.php From e24376cb22d1d0ead7df84d39e049dccf6d0ed1c Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 9 Aug 2013 21:13:22 -0700 Subject: [PATCH 0484/2078] [#2735] Minor tweaks to the big, nice refactoring of the templating component done by WouterJ --- .../templating/helpers/assetshelper.rst | 15 ++++++---- components/templating/helpers/slotshelper.rst | 14 +++++---- components/templating/introduction.rst | 30 ++++++++++--------- 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/components/templating/helpers/assetshelper.rst b/components/templating/helpers/assetshelper.rst index 9a35fb90324..07e1a9181b3 100644 --- a/components/templating/helpers/assetshelper.rst +++ b/components/templating/helpers/assetshelper.rst @@ -5,7 +5,7 @@ Assets Helper ============= The assets helper's main purpose is to make your application more portable by -generating assets' paths: +generating asset paths: .. code-block:: html+php @@ -13,11 +13,14 @@ generating assets' paths: +The assets helper can then be configured to render paths to a CDN or modify +the paths in case your assets live in a sub-directory if your host (e.g. ``http://example.com/app``). + Configure Paths --------------- By default, the assets helper will prefix all paths with a slash. You can -extend this by configuring a basepath in the first argument of the +configure this by passing a base assets path as the first argument of the constructor:: use Symfony\Component\Templating\Helper\AssetsHelper; @@ -25,7 +28,7 @@ constructor:: // ... $templateEngine->set(new AssetsHelper('/foo/bar')); -Now, if you use the helper everything will be prefixed with ``/foo/bar``: +Now, if you use the helper, everything will be prefixed with ``/foo/bar``: .. code-block:: html+php @@ -63,13 +66,13 @@ second is the version. For instance, ``%s?v=%s`` will be rendered as Multiple Packages ----------------- -Paths are internally handled by packages. The component provides 2 packages by -default: +Asset path generation is handled internally by packages. The component provides +2 packages by default: * :class:`Symfony\\Component\\Templating\\Asset\\PathPackage` * :class:`Symfony\\Component\\Templating\\Asset\\UrlPackage` -You can also have multiple packages:: +You can also use multiple packages:: // ... $templateEngine->set(new AssetsHelper()); diff --git a/components/templating/helpers/slotshelper.rst b/components/templating/helpers/slotshelper.rst index e79cc88c09e..01d1dff84d8 100644 --- a/components/templating/helpers/slotshelper.rst +++ b/components/templating/helpers/slotshelper.rst @@ -5,12 +5,14 @@ Slots Helper ============ More often than not, templates in a project share common elements, like the -well-known header and footer. The static HTML code can be placed in a layout file -and the dynamic sections are replaced by slots, which are filled by the child -template; the layout file decorates the child template. +well-known header and footer. Using this helper, the static HTML code can +be placed in a layout file along with "slots", which represent the dynamic +parts that will change on a page-by-page basis. These slots are then filled +in by different children template. In other words, the layout file decorates +the child template. Displaying Slots -~~~~~~~~~~~~~~~~ +---------------- The slots are accessible by using the slots helper (``$view['slots']``). Use :method:`Symfony\\Component\\Templating\\Helper\\SlotsHelper::output` to @@ -47,7 +49,7 @@ the content of the subtemplate. $templateEngine->set(new SlotsHelper()); Extending Templates -~~~~~~~~~~~~~~~~~~~ +------------------- The :method:`Symfony\\Component\\Templating\\PhpEngine::extend` method is called in the sub-template to set its parent template. Then @@ -72,7 +74,7 @@ is in the ``_content`` slot. .. note:: - Multiple levels of inheritance is possible: a layout can extend an other + Multiple levels of inheritance is possible: a layout can extend another layout. For large slots, there is also an extended syntax: diff --git a/components/templating/introduction.rst b/components/templating/introduction.rst index d6704abb3ac..eedb52df985 100644 --- a/components/templating/introduction.rst +++ b/components/templating/introduction.rst @@ -26,11 +26,11 @@ Usage The :class:`Symfony\\Component\\Templating\\PhpEngine` class is the entry point of the component. It needs a -:class:`template name parser ` +template name parser (:class:`Symfony\\Component\\Templating\\TemplateNameParserInterface`) to convert a template name to a -:class:`template reference ` -and :class:`template loader ` -to find the template associated to a reference:: +template reference (:class:`Symfony\\Component\\Templating\\TemplateReferenceInterface`). +It also needs a template loader (:class:`Symfony\\Component\\Templating\\Loader\\LoaderInterface`) +which uses the template reference to actually find and load the template:: use Symfony\Component\Templating\PhpEngine; use Symfony\Component\Templating\TemplateNameParser; @@ -57,16 +57,16 @@ The ``$view`` variable In all templates parsed by the ``PhpEngine``, you get access to a mysterious variable called ``$view``. That variable holds the current ``PhpEngine`` -instance. That means you get access to a bunch of methods that makes your life +instance. That means you get access to a bunch of methods that make your life easier. Including Templates ------------------- -The best way to share a snippet of template code is to define a template that -can then be included into other templates. As the ``$view`` variable is an +The best way to share a snippet of template code is to create a template that +can then be included by other templates. As the ``$view`` variable is an instance of ``PhpEngine``, you can use the ``render`` method (which was used -to render the template) inside the template to render another template:: +to render the template originally) inside the template to render another template:: @@ -76,18 +76,20 @@ to render the template) inside the template to render another template:: Output Escaping --------------- -When you display variables to the user, you should escape them using the +When you render variables, you should probably escape them so that HTML or +JavaScript code isn't written out to your page. This will prevent things like +XSS attacks. To do this, use the :method:`Symfony\\Component\\Templating\\PhpEngine::escape` method:: escape($firstname) ?> By default, the ``escape()`` method assumes that the variable is outputted within an HTML context. The second argument lets you change the context. For -instance, to output something in a JavaScript script, use the ``js`` context:: +example, to output something inside JavaScript, use the ``js`` context:: escape($var, 'js') ?> -The components comes with a HTML and JS escaper. You can register your own +The component comes with an HTML and JS escaper. You can register your own escaper using the :method:`Symfony\\Component\\Templating\\PhpEngine::setEscaper` method:: @@ -101,10 +103,10 @@ Helpers ------- The Templating component can be easily extended via helpers. The component has -2 build-in helpers: +2 built-in helpers: -* :doc:`/components/helpers/assetshelper` -* :doc:`/components/helpers/slotshelper` +* :doc:`/components/templating/helpers/assetshelper` +* :doc:`/components/templating/helpers/slotshelper` Before you can use these helpers, you need to register them using :method:`Symfony\\Component\\Templating\\PhpEngine::set`:: From e99defc09c5b5361fabbda512325c2d0d81ebee5 Mon Sep 17 00:00:00 2001 From: Alex Coventry Date: Wed, 24 Jul 2013 17:44:16 -0400 Subject: [PATCH 0485/2078] The use of the undefined variable $router is confusing if you jump straight to http://symfony.com/doc/current/book/routing.html#generating-absolute-urls in the docs (as I did.) --- book/routing.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/routing.rst b/book/routing.rst index eb7b64fd1b8..426d57a54c6 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -1201,7 +1201,7 @@ By default, the router will generate relative URLs (e.g. ``/blog``). To generate an absolute URL, simply pass ``true`` to the third argument of the ``generate()`` method:: - $router->generate('blog_show', array('slug' => 'my-blog-post'), true); + $this-get('router')->generate('blog_show', array('slug' => 'my-blog-post'), true); // http://www.example.com/blog/my-blog-post .. note:: @@ -1212,7 +1212,7 @@ method:: scripts run from the command line, you'll need to manually set the desired host on the ``RequestContext`` object:: - $router->getContext()->setHost('www.example.com'); + $this-get('router')->getContext()->setHost('www.example.com'); .. index:: single: Routing; Generating URLs in a template @@ -1223,7 +1223,7 @@ Generating URLs with Query Strings The ``generate`` method takes an array of wildcard values to generate the URI. But if you pass extra ones, they will be added to the URI as a query string:: - $router->generate('blog', array('page' => 2, 'category' => 'Symfony')); + $this-get('router')->generate('blog', array('page' => 2, 'category' => 'Symfony')); // /blog/2?category=Symfony Generating URLs from a template From 61c464eb62f41e31e72029841332677372f94d2e Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 9 Aug 2013 22:24:24 -0700 Subject: [PATCH 0486/2078] [#2854] Fixing small bug thanks to @xabbuh --- book/routing.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/routing.rst b/book/routing.rst index 426d57a54c6..66b0ea3cde9 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -1201,7 +1201,7 @@ By default, the router will generate relative URLs (e.g. ``/blog``). To generate an absolute URL, simply pass ``true`` to the third argument of the ``generate()`` method:: - $this-get('router')->generate('blog_show', array('slug' => 'my-blog-post'), true); + $this->get('router')->generate('blog_show', array('slug' => 'my-blog-post'), true); // http://www.example.com/blog/my-blog-post .. note:: @@ -1212,7 +1212,7 @@ method:: scripts run from the command line, you'll need to manually set the desired host on the ``RequestContext`` object:: - $this-get('router')->getContext()->setHost('www.example.com'); + $this->get('router')->getContext()->setHost('www.example.com'); .. index:: single: Routing; Generating URLs in a template From e3265ce373b65e561161c959f3bc3ccf771da5a5 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 9 Aug 2013 22:24:59 -0700 Subject: [PATCH 0487/2078] [#2854] One more small fix thanks to @xabbuh --- book/routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/routing.rst b/book/routing.rst index 66b0ea3cde9..21a191723e2 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -1223,7 +1223,7 @@ Generating URLs with Query Strings The ``generate`` method takes an array of wildcard values to generate the URI. But if you pass extra ones, they will be added to the URI as a query string:: - $this-get('router')->generate('blog', array('page' => 2, 'category' => 'Symfony')); + $this->get('router')->generate('blog', array('page' => 2, 'category' => 'Symfony')); // /blog/2?category=Symfony Generating URLs from a template From 826197be3b092a3fe46e554d4eaad9e2cecdd6aa Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 10 Aug 2013 04:19:27 -0700 Subject: [PATCH 0488/2078] [#2785] Minor tweaks to new profiler matchers docs --- cookbook/profiler/matchers.rst | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/cookbook/profiler/matchers.rst b/cookbook/profiler/matchers.rst index 47789b24a96..18b94f5f464 100644 --- a/cookbook/profiler/matchers.rst +++ b/cookbook/profiler/matchers.rst @@ -1,22 +1,23 @@ .. index:: single: Profiling; Matchers -How to use Matchers to enable the Profiler -========================================== +How to use Matchers to enable the Profiler Conditionally +======================================================== By default, the profiler is only activated in the development environment. But -it's imaginable that a developer always wants to see the profiler, even in -production. Another situation may be to show the profiler when an admin has -logged in. You can enable the profiler in these situations by using matchers. +it's imaginable that a developer may want to see the profiler even in +production. Another situation may be that you want to show the profiler only +when an admin has logged in. You can enable the profiler in these situations +by using matchers. -Using the build-in Matcher +Using the built-in Matcher -------------------------- Symfony2 provides a -:class:`build-in matcher ` -which can match paths and IPs. For instance, only show the profiler when -accessing the page with the ``168.0.0.1`` ip. Then, the profiler can be -configured to something like this: +:class:`built-in matcher ` +which can match paths and IPs. For example, if you want to only show the +profiler when accessing the page with the ``168.0.0.1`` ip, then you can +use this configuration: .. configuration-block:: @@ -48,7 +49,7 @@ configured to something like this: )); You can also set a ``path`` option to define the path on which the profiler -should be enabled. For instance, setting it to `^/admin/` will enable the +should be enabled. For instance, setting it to ``^/admin/`` will enable the profiler only for the ``/admin/`` urls. Creating a Custom Matcher @@ -60,8 +61,8 @@ which implements :class:`Symfony\\Component\\HttpFoundation\\RequestMatcherInterface`. This interface requires one method: :method:`Symfony\\Component\\HttpFoundation\\RequestMatcherInterface::matches`. -This method returns a falsey value to disable the profiler, any other value -enables the profiler. +This method returns false to disable the profiler and true to enable the +profiler. To enable the profiler when a ``ROLE_SUPER_ADMIN`` is logged in, you can use something like:: From 8758675481f7c7d1fad6f73f075084592330745f Mon Sep 17 00:00:00 2001 From: Maks Rafalko Date: Mon, 12 Aug 2013 14:06:20 +0300 Subject: [PATCH 0489/2078] Small typo Fixed small typo (extra "`") --- cookbook/form/direct_submit.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/direct_submit.rst b/cookbook/form/direct_submit.rst index 2d68aeae774..4228148a28f 100644 --- a/cookbook/form/direct_submit.rst +++ b/cookbook/form/direct_submit.rst @@ -115,6 +115,6 @@ a convenient shortcut to the previous example:: } Passing the :class:`Symfony\\Component\HttpFoundation\\Request` directly to -:method:`Symfony\\Component\\Form\\FormInterface::submit`` still works, but is +:method:`Symfony\\Component\\Form\\FormInterface::submit` still works, but is deprecated and will be removed in Symfony 3.0. You should use the method :method:`Symfony\Component\Form\FormInterface::handleRequest` instead. From b9934af5043ed4516cb51e59bdd57d1fb8d8710b Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 12 Aug 2013 13:17:10 +0200 Subject: [PATCH 0490/2078] markup fix --- cookbook/validation/custom_constraint.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/validation/custom_constraint.rst b/cookbook/validation/custom_constraint.rst index 02ac6651c38..d8251d442c0 100644 --- a/cookbook/validation/custom_constraint.rst +++ b/cookbook/validation/custom_constraint.rst @@ -52,7 +52,7 @@ In other words, if you create a custom ``Constraint`` (e.g. ``MyConstraint``), Symfony2 will automatically look for another class, ``MyConstraintValidator`` when actually performing the validation. -The validator class is also simple, and only has one required method: ``validate``:: +The validator class is also simple, and only has one required method ``validate()``:: // src/Acme/DemoBundle/Validator/Constraints/ContainsAlphanumericValidator.php namespace Acme\DemoBundle\Validator\Constraints; From a816dc3ca015dd6e9fe89955c5bf0aaf96aaebee Mon Sep 17 00:00:00 2001 From: Kryniol Date: Wed, 14 Aug 2013 16:56:51 +0200 Subject: [PATCH 0491/2078] Fixed typo in UglifyCss usage example --- cookbook/assetic/uglifyjs.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cookbook/assetic/uglifyjs.rst b/cookbook/assetic/uglifyjs.rst index c97368e6028..0fa70ba3306 100644 --- a/cookbook/assetic/uglifyjs.rst +++ b/cookbook/assetic/uglifyjs.rst @@ -230,13 +230,13 @@ helper: .. code-block:: html+jinja - {% javascripts '@AcmeFooBundle/Resources/public/css/*' filter='uglifycss' %} + {% stylesheets '@AcmeFooBundle/Resources/public/css/*' filter='uglifycss' %} - {% endjavascripts %} + {% endstylesheets %} .. code-block:: html+php - javascripts( + stylesheets( array('@AcmeFooBundle/Resources/public/css/*'), array('uglifycss') ) as $url): ?> From 4b5a44af0021f82bb87727874505ec6682ca9c4f Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 17 Aug 2013 12:30:12 -0400 Subject: [PATCH 0492/2078] [#2855] Trying to make the .first and .second sub-field names a bit more clear --- reference/forms/types/repeated.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/repeated.rst b/reference/forms/types/repeated.rst index 6f0cc85fe5d..83e1878b316 100644 --- a/reference/forms/types/repeated.rst +++ b/reference/forms/types/repeated.rst @@ -79,6 +79,7 @@ To render each field individually, use something like this: .. code-block:: jinja + {# .first and .second may vary in your use - see the note below #} {{ form_row(form.password.first) }} {{ form_row(form.password.second) }} @@ -89,8 +90,10 @@ To render each field individually, use something like this: .. note:: - The sub-field names are ``first`` and ``second`` by default, but can - be controlled via the `first_name`_ and `second_name`_ options. + The names ``first`` and ``second`` are the default names for the two + sub-fields. However, these names can be controlled via the `first_name`_ + and `second_name`_ options. If you've set these options, then use those + values instead of ``first`` and ``second`` when rendering. Validation ~~~~~~~~~~ From 17ae545cb48ea641d9d55cc8fc60e6f699b8fefa Mon Sep 17 00:00:00 2001 From: WouterJ Date: Tue, 30 Jul 2013 14:29:01 +0200 Subject: [PATCH 0493/2078] Documented services as global vars --- cookbook/templating/global_variables.rst | 49 ++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/cookbook/templating/global_variables.rst b/cookbook/templating/global_variables.rst index 4067cfb40fb..11cce2f0c2c 100644 --- a/cookbook/templating/global_variables.rst +++ b/cookbook/templating/global_variables.rst @@ -41,7 +41,50 @@ Now, the variable ``ga_tracking`` is available in all Twig templates:

The google tracking code is: {{ ga_tracking }}

-It's that easy! You can also take advantage of the built-in :ref:`book-service-container-parameters` +It's that easy! + +Referencing Services +-------------------- + +Instead of using static values, you can also set the value to a service. +Whenever the global variabele is accessed in the template, the service will be +requested from the service container and you get access to that object. + +This is done by prefixing the string with ``@``, which you already know from +injecting a service: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + twig: + # ... + globals: + user_management: "@acme_user.user_management" + + .. code-block:: xml + + + + + @acme_user.user_management + + + .. code-block:: php + + // app/config/config.php + $container->loadFromExtension('twig', array( + // ... + 'globals' => array( + 'user_management' => '@acme_user.user_management', + ), + )); + +Using Service Container Parameters +---------------------------------- + +You can also take advantage of the built-in :ref:`book-service-container-parameters` system, which lets you isolate or reuse the value: .. code-block:: yaml @@ -77,8 +120,8 @@ system, which lets you isolate or reuse the value: The same variable is available exactly as before. -More Complex Global Variables ------------------------------ +Using a Twig Extension +---------------------- If the global variable you want to set is more complicated - say an object - then you won't be able to use the above method. Instead, you'll need to create From 493a13534719bae56b453e1dfd778fe22151490b Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 17 Aug 2013 13:27:03 -0400 Subject: [PATCH 0494/2078] [#2865] No change other than moving the parameters section above the services section per a suggestion by @Stof, which I agree with (that parameters are more common to use as global Twig variables) --- cookbook/templating/global_variables.rst | 52 ++++++++++++------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/cookbook/templating/global_variables.rst b/cookbook/templating/global_variables.rst index 11cce2f0c2c..62884d2e0f7 100644 --- a/cookbook/templating/global_variables.rst +++ b/cookbook/templating/global_variables.rst @@ -43,15 +43,17 @@ Now, the variable ``ga_tracking`` is available in all Twig templates: It's that easy! -Referencing Services --------------------- +Using Service Container Parameters +---------------------------------- -Instead of using static values, you can also set the value to a service. -Whenever the global variabele is accessed in the template, the service will be -requested from the service container and you get access to that object. +You can also take advantage of the built-in :ref:`book-service-container-parameters` +system, which lets you isolate or reuse the value: -This is done by prefixing the string with ``@``, which you already know from -injecting a service: +.. code-block:: yaml + + # app/config/parameters.yml + parameters: + ga_tracking: UA-xxxxx-x .. configuration-block:: @@ -59,39 +61,36 @@ injecting a service: # app/config/config.yml twig: - # ... globals: - user_management: "@acme_user.user_management" + ga_tracking: "%ga_tracking%" .. code-block:: xml - - @acme_user.user_management + %ga_tracking% .. code-block:: php // app/config/config.php $container->loadFromExtension('twig', array( - // ... 'globals' => array( - 'user_management' => '@acme_user.user_management', + 'ga_tracking' => '%ga_tracking%', ), )); -Using Service Container Parameters ----------------------------------- +The same variable is available exactly as before. -You can also take advantage of the built-in :ref:`book-service-container-parameters` -system, which lets you isolate or reuse the value: +Referencing Services +-------------------- -.. code-block:: yaml +Instead of using static values, you can also set the value to a service. +Whenever the global variabele is accessed in the template, the service will be +requested from the service container and you get access to that object. - # app/config/parameters.yml - parameters: - ga_tracking: UA-xxxxx-x +This is done by prefixing the string with ``@``, which you already know from +injecting a service: .. configuration-block:: @@ -99,27 +98,28 @@ system, which lets you isolate or reuse the value: # app/config/config.yml twig: + # ... globals: - ga_tracking: "%ga_tracking%" + user_management: "@acme_user.user_management" .. code-block:: xml - %ga_tracking% + + @acme_user.user_management .. code-block:: php // app/config/config.php $container->loadFromExtension('twig', array( + // ... 'globals' => array( - 'ga_tracking' => '%ga_tracking%', + 'user_management' => '@acme_user.user_management', ), )); -The same variable is available exactly as before. - Using a Twig Extension ---------------------- From e203c40806fdc3fc88f5ddc96b3dcb28e4ce97ba Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 17 Aug 2013 13:30:03 -0400 Subject: [PATCH 0495/2078] [#2865] Minor proofreading and tweaks thanks to @xabbuh and @stof about the services as global Twig variables --- cookbook/templating/global_variables.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cookbook/templating/global_variables.rst b/cookbook/templating/global_variables.rst index 62884d2e0f7..536157ac092 100644 --- a/cookbook/templating/global_variables.rst +++ b/cookbook/templating/global_variables.rst @@ -86,11 +86,17 @@ Referencing Services -------------------- Instead of using static values, you can also set the value to a service. -Whenever the global variabele is accessed in the template, the service will be +Whenever the global variable is accessed in the template, the service will be requested from the service container and you get access to that object. -This is done by prefixing the string with ``@``, which you already know from -injecting a service: +.. note:: + + The service is not loaded lazily. In other words, as soon as Twig is + loaded, your service is instantiated, even if you never use that global + variable. + +To define a service as a global Twig variable, prefix the string with ``@``. +This should feel familiar, as it's the same syntax you use in service configuration. .. configuration-block:: From 7c0237b38803f08daae91bffc79abedbf7e08508 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 19 Aug 2013 10:58:52 +0200 Subject: [PATCH 0496/2078] change non-existent markup type php+html to html+php --- components/templating/helpers/assetshelper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/templating/helpers/assetshelper.rst b/components/templating/helpers/assetshelper.rst index 07e1a9181b3..52b014bbc9d 100644 --- a/components/templating/helpers/assetshelper.rst +++ b/components/templating/helpers/assetshelper.rst @@ -91,7 +91,7 @@ If you want to set another default package, you can use You can specify which package you want to use in the second argument of :method:`Symfony\\Component\\Templating\\Helper\\AssetsHelper::getUrl`: -.. code-block:: php+html +.. code-block:: html+php + +To disable this behaviour, use the ``string`` type: + +.. code-block:: xml + + + true + + + + +.. note:: + + This is not available for Yaml and PHP, because they already have built-in + support for the PHP keywords. + +Referencing Services with Parameters +------------------------------------ + +A parameter can also reference to a service. While doing so, it specifies an +invalid behaviour. + +Yaml +~~~~ + +Start the string with ``@``, ``@@`` or ``@?`` to reference a service in Yaml. + +* ``@mailer`` references to the ``mailer`` service. If the service does not + exists, an exception will be thrown; +* ``@?mailer`` references to the ``mailer`` service. If the service does not + exists, it will be ignored; + +Xml +~~~ + +In XML, use the ``service`` type. The behaviour if the service does not exists +can be specified using the ``on-invalid`` argument (it can be set to ``null`` +to return ``null`` or ``ignored`` to let the container ignore the error, if +not specified it throws an exception). + +Php +~~~ + +In PHP, you can use the +:class:`Symfony\\Component\\DependencyInjection\\Reference` class to reference +a service. From 56b6b253888f1539c118dc7838cedbe1d7ae53d8 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 25 Aug 2013 07:58:20 -0400 Subject: [PATCH 0513/2078] [#2866] Minor fixes thanks to @stof and @WouterJ --- book/doctrine.rst | 2 +- book/forms.rst | 2 +- book/http_cache.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index 1b96994dff9..033a72447a9 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -94,7 +94,7 @@ information. By convention, this information is usually configured in an dbname="%database_name%" user="%database_user%" password="%database_password%" - > + />
diff --git a/book/forms.rst b/book/forms.rst index 08885c0996b..06b3a16e2e9 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -318,7 +318,7 @@ object. .. code-block:: xml - + From 29f346a030a793688030d71a1b3b2d1225e5a794 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 31 Jul 2013 13:05:56 +0200 Subject: [PATCH 0514/2078] fix underline to match the title's length --- reference/constraints/NotIdenticalTo.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/NotIdenticalTo.rst b/reference/constraints/NotIdenticalTo.rst index 2f659cbdbc5..09eb35607fe 100644 --- a/reference/constraints/NotIdenticalTo.rst +++ b/reference/constraints/NotIdenticalTo.rst @@ -1,5 +1,5 @@ NotIdenticalTo -=========== +============== .. versionadded:: 2.3 This constraint is new in version 2.3. From 1b707ddab33c9dee42e3b677f1b5fa55b0f2b7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chardonnet?= Date: Sun, 4 Aug 2013 23:13:37 +0200 Subject: [PATCH 0515/2078] Added note on untrimmed parameters (XML) In XML configuration, the value between` parameter` tags isn't trimmed, which can lead to unexpected behavior. See https://github.com/symfony/symfony/pull/8661 --- .../dependency_injection/parameters.rst | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/components/dependency_injection/parameters.rst b/components/dependency_injection/parameters.rst index 129d766cd61..94573c9d53c 100644 --- a/components/dependency_injection/parameters.rst +++ b/components/dependency_injection/parameters.rst @@ -97,6 +97,27 @@ rather than being tied up and hidden with the service definition: ->register('mailer', 'Mailer') ->addArgument('%mailer.transport%'); +.. caution:: + + The values between ``parameter`` tags in XML configuration files are not + trimmed. + + This means that the following configuration sample will have the value + ``\n sendmail\n``: + + .. code-block:: xml + + + sendmail + + + In some cases (for constants or class names), this could throw errors. In + order to prevent this, you must always inline your parameters as follow: + + .. code-block:: xml + + sendmail + If you were using this elsewhere as well, then you would only need to change the parameter value in one place if needed. From defd635fa445662878ef93cd74e8b2aaf5242e25 Mon Sep 17 00:00:00 2001 From: J Bruni Date: Tue, 6 Aug 2013 19:40:56 -0300 Subject: [PATCH 0516/2078] Update definition.rst - indentation fix Reverting indentation of a call to "ifString()" back to its correct place. A commit from 9 months ago changed it by mistake: https://github.com/symfony/symfony-docs/commit/9a0b4e1edfd61062fcb8181fc0c58a94676579b2#L0L380 --- components/config/definition.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index d43aea02052..dc471b6dd20 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -490,7 +490,7 @@ By changing a string value into an associative array with ``name`` as the key:: ->children() ->arrayNode('connection') ->beforeNormalization() - ->ifString() + ->ifString() ->then(function($v) { return array('name'=> $v); }) ->end() ->children() From b5c19be85f4fdc5a61e093cfe452574c1a6e787b Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 25 Aug 2013 08:31:32 -0400 Subject: [PATCH 0517/2078] [#2882] Minor tweaks and additional information added --- .../dependency_injection/parameters.rst | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/components/dependency_injection/parameters.rst b/components/dependency_injection/parameters.rst index 7dd948b849b..4e18fb1ffa0 100644 --- a/components/dependency_injection/parameters.rst +++ b/components/dependency_injection/parameters.rst @@ -286,7 +286,7 @@ key, and define the type as ``constant``. imports: - { resource: parameters.xml } -PHP keywords in XML +PHP Keywords in XML ------------------- By default, ``true``, ``false`` and ``null`` in XML are converted to the PHP @@ -302,7 +302,7 @@ keywords (respectively ``true``, ``false`` and ``null``): $container->getParameter('mailer.send_all_in_once'); // returns false --> -To disable this behaviour, use the ``string`` type: +To disable this behavior, use the ``string`` type: .. code-block:: xml @@ -319,33 +319,38 @@ To disable this behaviour, use the ``string`` type: This is not available for Yaml and PHP, because they already have built-in support for the PHP keywords. -Referencing Services with Parameters ------------------------------------- +Syntax for Referencing Services +------------------------------- -A parameter can also reference to a service. While doing so, it specifies an -invalid behaviour. +You can of course also reference services, which looks a bit different in +each format. You can configure the behavior if the referenced service does +not exist. By default, an exception is thrown when a non-existent service +is referenced. Yaml ~~~~ -Start the string with ``@``, ``@@`` or ``@?`` to reference a service in Yaml. +Start the string with ``@`` or ``@?`` to reference a service in Yaml. -* ``@mailer`` references to the ``mailer`` service. If the service does not +* ``@mailer`` references the ``mailer`` service. If the service does not exists, an exception will be thrown; -* ``@?mailer`` references to the ``mailer`` service. If the service does not +* ``@?mailer`` references the ``mailer`` service. If the service does not exists, it will be ignored; Xml ~~~ -In XML, use the ``service`` type. The behaviour if the service does not exists -can be specified using the ``on-invalid`` argument (it can be set to ``null`` -to return ``null`` or ``ignored`` to let the container ignore the error, if -not specified it throws an exception). +In XML, use the ``service`` type. The behavior if the service does not exists +can be specified using the ``on-invalid`` argument. By default, an exception +is thrown. Valid values for ``on-invalid`` are ``null`` (uses ``null`` in place +of the missing service) or ``ignored`` (very similar, except if used on a +method call, the method call is removed). Php ~~~ In PHP, you can use the :class:`Symfony\\Component\\DependencyInjection\\Reference` class to reference -a service. +a service. The invalid behavior is configured using the second constructor +argument and constants from +:class:`Symfony\\Component\\DependencyInjection\\ContainerInterface`. From 9f9b390e203e1c74cdd4b63ae862e315cf2305fa Mon Sep 17 00:00:00 2001 From: Christopher Moll Date: Wed, 7 Aug 2013 17:25:52 -0400 Subject: [PATCH 0518/2078] Fixes #2879 --- cookbook/bundles/extension.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/bundles/extension.rst b/cookbook/bundles/extension.rst index 21f9d564615..488e598467b 100644 --- a/cookbook/bundles/extension.rst +++ b/cookbook/bundles/extension.rst @@ -62,7 +62,7 @@ When you create a bundle, you have two choices on how to handle configuration: The second option - which you'll learn about in this article - is much more flexible, but also requires more time to setup. If you're wondering which method you should use, it's probably a good idea to start with method #1, -and then change to #2 later if you need to. +and then change to #2 later if you need to. If you plan to distribute your bundle, the second option is recommended. The second method has several specific advantages: From 582b2ab0b1023f4afe837b6304bf86fa94fbe78d Mon Sep 17 00:00:00 2001 From: Christopher Moll Date: Wed, 7 Aug 2013 17:54:34 -0400 Subject: [PATCH 0519/2078] Clarifies bundle config recommendations --- cookbook/bundles/extension.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cookbook/bundles/extension.rst b/cookbook/bundles/extension.rst index 488e598467b..8e65bb6b47f 100644 --- a/cookbook/bundles/extension.rst +++ b/cookbook/bundles/extension.rst @@ -62,7 +62,8 @@ When you create a bundle, you have two choices on how to handle configuration: The second option - which you'll learn about in this article - is much more flexible, but also requires more time to setup. If you're wondering which method you should use, it's probably a good idea to start with method #1, -and then change to #2 later if you need to. If you plan to distribute your bundle, the second option is recommended. +and then change to #2 later if you need to. If you plan to distribute your +bundle, the second option is recommended. The second method has several specific advantages: From cd6fc621188583025c57f9817a484258a987c4b9 Mon Sep 17 00:00:00 2001 From: Christopher Moll Date: Fri, 9 Aug 2013 10:41:13 -0400 Subject: [PATCH 0520/2078] Removed extra space --- cookbook/bundles/extension.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/bundles/extension.rst b/cookbook/bundles/extension.rst index 8e65bb6b47f..e7f7bb1bf59 100644 --- a/cookbook/bundles/extension.rst +++ b/cookbook/bundles/extension.rst @@ -62,7 +62,7 @@ When you create a bundle, you have two choices on how to handle configuration: The second option - which you'll learn about in this article - is much more flexible, but also requires more time to setup. If you're wondering which method you should use, it's probably a good idea to start with method #1, -and then change to #2 later if you need to. If you plan to distribute your +and then change to #2 later if you need to. If you plan to distribute your bundle, the second option is recommended. The second method has several specific advantages: From e4ecb50c4d4947868287801e785c40ef993e009b Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Thu, 8 Aug 2013 10:57:50 -0500 Subject: [PATCH 0521/2078] Update validation.rst --- book/validation.rst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/book/validation.rst b/book/validation.rst index e33e9b55812..e5ff067328e 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -130,9 +130,9 @@ simple example from inside a controller:: if (count($errors) > 0) { return new Response(print_r($errors, true)); - } else { - return new Response('The author is valid! Yes!'); } + + return new Response('The author is valid! Yes!'); } If the ``$name`` property is empty, you will see the following error @@ -161,9 +161,7 @@ You could also pass the collection of errors into a template. return $this->render('AcmeBlogBundle:Author:validate.html.twig', array( 'errors' => $errors, )); - } else { - // ... - } + } Inside the template, you can output the list of errors exactly as needed: @@ -655,7 +653,7 @@ Now, create the ``isPasswordLegal()`` method, and include the logic you need:: public function isPasswordLegal() { - return ($this->firstName != $this->password); + return $this->firstName != $this->password; } .. note:: From 303daff94f4f93f8dd5c405e2ab15792aa3d1698 Mon Sep 17 00:00:00 2001 From: dtormey Date: Thu, 8 Aug 2013 11:43:50 -0700 Subject: [PATCH 0522/2078] fixed typo in the GroupSequenceProviderInterface path. --- book/validation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/validation.rst b/book/validation.rst index e5ff067328e..6091ed8e16a 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -1074,7 +1074,7 @@ then your code might look like this:: namespace Acme\DemoBundle\Entity; // ... - use Symfony\Component\Validation\GroupSequenceProviderInterface; + use Symfony\Component\Validator\GroupSequenceProviderInterface; /** * @Assert\GroupSequenceProvider From 5a9b7e43332f9eb7da25bab453d1753de3ca2c47 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 25 Aug 2013 08:42:16 -0400 Subject: [PATCH 0523/2078] [#2885] Fixing 2 more bad namespace uses --- book/validation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/validation.rst b/book/validation.rst index 6091ed8e16a..1f922f833e0 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -1062,9 +1062,9 @@ entity and a new constraint group called ``Premium``: } Now, change the ``User`` class to implement -:class:`Symfony\\Component\\Validation\\GroupSequenceProviderInterface` and +:class:`Symfony\\Component\\Validator\\GroupSequenceProviderInterface` and add the -:method:`Symfony\\Component\\Validation\\GroupSequenceProviderInterface::getGroupSequence`, +:method:`Symfony\\Component\\Validator\\GroupSequenceProviderInterface::getGroupSequence`, which should return an array of groups to use. Also, add the ``@Assert\GroupSequenceProvider`` annotation to the class. If you imagine that a method called ``isPremium`` returns true if the user is a premium member, From 77bcb9c4dd5760316db00eb18942c8bdf020eefc Mon Sep 17 00:00:00 2001 From: Bram Vogelaar Date: Fri, 9 Aug 2013 18:03:49 +0200 Subject: [PATCH 0524/2078] removing unnecessary duplicate php from codeblock --- quick_tour/the_big_picture.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quick_tour/the_big_picture.rst b/quick_tour/the_big_picture.rst index 7e220ea2451..c29318cae92 100644 --- a/quick_tour/the_big_picture.rst +++ b/quick_tour/the_big_picture.rst @@ -75,10 +75,10 @@ If you have PHP 5.4, you can use the built-in web server: .. code-block:: bash # check your PHP CLI configuration - $ php php app/check.php + $ php app/check.php # run the built-in web server - $ php php app/console server:run + $ php app/console server:run Then the URL to your application will be "http://localhost:8000/app_dev.php" From 8abfc017dd7b1b2b85206b4a4b2925d5a6ee3fc3 Mon Sep 17 00:00:00 2001 From: Maks Rafalko Date: Fri, 9 Aug 2013 19:58:15 +0300 Subject: [PATCH 0525/2078] Small typo fixed typo in method name (extra "`") --- cookbook/form/unit_testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/unit_testing.rst b/cookbook/form/unit_testing.rst index 69337571276..def51102f93 100644 --- a/cookbook/form/unit_testing.rst +++ b/cookbook/form/unit_testing.rst @@ -77,7 +77,7 @@ be the first test you write:: $form = $this->factory->create($type); This test checks that none of your data transformers used by the form -failed. The :method:`Symfony\\Component\\Form\\FormInterface::isSynchronized`` +failed. The :method:`Symfony\\Component\\Form\\FormInterface::isSynchronized` method is only set to ``false`` if a data transformer throws an exception:: $form->bind($formData); From fbf07282bba364675d5c59790247c5e8077741c8 Mon Sep 17 00:00:00 2001 From: Michael C Date: Mon, 12 Aug 2013 01:07:12 +0100 Subject: [PATCH 0526/2078] Fixing PHPUnit docs link --- book/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/testing.rst b/book/testing.rst index e015e83228f..db5fb373933 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -806,4 +806,4 @@ Learn more .. _`DemoControllerTest`: https://github.com/symfony/symfony-standard/blob/master/src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php .. _`$_SERVER`: http://php.net/manual/en/reserved.variables.server.php -.. _`documentation`: http://www.phpunit.de/manual/3.5/en/ +.. _`documentation`: http://phpunit.de/manual/current/en/ From 792756e43566554e44f12da40b23f647e756ee2d Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 25 Aug 2013 14:47:59 +0200 Subject: [PATCH 0527/2078] Added tip --- components/dependency_injection/parameters.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/dependency_injection/parameters.rst b/components/dependency_injection/parameters.rst index 4e18fb1ffa0..fce88191716 100644 --- a/components/dependency_injection/parameters.rst +++ b/components/dependency_injection/parameters.rst @@ -337,6 +337,12 @@ Start the string with ``@`` or ``@?`` to reference a service in Yaml. * ``@?mailer`` references the ``mailer`` service. If the service does not exists, it will be ignored; +.. tip:: + + Use ``@@`` to escape the ``@`` symbol in Yaml. ``@@mailer`` will be + converted into the string ``"@mailer"`` instead of referencing the + ``mailer`` service. + Xml ~~~ From 4079fc6098b7fe1080aed84ee06555b5ba600263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Su=C3=A1rez=20Ortega?= Date: Mon, 12 Aug 2013 13:08:47 +0200 Subject: [PATCH 0528/2078] Minor clarification in Validation cookbook --- cookbook/validation/custom_constraint.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/validation/custom_constraint.rst b/cookbook/validation/custom_constraint.rst index 02ac6651c38..0c0b3b52bde 100644 --- a/cookbook/validation/custom_constraint.rst +++ b/cookbook/validation/custom_constraint.rst @@ -207,7 +207,7 @@ Class Constraint Validator ~~~~~~~~~~~~~~~~~~~~~~~~~~ Beside validating a class property, a constraint can have a class scope by -providing a target:: +providing a target in its ``Constraint`` class:: public function getTargets() { From 445ab303f1a595f2bcdd13e70885a08cff4455cc Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sun, 25 Aug 2013 20:04:24 +0200 Subject: [PATCH 0529/2078] Fixed typo --- cookbook/routing/redirect_in_config.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/routing/redirect_in_config.rst b/cookbook/routing/redirect_in_config.rst index 4d6b7004e6e..353c75c89c8 100644 --- a/cookbook/routing/redirect_in_config.rst +++ b/cookbook/routing/redirect_in_config.rst @@ -23,7 +23,7 @@ Your configuration will look like this: path: / defaults: _controller: FrameworkBundle:Redirect:urlRedirect - path: /app + route: /app permanent: true In this example, you configure a route for the ``/`` path and let :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController` From c55f3b03b64520628ff952f36197d7dff1d1c985 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 26 Aug 2013 00:22:43 +0200 Subject: [PATCH 0530/2078] fix versionadded directive for the submit() and handleRequests() methods --- cookbook/form/direct_submit.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cookbook/form/direct_submit.rst b/cookbook/form/direct_submit.rst index 4228148a28f..f2472f0b7d1 100644 --- a/cookbook/form/direct_submit.rst +++ b/cookbook/form/direct_submit.rst @@ -4,8 +4,8 @@ How to use the submit() Function to handle Form Submissions =========================================================== -.. versionadded:: - Before Symfony 2.3, the ``submit`` method was known as ``bind``. +.. versionadded:: 2.3 + The ``handleRequest()`` method was added in Symfony 2.3. In Symfony 2.3, a new :method:`Symfony\Component\Form\FormInterface::handleRequest` method was added, which makes handling form submissions easier than ever:: @@ -39,6 +39,9 @@ method was added, which makes handling form submissions easier than ever:: Calling Form::submit() manually ------------------------------- +.. versionadded:: 2.3 + Before Symfony 2.3, the ``submit()`` method was known as ``bind()``. + In some cases, you want better control over when exactly your form is submitted and what data is passed to it. Instead of using the :method:`Symfony\Component\Form\FormInterface::handleRequest` From 5c401290e2349bdcaef324acb0f25ec0a4f45129 Mon Sep 17 00:00:00 2001 From: Denis Togbe Date: Mon, 26 Aug 2013 12:53:36 +0200 Subject: [PATCH 0531/2078] [Reference][Configuration][Doctrine] Fix XML configuration --- reference/configuration/doctrine.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index 2ed564e6200..2a9ce3b0151 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -208,9 +208,9 @@ Doctrine Configuration Reference - Acme\HelloBundle\DQL\NumericFunction - Acme\HelloBundle\DQL\StringFunction + Acme\HelloBundle\DQL\NumericFunction + Acme\HelloBundle\DQL\DatetimeFunction From 674f04d94ad254bf1676dd1c2f2501c9bda6a757 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 26 Aug 2013 09:23:45 -0400 Subject: [PATCH 0532/2078] [#2882] Typo fix thanks to @xabbuh --- components/dependency_injection/parameters.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dependency_injection/parameters.rst b/components/dependency_injection/parameters.rst index 4e18fb1ffa0..8722e962808 100644 --- a/components/dependency_injection/parameters.rst +++ b/components/dependency_injection/parameters.rst @@ -340,7 +340,7 @@ Start the string with ``@`` or ``@?`` to reference a service in Yaml. Xml ~~~ -In XML, use the ``service`` type. The behavior if the service does not exists +In XML, use the ``service`` type. The behavior if the service does not exist can be specified using the ``on-invalid`` argument. By default, an exception is thrown. Valid values for ``on-invalid`` are ``null`` (uses ``null`` in place of the missing service) or ``ignored`` (very similar, except if used on a From 862df0d6c15ce93e36f53e4b31a845acf2625df4 Mon Sep 17 00:00:00 2001 From: Bart van den Burg Date: Tue, 27 Aug 2013 10:19:12 +0200 Subject: [PATCH 0533/2078] Explained a more simple method of dynamic form handling available since https://github.com/symfony/symfony/pull/8827 --- cookbook/form/dynamic_form_modification.rst | 206 +++++--------------- 1 file changed, 52 insertions(+), 154 deletions(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 5b8d326d520..daefca7ef42 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -403,23 +403,25 @@ possible choices will depend on each sport. Football will have attack, defense, goalkeeper etc... Baseball will have a pitcher but will not have goalkeeper. You will need the correct options to be set in order for validation to pass. -The meetup is passed as an entity hidden field to the form. So we can access each +The meetup is passed as an entity field to the form. So we can access each sport like this:: // src/Acme/DemoBundle/Form/Type/SportMeetupType.php + namespace Acme\DemoBundle\Form\Type; + + // ... + class SportMeetupType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder - ->add('number_of_people', 'text') - ->add('discount_coupon', 'text') + ->add('sport', 'entity', array(...)) ; - $factory = $builder->getFormFactory(); $builder->addEventListener( FormEvents::PRE_SET_DATA, - function(FormEvent $event) use($factory){ + function(FormEvent $event) { $form = $event->getForm(); // this would be your entity, i.e. SportMeetup @@ -427,7 +429,7 @@ sport like this:: $positions = $data->getSport()->getAvailablePositions(); - // ... proceed with customizing the form based on available positions + $form->add('position', 'entity', array('choices' => $positions)); } ); } @@ -448,173 +450,69 @@ On a form, we can usually listen to the following events: * ``BIND`` * ``POST_BIND`` -When listening to ``BIND`` and ``POST_BIND``, it's already "too late" to make -changes to the form. Fortunately, ``PRE_BIND`` is perfect for this. There -is, however, a big difference in what ``$event->getData()`` returns for each -of these events. Specifically, in ``PRE_BIND``, ``$event->getData()`` returns -the raw data submitted by the user. +.. versionadded:: 2.2.6 -This can be used to get the ``SportMeetup`` id and retrieve it from the database, -given you have a reference to the object manager (if using doctrine). In -the end, you have an event subscriber that listens to two different events, -requires some external services and customizes the form. In such a situation, -it's probably better to define this as a service rather than using an anonymous -function as the event listener callback. -The subscriber would now look like:: +The key is to add a ``POST_BIND`` listener to the field your new field is dependent +on. If you add a POST_BIND listener to a form child, and add new children to the parent +from there, the Form component will detect the new field automatically and maps it +to the client data if it is available. - // src/Acme/DemoBundle/Form/EventListener/RegistrationSportListener.php - namespace Acme\DemoBundle\Form\EventListener; +The type would now look like:: - use Symfony\Component\Form\FormFactoryInterface; - use Doctrine\ORM\EntityManager; - use Symfony\Component\Form\FormEvent; - use Symfony\Component\Form\FormEvents; - use Symfony\Component\EventDispatcher\EventSubscriberInterface; + // src/Acme/DemoBundle/Form/Type/SportMeetupType.php + namespace Acme\DemoBundle\Form\Type; - class RegistrationSportListener implements EventSubscriberInterface - { - /** - * @var FormFactoryInterface - */ - private $factory; - - /** - * @var EntityManager - */ - private $em; - - /** - * @param factory FormFactoryInterface - */ - public function __construct(FormFactoryInterface $factory, EntityManager $em) - { - $this->factory = $factory; - $this->em = $em; - } + // ... + Acme\DemoBundle\Entity\Sport; + Symfony\Component\Form\FormInterface; - public static function getSubscribedEvents() + class SportMeetupType extends AbstractType + { + public function buildForm(FormBuilderInterface $builder, array $options) { - return array( - FormEvents::PRE_BIND => 'preBind', - FormEvents::PRE_SET_DATA => 'preSetData', - ); - } + $builder + ->add('sport', 'entity', array(...)) + ; - /** - * @param event FormEvent - */ - public function preSetData(FormEvent $event) - { - $meetup = $event->getData()->getMeetup(); + $formModifier = function(FormInterface $form, Sport $sport) { + $positions = $data->getSport()->getAvailablePositions(); - // Before binding the form, the "meetup" will be null - if (null === $meetup) { - return; + $form->add('position', 'entity', array('choices' => $positions)); } - $form = $event->getForm(); - $positions = $meetup->getSport()->getPositions(); + $builder->addEventListener( + FormEvents::PRE_SET_DATA, + function(FormEvent $event) { + $form = $event->getForm(); - $this->customizeForm($form, $positions); - } + // this would be your entity, i.e. SportMeetup + $data = $event->getData(); - public function preBind(FormEvent $event) - { - $data = $event->getData(); - $id = $data['event']; - $meetup = $this->em - ->getRepository('AcmeDemoBundle:SportMeetup') - ->find($id); - - if ($meetup === null) { - $msg = 'The event %s could not be found for you registration'; - throw new \Exception(sprintf($msg, $id)); - } - $form = $event->getForm(); - $positions = $meetup->getSport()->getPositions(); + $formModifier($event->getForm(), $sport); + } + ); - $this->customizeForm($form, $positions); - } + $builder->get('meetup')->addEventListener( + FormEvents::POST_BIND, + function(FormEvent $event) use ($formModifier) { + // It's important here to fetch $event->getForm()->getData(), as + // $event->getData() will get you the client data (this is, the ID) + $sport = $event->getForm()->getData(); - protected function customizeForm($form, $positions) - { - // ... customize the form according to the positions + $positions = $sport->getAvailablePositions(); + + // since we've added the listener to the child, we'll have to pass on + // the parent to the callback functions! + $formModifier($event->getForm()->getParent(), $sport); + } + ); } } You can see that you need to listen on these two events and have different callbacks -only because in two different scenarios, the data that you can use is given in a -different format. Other than that, this class always performs exactly the same -things on a given form. - -Now that you have that setup, register your form and the listener as services: - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/config.yml - acme.form.sport_meetup: - class: Acme\SportBundle\Form\Type\SportMeetupType - arguments: [@acme.form.meetup_registration_listener] - tags: - - { name: form.type, alias: acme_meetup_registration } - acme.form.meetup_registration_listener - class: Acme\SportBundle\Form\EventListener\RegistrationSportListener - arguments: [@form.factory, @doctrine.orm.entity_manager] - - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php - - // app/config/config.php - $definition = new Definition('Acme\SportBundle\Form\Type\SportMeetupType'); - $definition->addTag('form.type', array('alias' => 'acme_meetup_registration')); - $container->setDefinition( - 'acme.form.meetup_registration_listener', - $definition, - array('security.context') - ); - $definition = new Definition('Acme\SportBundle\Form\EventListener\RegistrationSportListener'); - $container->setDefinition( - 'acme.form.meetup_registration_listener', - $definition, - array('form.factory', 'doctrine.orm.entity_manager') - ); - -In this setup, the ``RegistrationSportListener`` will be a constructor argument -to ``SportMeetupType``. You can then register it as an event subscriber on -your form:: - - private $registrationSportListener; - - public function __construct(RegistrationSportListener $registrationSportListener) - { - $this->registrationSportListener = $registrationSportListener; - } - - public function buildForm(FormBuilderInterface $builder, array $options) - { - // ... - $builder->addEventSubscriber($this->registrationSportListener); - } - -And this should tie everything together. You can now retrieve your form from the -controller, display it to a user, and validate it with the right choice options -set for every possible kind of sport that our users are registering for. +only because in two different scenarios, the data that you can use is available in different events. +Other than that, the listeners always perform exactly the same things on a given form. One piece that may still be missing is the client-side updating of your form after the sport is selected. This should be handled by making an AJAX call From 2b3bffaad65ef27d4b2e65ab1346339b863a49e4 Mon Sep 17 00:00:00 2001 From: Rick Pastoor Date: Thu, 29 Aug 2013 09:08:40 +0200 Subject: [PATCH 0534/2078] Removed some unnecessary whitespace --- book/installation.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/installation.rst b/book/installation.rst index bde9abf2ccc..698177d1c0e 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -236,9 +236,9 @@ If there are any issues, correct them now before moving on. $ rm -rf app/cache/* $ rm -rf app/logs/* - $ APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd' | grep -v root | head -1 | cut -d\ -f1` - $ sudo chmod +a "$APACHEUSER allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs - $ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs + $ APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd' | grep -v root | head -1 | cut -d\ -f1` + $ sudo chmod +a "$APACHEUSER allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs + $ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs **2. Using Acl on a system that does not support chmod +a** From d96e9b82d2ba2f7336e2e236b1feddd32f19783b Mon Sep 17 00:00:00 2001 From: kraksoft Date: Sun, 18 Aug 2013 22:49:44 +0200 Subject: [PATCH 0535/2078] Remove '' tag I think, we should remove '' tag, because we've added it earlier, as a form field. --- book/forms.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/book/forms.rst b/book/forms.rst index e8836ebd9ed..f2c583f95ee 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -731,8 +731,6 @@ of code. Of course, you'll usually need much more flexibility when rendering: {{ form_row(form.task) }} {{ form_row(form.dueDate) }} - - {{ form_end(form) }} .. code-block:: html+php @@ -743,8 +741,6 @@ of code. Of course, you'll usually need much more flexibility when rendering: row($form['task']) ?> row($form['dueDate']) ?> - - end($form) ?> Take a look at each part: From 7594167d7845fdd7cff7b1d6f82e96fceaee3518 Mon Sep 17 00:00:00 2001 From: Tim Nagel Date: Mon, 19 Aug 2013 10:42:29 +1000 Subject: [PATCH 0536/2078] Fix property path default value The default value of a property path is its name, not its value. --- reference/forms/types/options/property_path.rst.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/forms/types/options/property_path.rst.inc b/reference/forms/types/options/property_path.rst.inc index 540d17063ea..f28171fb265 100644 --- a/reference/forms/types/options/property_path.rst.inc +++ b/reference/forms/types/options/property_path.rst.inc @@ -1,7 +1,7 @@ property_path ~~~~~~~~~~~~~ -**type**: ``any`` **default**: ``the field's value`` +**type**: ``any`` **default**: ``the field's name`` Fields display a property value of the form's domain object by default. When the form is submitted, the submitted value is written back into the object. From 170914bdf288fe48eac646e112eee2a8a0ab172b Mon Sep 17 00:00:00 2001 From: Peter WONG Date: Mon, 19 Aug 2013 12:59:29 +0800 Subject: [PATCH 0537/2078] Update dynamic_form_modification.rst --- cookbook/form/dynamic_form_modification.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 5b8d326d520..42c66eaecb1 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -407,6 +407,12 @@ The meetup is passed as an entity hidden field to the form. So we can access eac sport like this:: // src/Acme/DemoBundle/Form/Type/SportMeetupType.php + namespace Acme\DemoBundle\Form\Type; + + use Symfony\Component\Form\FormBuilderInterface; + use Symfony\Component\Form\FormEvents; + use Symfony\Component\Form\FormEvent; + class SportMeetupType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) @@ -419,7 +425,7 @@ sport like this:: $builder->addEventListener( FormEvents::PRE_SET_DATA, - function(FormEvent $event) use($factory){ + function(FormEvent $event) use ($factory){ $form = $event->getForm(); // this would be your entity, i.e. SportMeetup @@ -528,7 +534,7 @@ The subscriber would now look like:: ->find($id); if ($meetup === null) { - $msg = 'The event %s could not be found for you registration'; + $msg = 'The event %s could not be found for your registration'; throw new \Exception(sprintf($msg, $id)); } $form = $event->getForm(); From 945a52fd71920266c96889689d389eb96d0fb0d0 Mon Sep 17 00:00:00 2001 From: Peter WONG Date: Mon, 19 Aug 2013 19:20:25 +0800 Subject: [PATCH 0538/2078] swap use statement to sort alphabetically --- cookbook/form/dynamic_form_modification.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 42c66eaecb1..356b9c0b2d6 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -410,8 +410,8 @@ sport like this:: namespace Acme\DemoBundle\Form\Type; use Symfony\Component\Form\FormBuilderInterface; - use Symfony\Component\Form\FormEvents; use Symfony\Component\Form\FormEvent; + use Symfony\Component\Form\FormEvents; class SportMeetupType extends AbstractType { From ce7fa3934ed0ae1a151fde80a87ac891f64bfef2 Mon Sep 17 00:00:00 2001 From: radnan Date: Mon, 19 Aug 2013 19:53:23 -0500 Subject: [PATCH 0539/2078] include missing class instantiation in example code --- components/console/events.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/console/events.rst b/components/console/events.rst index 3fe9c34c48a..f1dd133d505 100644 --- a/components/console/events.rst +++ b/components/console/events.rst @@ -14,6 +14,8 @@ the wheel, it uses the Symfony EventDispatcher component to do the work:: use Symfony\Component\Console\Application; use Symfony\Component\EventDispatcher\EventDispatcher; + $dispatcher = new EventDispatcher(); + $application = new Application(); $application->setDispatcher($dispatcher); $application->run(); From ca678e5932c1757bbcafe5f47624a4f118caf14b Mon Sep 17 00:00:00 2001 From: Ruben Gonzalez Date: Wed, 21 Aug 2013 10:54:43 +0200 Subject: [PATCH 0540/2078] Update link hashes to propel site. --- book/propel.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/propel.rst b/book/propel.rst index 4c6443f9a01..4206a468a8a 100644 --- a/book/propel.rst +++ b/book/propel.rst @@ -479,5 +479,5 @@ You should read the dedicated section for `Propel commands in Symfony2`_. .. _`Working With Symfony2`: http://propelorm.org/cookbook/symfony2/working-with-symfony2.html#installation .. _`PropelBundle configuration section`: http://propelorm.org/cookbook/symfony2/working-with-symfony2.html#configuration .. _`Relationships`: http://propelorm.org/documentation/04-relationships.html -.. _`Behaviors reference section`: http://propelorm.org/documentation/#behaviors_reference -.. _`Propel commands in Symfony2`: http://propelorm.org/cookbook/symfony2/working-with-symfony2#the_commands +.. _`Behaviors reference section`: http://propelorm.org/documentation/#behaviors-reference +.. _`Propel commands in Symfony2`: http://propelorm.org/cookbook/symfony2/working-with-symfony2#the-commands From 04dedd699a7c1a2d202aa2ce9083f04f285e35c6 Mon Sep 17 00:00:00 2001 From: Andrej Hudec Date: Wed, 21 Aug 2013 12:26:33 +0200 Subject: [PATCH 0541/2078] Added twig comment tags --- cookbook/routing/scheme.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/routing/scheme.rst b/cookbook/routing/scheme.rst index 7b601d3ba2d..d829d6c8855 100644 --- a/cookbook/routing/scheme.rst +++ b/cookbook/routing/scheme.rst @@ -51,7 +51,7 @@ will automatically generate an absolute URL with HTTPS as the scheme: {# If the current scheme is HTTPS #} {{ path('secure') }} - # generates /secure + {# generates /secure #} {# If the current scheme is HTTP #} {{ path('secure') }} From 3ef2a4d9211fd4f9a6ad56d1e5fa8ddd67a82412 Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Fri, 23 Aug 2013 00:59:53 -0500 Subject: [PATCH 0542/2078] clarification to avoid abusing this --- book/templating.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/book/templating.rst b/book/templating.rst index 83023853559..25edba5e25a 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -670,6 +670,8 @@ string syntax for controllers (i.e. **bundle**:**controller**:**action**): Whenever you find that you need a variable or a piece of information that you don't have access to in a template, consider rendering a controller. Controllers are fast to execute and promote good code organization and reuse. +This however does not mean however to create fat controllers but rather +to create services used within thin controllers that just render those pieces. Asynchronous Content with hinclude.js ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 3bfb0ee4095fd85f32c5b9d2264122907aa30658 Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Fri, 23 Aug 2013 01:02:43 -0500 Subject: [PATCH 0543/2078] Update templating.rst --- book/templating.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index 25edba5e25a..58f35f89bad 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -670,8 +670,9 @@ string syntax for controllers (i.e. **bundle**:**controller**:**action**): Whenever you find that you need a variable or a piece of information that you don't have access to in a template, consider rendering a controller. Controllers are fast to execute and promote good code organization and reuse. -This however does not mean however to create fat controllers but rather -to create services used within thin controllers that just render those pieces. +This however should not encourage many fat controllers but rather +to create services used within few view-oriented thin controllers that +just render those pieces needed. Asynchronous Content with hinclude.js ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From e8a696319529bf20b85d19f03eb3e43527ab97aa Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 29 Aug 2013 22:40:53 -0400 Subject: [PATCH 0544/2078] [#2926] Minor tweaks --- book/templating.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index 58f35f89bad..0b62b8c152b 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -670,9 +670,8 @@ string syntax for controllers (i.e. **bundle**:**controller**:**action**): Whenever you find that you need a variable or a piece of information that you don't have access to in a template, consider rendering a controller. Controllers are fast to execute and promote good code organization and reuse. -This however should not encourage many fat controllers but rather -to create services used within few view-oriented thin controllers that -just render those pieces needed. +Of course, like all controllers, they should ideally be "skinny", meaning +that as much code as possible lives in reusable :doc:`services`. Asynchronous Content with hinclude.js ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 91586494077be2c0698948ed20ed93739a50df06 Mon Sep 17 00:00:00 2001 From: Nikita Konstantinov Date: Mon, 2 Sep 2013 07:44:03 +0400 Subject: [PATCH 0545/2078] Add type hinting for directly injected service $templating --- cookbook/controller/service.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cookbook/controller/service.rst b/cookbook/controller/service.rst index 96a2d755265..d22042f726a 100644 --- a/cookbook/controller/service.rst +++ b/cookbook/controller/service.rst @@ -180,13 +180,14 @@ service and use it directly:: // src/Acme/HelloBundle/Controller/HelloController.php namespace Acme\HelloBundle\Controller; + use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface; use Symfony\Component\HttpFoundation\Response; class HelloController { private $templating; - public function __construct($templating) + public function __construct(EngineInterface $templating) { $this->templating = $templating; } From b9ae8e450a4320fe106f48e6c7feac1a5b83af96 Mon Sep 17 00:00:00 2001 From: Clement Ridoret Date: Tue, 3 Sep 2013 11:00:44 -0400 Subject: [PATCH 0546/2078] fix typo in code example --- components/console/helpers/dialoghelper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index eb819d2d96e..1d1215236f1 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -231,7 +231,7 @@ this set the seventh argument to ``true``:: $selectedColors = array_map(function($c) use ($colors) { return $colors[$c]; - }, $selected) + }, $selected); $output->writeln('You have just selected: ' . implode(', ', $selectedColors)); From 018dc898bbb3851322496b1597461aaa2ae2748d Mon Sep 17 00:00:00 2001 From: Denis Togbe Date: Thu, 15 Aug 2013 15:51:20 +0200 Subject: [PATCH 0547/2078] Add missing configuration-block --- cookbook/testing/database.rst | 70 ++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/cookbook/testing/database.rst b/cookbook/testing/database.rst index 1debca5e44d..fcd5950daed 100644 --- a/cookbook/testing/database.rst +++ b/cookbook/testing/database.rst @@ -111,40 +111,42 @@ to be able to clear the database before every test. To do this, you can specify a database configuration which overwrites the default configuration: -.. code-block:: yaml - - # app/config/config_test.yml - doctrine: - # ... - dbal: - host: localhost - dbname: testdb - user: testdb - password: testdb - -.. code-block:: xml - - - - - - -.. code-block:: php - - // app/config/config_test.php - $configuration->loadFromExtension('doctrine', array( - 'dbal' => array( - 'host' => 'localhost', - 'dbname' => 'testdb', - 'user' => 'testdb', - 'password' => 'testdb', - ), - )); +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config_test.yml + doctrine: + # ... + dbal: + host: localhost + dbname: testdb + user: testdb + password: testdb + + .. code-block:: xml + + + + + + + .. code-block:: php + + // app/config/config_test.php + $configuration->loadFromExtension('doctrine', array( + 'dbal' => array( + 'host' => 'localhost', + 'dbname' => 'testdb', + 'user' => 'testdb', + 'password' => 'testdb', + ), + )); Make sure that your database runs on localhost and has the defined database and user credentials set up. From aa0a511ea44f39a188fc2a2c2e8e676f91c66651 Mon Sep 17 00:00:00 2001 From: Denis Togbe Date: Sun, 18 Aug 2013 23:28:41 +0200 Subject: [PATCH 0548/2078] Add missing slash in XML configuration --- cookbook/testing/database.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/testing/database.rst b/cookbook/testing/database.rst index fcd5950daed..2abb0f294e8 100644 --- a/cookbook/testing/database.rst +++ b/cookbook/testing/database.rst @@ -133,7 +133,7 @@ configuration: dbname="testdb" user="testdb" password="testdb" - > + /> .. code-block:: php From b998f8613e5273b20a1b3798c06105de179f80b5 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 9 Sep 2013 07:50:19 -0500 Subject: [PATCH 0549/2078] [#2927] Tweaks to form events changes --- cookbook/form/dynamic_form_modification.rst | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index fa18cb6f79e..21d6a5c00ef 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -400,8 +400,8 @@ the data that was submitted by the user. For example, imagine you have a registr form for sports gatherings. Some events will allow you to specify your preferred position on the field. This would be a ``choice`` field for example. However the possible choices will depend on each sport. Football will have attack, defense, -goalkeeper etc... Baseball will have a pitcher but will not have goalkeeper. You -will need the correct options to be set in order for validation to pass. +goalkeeper etc... Baseball will have a pitcher but will not have a goalkeeper. You +will need the correct options in order for validation to pass. The meetup is passed as an entity field to the form. So we can access each sport like this:: @@ -455,11 +455,13 @@ On a form, we can usually listen to the following events: .. versionadded:: 2.2.6 + The behavior of the ``POST_BIND`` changed slightly in 2.2.6, which the + below example uses. -The key is to add a ``POST_BIND`` listener to the field your new field is dependent -on. If you add a POST_BIND listener to a form child, and add new children to the parent -from there, the Form component will detect the new field automatically and maps it -to the client data if it is available. +The key is to add a ``POST_BIND`` listener to the field that your new field +depends on. If you add a ``POST_BIND`` listener to a form child (e.g. ``sport`), +and add new children to the parent form, the Form component will detect the +new field automatically and map it to the submitted client data. The type would now look like:: @@ -496,7 +498,7 @@ The type would now look like:: } ); - $builder->get('meetup')->addEventListener( + $builder->get('sport')->addEventListener( FormEvents::POST_BIND, function(FormEvent $event) use ($formModifier) { // It's important here to fetch $event->getForm()->getData(), as From f162f3e2f21e0fef4932b664edd5a083aad58987 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 11 Sep 2013 17:44:11 +0200 Subject: [PATCH 0550/2078] fix link to Class Loader docs --- book/http_fundamentals.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index 8ead7a1299b..6bc0e6d1970 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -520,7 +520,7 @@ regardless of how your project is developed. To name a few: * `Validator`_ A system for creating rules about data and then validating whether or not user-submitted data follows those rules; -* :doc:`ClassLoader` An autoloading library that allows +* :doc:`ClassLoader` An autoloading library that allows PHP classes to be used without needing to manually ``require`` the files containing those classes; From 5bf1339e323675f8bbf19bd6d5d068dce16fdba7 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 11 Sep 2013 18:02:16 +0200 Subject: [PATCH 0551/2078] document the configuration of the php-standalone and php-symfony lexers --- contributing/documentation/format.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contributing/documentation/format.rst b/contributing/documentation/format.rst index c3677aaa471..8c5f15e4bd8 100644 --- a/contributing/documentation/format.rst +++ b/contributing/documentation/format.rst @@ -202,6 +202,8 @@ Installing the Sphinx extensions # enable highlighting for PHP code not between ```` by default lexers['php'] = PhpLexer(startinline=True) lexers['php-annotations'] = PhpLexer(startinline=True) + lexers['php-standalone'] = PhpLexer(startinline=True) + lexers['php-symfony'] = PhpLexer(startinline=True) # use PHP as the primary domain primary_domain = 'php' From e1bc7c08d38875c15bfb8f148c8926c7636f6c05 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 12 Sep 2013 20:56:38 -0500 Subject: [PATCH 0552/2078] [#2927] Fix thanks to @xabbuh --- cookbook/form/dynamic_form_modification.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 239658f11ef..9d2ca8bba98 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -463,7 +463,7 @@ On a form, we can usually listen to the following events: below example uses. The key is to add a ``POST_BIND`` listener to the field that your new field -depends on. If you add a ``POST_BIND`` listener to a form child (e.g. ``sport`), +depends on. If you add a ``POST_BIND`` listener to a form child (e.g. ``sport``), and add new children to the parent form, the Form component will detect the new field automatically and map it to the submitted client data. From 38438341c4528cec1846e253149c774d0251eade Mon Sep 17 00:00:00 2001 From: Michel Salib Date: Fri, 13 Sep 2013 13:58:23 +0200 Subject: [PATCH 0553/2078] Fixing wrong parameter name in redirecting in config --- cookbook/routing/redirect_in_config.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/routing/redirect_in_config.rst b/cookbook/routing/redirect_in_config.rst index 353c75c89c8..4d6b7004e6e 100644 --- a/cookbook/routing/redirect_in_config.rst +++ b/cookbook/routing/redirect_in_config.rst @@ -23,7 +23,7 @@ Your configuration will look like this: path: / defaults: _controller: FrameworkBundle:Redirect:urlRedirect - route: /app + path: /app permanent: true In this example, you configure a route for the ``/`` path and let :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController` From d3016141a4ec48e7d54e8380f0ca33c34a84a66e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 12 Sep 2013 20:02:00 +0200 Subject: [PATCH 0554/2078] remove double backtick of class directive --- components/form/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/form/introduction.rst b/components/form/introduction.rst index 28efd4ce06f..eb63b2c6f8e 100644 --- a/components/form/introduction.rst +++ b/components/form/introduction.rst @@ -81,7 +81,7 @@ to your form factory:: ->addExtension(new HttpFoundationExtension()) ->getFormFactory(); -Now, when you process a form, you can pass the :class:`Symfony\\Component\\HttpFoundation\\Request`` +Now, when you process a form, you can pass the :class:`Symfony\\Component\\HttpFoundation\\Request` object to :method:`Symfony\\Component\\Form\\Form::bind` instead of the raw array of submitted values. From d6708b06546f3b348aa1be4e0d41e86dd087955e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 12 Sep 2013 20:03:40 +0200 Subject: [PATCH 0555/2078] add missing backslash --- components/form/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/form/introduction.rst b/components/form/introduction.rst index eb63b2c6f8e..d6af2ad8863 100644 --- a/components/form/introduction.rst +++ b/components/form/introduction.rst @@ -71,7 +71,7 @@ The Form component optionally integrates with Symfony's :doc:`HttpFoundation Date: Fri, 13 Sep 2013 07:36:36 -0500 Subject: [PATCH 0556/2078] [#2927] Adding missing word thanks to @xabbuh --- cookbook/form/dynamic_form_modification.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 9d2ca8bba98..5542736e09a 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -459,7 +459,7 @@ On a form, we can usually listen to the following events: .. versionadded:: 2.2.6 - The behavior of the ``POST_BIND`` changed slightly in 2.2.6, which the + The behavior of the ``POST_BIND`` event changed slightly in 2.2.6, which the below example uses. The key is to add a ``POST_BIND`` listener to the field that your new field From ebe1260fed319310b21361814ac7abf62da05f4e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 13 Sep 2013 11:34:28 +0200 Subject: [PATCH 0557/2078] add note for the HTML5 date format --- reference/forms/types/date.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index aa87d713de2..492dc6aa79b 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -114,6 +114,13 @@ Alternatively, you can specify a string to be displayed for the "blank" value:: .. include:: /reference/forms/types/options/date_format.rst.inc +.. note:: + + If you want your field to be rendered as a HTML5 date field, you have to use + a ``single_text`` widget and the ``yyyy-MM-dd`` format (the `RFC 3339`_ format) + which is the default format if you use the ``single_text`` widget and don't + specify any other format. + .. include:: /reference/forms/types/options/data_timezone.rst.inc .. include:: /reference/forms/types/options/user_timezone.rst.inc @@ -151,3 +158,5 @@ These options inherit from the :doc:`field` type: .. include:: /reference/forms/types/options/virtual.rst.inc .. include:: /reference/forms/types/options/error_mapping.rst.inc + +.. _`RFC 3339`: http://tools.ietf.org/html/rfc3339 From 8a6860e1090fa54de5db567f6fa843262ccb58a0 Mon Sep 17 00:00:00 2001 From: KatharinaSt Date: Fri, 13 Sep 2013 21:06:36 +0200 Subject: [PATCH 0558/2078] Update installation.rst "ACL" in uppercase for continuity reasons --- book/installation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/installation.rst b/book/installation.rst index bde9abf2ccc..148c3f42880 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -241,7 +241,7 @@ If there are any issues, correct them now before moving on. $ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs - **2. Using Acl on a system that does not support chmod +a** + **2. Using ACL on a system that does not support chmod +a** Some systems don't support ``chmod +a``, but do support another utility called ``setfacl``. You may need to `enable ACL support`_ on your partition From 84db8aaf5e7427e7fa9d174c79fb6e5cab27080a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Sat, 14 Sep 2013 02:25:25 +0200 Subject: [PATCH 0559/2078] Try to fix markup XML section in http://symfony.com/doc/2.2/book/routing.html#creating-routes is missing line number and syntax coloration --- book/routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/routing.rst b/book/routing.rst index 1274d4b9274..671a9daf2cd 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -173,7 +173,7 @@ file: xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - + From b4baf5551feb7de5e47c94bdd37ea40e591f27a7 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sat, 14 Sep 2013 21:12:42 +0200 Subject: [PATCH 0560/2078] [cookbook/form/dynamic_form_modification] Fix sample code for dynamic generation of submitted forms (3rd section) --- cookbook/form/dynamic_form_modification.rst | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 5542736e09a..ab68deecf80 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -473,8 +473,8 @@ The type would now look like:: namespace Acme\DemoBundle\Form\Type; // ... - Acme\DemoBundle\Entity\Sport; - Symfony\Component\Form\FormInterface; + use Acme\DemoBundle\Entity\Sport; + use Symfony\Component\Form\FormInterface; class SportMeetupType extends AbstractType { @@ -485,20 +485,18 @@ The type would now look like:: ; $formModifier = function(FormInterface $form, Sport $sport) { - $positions = $data->getSport()->getAvailablePositions(); + $positions = $sport->getAvailablePositions(); $form->add('position', 'entity', array('choices' => $positions)); - } + }; $builder->addEventListener( FormEvents::PRE_SET_DATA, - function(FormEvent $event) { - $form = $event->getForm(); - + function(FormEvent $event) use ($formModifier) { // this would be your entity, i.e. SportMeetup $data = $event->getData(); - $formModifier($event->getForm(), $sport); + $formModifier($event->getForm(), $data->getSport()); } ); @@ -506,11 +504,9 @@ The type would now look like:: FormEvents::POST_BIND, function(FormEvent $event) use ($formModifier) { // It's important here to fetch $event->getForm()->getData(), as - // $event->getData() will get you the client data (this is, the ID) + // $event->getData() will get you the client data (that is, the ID) $sport = $event->getForm()->getData(); - $positions = $sport->getAvailablePositions(); - // since we've added the listener to the child, we'll have to pass on // the parent to the callback functions! $formModifier($event->getForm()->getParent(), $sport); From 7f432062f721ea8be953fd189e0763d63d25d98f Mon Sep 17 00:00:00 2001 From: Denis Togbe Date: Mon, 16 Sep 2013 17:29:34 +0200 Subject: [PATCH 0561/2078] [Components][Config][Definition] Fix code sample --- components/config/definition.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index dc471b6dd20..4ca0f790b69 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -177,11 +177,12 @@ Or you may define a prototype for each node inside an array node:: ->children() ->arrayNode('connections') ->prototype('array') - ->children() - ->scalarNode('driver')->end() - ->scalarNode('host')->end() - ->scalarNode('username')->end() - ->scalarNode('password')->end() + ->children() + ->scalarNode('driver')->end() + ->scalarNode('host')->end() + ->scalarNode('username')->end() + ->scalarNode('password')->end() + ->end() ->end() ->end() ->end() From 1262487380d02ac3239b452ff4a5ef4f1d683342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=A4utli?= Date: Sun, 18 Aug 2013 12:58:00 +0200 Subject: [PATCH 0562/2078] Removed warning about using swiftmailer handler with memory spool --- cookbook/logging/monolog_email.rst | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cookbook/logging/monolog_email.rst b/cookbook/logging/monolog_email.rst index 69e723f6fc6..b429bc8c588 100644 --- a/cookbook/logging/monolog_email.rst +++ b/cookbook/logging/monolog_email.rst @@ -107,14 +107,6 @@ to and from addresses and the subject. You can combine these handlers with other handlers so that the errors still get logged on the server as well as the emails being sent: -.. caution:: - - The default spool setting for swiftmailer is set to ``memory``, which - means that emails are sent at the very end of the request. However, this - does not work with buffered logs at the moment. In order to enable emailing - logs per the example below, you are must comment out the ``spool: { type: memory }`` - line in the ``config.yml`` file. - .. configuration-block:: .. code-block:: yaml From 86e260e8e6d1e433f590e14547c9bc4b6aec0293 Mon Sep 17 00:00:00 2001 From: Nelson da Costa Date: Sun, 4 Aug 2013 11:09:48 +0200 Subject: [PATCH 0563/2078] Update dynamic_form_modification.rst --- cookbook/form/dynamic_form_modification.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 5542736e09a..f052ff9629b 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -277,8 +277,6 @@ and fill in the listener logic:: $formOptions = array( 'class' => 'Acme\DemoBundle\Entity\User', - 'multiple' => false, - 'expanded' => false, 'property' => 'fullName', 'query_builder' => function(EntityRepository $er) use ($user) { // build a custom query, or call a method on your repository (even better!) @@ -295,6 +293,10 @@ and fill in the listener logic:: // ... } +.. note:: + + The ``multiple`` and ``expanded`` form options will default to false because the entity type is ``entity``. + Using the Form ~~~~~~~~~~~~~~ From 733c4877977bc343357a85263bca858758587ef8 Mon Sep 17 00:00:00 2001 From: Nelson da Costa Date: Sun, 4 Aug 2013 11:12:46 +0200 Subject: [PATCH 0564/2078] No need to set "multiple" and "expanded" to false as the field's type is "entity". --- cookbook/form/dynamic_form_modification.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index f052ff9629b..2178c5ee71e 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -295,7 +295,7 @@ and fill in the listener logic:: .. note:: - The ``multiple`` and ``expanded`` form options will default to false because the entity type is ``entity``. + The ``multiple`` and ``expanded`` form options will default to false because the friend field's type is ``entity``. Using the Form ~~~~~~~~~~~~~~ From 75571ae6b379da3ac75dec512b72c14177d2a00f Mon Sep 17 00:00:00 2001 From: Nelson da Costa Date: Sun, 4 Aug 2013 11:14:04 +0200 Subject: [PATCH 0565/2078] Update dynamic_form_modification.rst --- cookbook/form/dynamic_form_modification.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 2178c5ee71e..660fc3d5170 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -295,7 +295,7 @@ and fill in the listener logic:: .. note:: - The ``multiple`` and ``expanded`` form options will default to false because the friend field's type is ``entity``. + The ``multiple`` and ``expanded`` form options will default to false because the type of the friend field is ``entity``. Using the Form ~~~~~~~~~~~~~~ From bf0ce1a622b662ad14f9b4a951ea4f576b223843 Mon Sep 17 00:00:00 2001 From: Nelson da Costa Date: Mon, 26 Aug 2013 01:21:24 +0200 Subject: [PATCH 0566/2078] query_builder's callback must return a Doctrine\ORM\QueryBuilder calling a repository in a "query_builder" callback would result in an exception saying: Expected argument of type "Doctrine\ORM\QueryBuilder", "array" given --- cookbook/form/dynamic_form_modification.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 660fc3d5170..aaada8cd983 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -279,7 +279,7 @@ and fill in the listener logic:: 'class' => 'Acme\DemoBundle\Entity\User', 'property' => 'fullName', 'query_builder' => function(EntityRepository $er) use ($user) { - // build a custom query, or call a method on your repository (even better!) + // build a custom query }, ); From 5fc3920f4906fb7c850cb2e68297c245ffa9d496 Mon Sep 17 00:00:00 2001 From: Nelson da Costa Date: Mon, 26 Aug 2013 09:19:50 +0200 Subject: [PATCH 0567/2078] addde a line breaks after the first word that crossed the 72th character --- cookbook/form/dynamic_form_modification.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index aaada8cd983..89964edd31c 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -295,7 +295,8 @@ and fill in the listener logic:: .. note:: - The ``multiple`` and ``expanded`` form options will default to false because the type of the friend field is ``entity``. + The ``multiple`` and ``expanded`` form options will default to false + because the type of the friend field is ``entity``. Using the Form ~~~~~~~~~~~~~~ From dcc1c52f8c031e38595360f52c4722c393df25c7 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 18 Sep 2013 10:05:27 -0500 Subject: [PATCH 0568/2078] [#2935] Enhancing note about using a repository to build a QB or to just call a function return the QB --- cookbook/form/dynamic_form_modification.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 89964edd31c..8316335c3a8 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -280,6 +280,11 @@ and fill in the listener logic:: 'property' => 'fullName', 'query_builder' => function(EntityRepository $er) use ($user) { // build a custom query + // return $er->createQueryBuilder('u')->addOrderBy('fullName', 'DESC'); + + // or call a method on your repository that returns the query builder + // the $er is an instance of your UserRepository + // return $er->createOrderByFullNameQueryBuilder(); }, ); From 0ad55aed74b138d568f13213c1714bb0e3c504e7 Mon Sep 17 00:00:00 2001 From: PPR Date: Wed, 28 Aug 2013 01:00:36 +0200 Subject: [PATCH 0569/2078] Trying to add an accessible definition of the DI in the glossary --- glossary.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/glossary.rst b/glossary.rst index 6a06c8d5c66..cfd45f4c0d1 100644 --- a/glossary.rst +++ b/glossary.rst @@ -11,6 +11,16 @@ Glossary selection of bundles, a sensible directory structure, a default configuration, and an optional configuration system. + Dependency Injection + The Dependency Injection is a design pattern highly used in Symfony2 Framework. + It encourages less coupled and more maintainable architecture of an application. + The main principle of this pattern is that it allows developers to *inject* objects + (also known as services) in other objects, passing generally it as parameters. + Different levels of coupling between these objects can be established + depending on the method used to inject objects together. + The Dependency Injection pattern is the more often associated + to an other specific type of object: the :doc:`/book/service_container` + Project A *Project* is a directory composed of an Application, a set of bundles, vendor libraries, an autoloader, and web front controller From 6c58cc973709d90777a734bbc3e216969cb2140d Mon Sep 17 00:00:00 2001 From: PPR Date: Wed, 28 Aug 2013 01:03:58 +0200 Subject: [PATCH 0570/2078] Oups fixed a typo :] --- glossary.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glossary.rst b/glossary.rst index cfd45f4c0d1..2e9abeb7d23 100644 --- a/glossary.rst +++ b/glossary.rst @@ -18,8 +18,8 @@ Glossary (also known as services) in other objects, passing generally it as parameters. Different levels of coupling between these objects can be established depending on the method used to inject objects together. - The Dependency Injection pattern is the more often associated - to an other specific type of object: the :doc:`/book/service_container` + The Dependency Injection pattern is the more often associated + to another specific type of object: the :doc:`/book/service_container` Project A *Project* is a directory composed of an Application, a set of From a82921147f0417e2d0c35acf9f3da2a6803bdfba Mon Sep 17 00:00:00 2001 From: Jey Date: Wed, 28 Aug 2013 10:30:17 +0200 Subject: [PATCH 0571/2078] Adding some correction --- glossary.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glossary.rst b/glossary.rst index 2e9abeb7d23..776d5368497 100644 --- a/glossary.rst +++ b/glossary.rst @@ -12,10 +12,10 @@ Glossary configuration, and an optional configuration system. Dependency Injection - The Dependency Injection is a design pattern highly used in Symfony2 Framework. - It encourages less coupled and more maintainable architecture of an application. - The main principle of this pattern is that it allows developers to *inject* objects - (also known as services) in other objects, passing generally it as parameters. + The Dependency Injection is a design pattern highly used in the Symfony2 Framework. + It encourages loosely coupled and more maintainable architecture of an application. + The main principle of this pattern is that it allows developers to *inject* into other objects + (also known as services) in other objects, generally passing them as parameters. Different levels of coupling between these objects can be established depending on the method used to inject objects together. The Dependency Injection pattern is the more often associated From 6c82faa8afd1268f510dbf6652d166a534f27f46 Mon Sep 17 00:00:00 2001 From: Jey Date: Wed, 28 Aug 2013 13:49:57 +0200 Subject: [PATCH 0572/2078] One more correction --- glossary.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glossary.rst b/glossary.rst index 776d5368497..ae08557d7ef 100644 --- a/glossary.rst +++ b/glossary.rst @@ -14,7 +14,7 @@ Glossary Dependency Injection The Dependency Injection is a design pattern highly used in the Symfony2 Framework. It encourages loosely coupled and more maintainable architecture of an application. - The main principle of this pattern is that it allows developers to *inject* into other objects + The main principle of this pattern is that it allows developers to *inject* objects (also known as services) in other objects, generally passing them as parameters. Different levels of coupling between these objects can be established depending on the method used to inject objects together. From 67bf79b4d00230a3368931c147064cbadc751921 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 18 Sep 2013 10:09:53 -0500 Subject: [PATCH 0573/2078] [#2941] Fixing some whitespace --- glossary.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/glossary.rst b/glossary.rst index ae08557d7ef..bac69383ce5 100644 --- a/glossary.rst +++ b/glossary.rst @@ -13,13 +13,13 @@ Glossary Dependency Injection The Dependency Injection is a design pattern highly used in the Symfony2 Framework. - It encourages loosely coupled and more maintainable architecture of an application. - The main principle of this pattern is that it allows developers to *inject* objects + It encourages loosely coupled and more maintainable architecture of an application. + The main principle of this pattern is that it allows developers to *inject* objects (also known as services) in other objects, generally passing them as parameters. - Different levels of coupling between these objects can be established + Different levels of coupling between these objects can be established depending on the method used to inject objects together. - The Dependency Injection pattern is the more often associated - to another specific type of object: the :doc:`/book/service_container` + The Dependency Injection pattern is the more often associated + to another specific type of object: the :doc:`/book/service_container`. Project A *Project* is a directory composed of an Application, a set of From 56cf668ef86fb378ba55e816639fbbe78aae35a1 Mon Sep 17 00:00:00 2001 From: Janusz Slota Date: Wed, 28 Aug 2013 11:10:26 +0100 Subject: [PATCH 0574/2078] Changed $task to $tag getTags() returns collection of Tag objects therefore you want to add $tag not $task --- cookbook/form/form_collections.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/form_collections.rst b/cookbook/form/form_collections.rst index 506c5c0caf5..a3be1c8172e 100755 --- a/cookbook/form/form_collections.rst +++ b/cookbook/form/form_collections.rst @@ -456,7 +456,7 @@ Next, add a ``by_reference`` option to the ``tags`` field and set it to ``false` With these two changes, when the form is submitted, each new ``Tag`` object is added to the ``Task`` class by calling the ``addTag`` method. Before this -change, they were added internally by the form by calling ``$task->getTags()->add($task)``. +change, they were added internally by the form by calling ``$task->getTags()->add($tag)``. That was just fine, but forcing the use of the "adder" method makes handling these new ``Tag`` objects easier (especially if you're using Doctrine, which we talk about next!). From f68b4ec715ad293f10d83621bf48414a0ec495ad Mon Sep 17 00:00:00 2001 From: Andrej Hudec Date: Wed, 28 Aug 2013 23:25:06 +0200 Subject: [PATCH 0575/2078] Added @throws phpdoc to Coding Standards example --- contributing/code/standards.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contributing/code/standards.rst b/contributing/code/standards.rst index de074474756..16808472f53 100644 --- a/contributing/code/standards.rst +++ b/contributing/code/standards.rst @@ -52,6 +52,8 @@ example containing most features described below: * @param array $options * * @return string|null Transformed input + * + * @throws \RuntimeException */ private function transformText($dummy, array $options = array()) { From ab4788df79765204725ddebfb389763b24d48e21 Mon Sep 17 00:00:00 2001 From: Andy Truong Date: Wed, 4 Sep 2013 21:22:21 +0700 Subject: [PATCH 0576/2078] Symfony\Component\HttpFoundation\Session\Session::keys() does not exist --- components/http_foundation/sessions.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/components/http_foundation/sessions.rst b/components/http_foundation/sessions.rst index f83eb8e9773..c8efc9f3af7 100644 --- a/components/http_foundation/sessions.rst +++ b/components/http_foundation/sessions.rst @@ -102,9 +102,6 @@ Session attributes * :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::has`: Returns true if the attribute exists; -* :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::keys`: - Returns an array of stored attribute keys; - * :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::replace`: Sets multiple attributes at once: takes a keyed array and sets each key => value pair. From df16298dd17103f4ebf24d4c3e10435f5c50dbe7 Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 6 Sep 2013 11:38:45 +0200 Subject: [PATCH 0577/2078] Update custom_route_loader.rst $loaded variables doesn't seem to be useful in this code, as no one is setting as true in any moment. --- cookbook/routing/custom_route_loader.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cookbook/routing/custom_route_loader.rst b/cookbook/routing/custom_route_loader.rst index 14f9142bc04..2e2f1ab5086 100644 --- a/cookbook/routing/custom_route_loader.rst +++ b/cookbook/routing/custom_route_loader.rst @@ -95,6 +95,8 @@ type you want. The resource name itself is not actually used in the example:: // add the new route to the route collection: $routeName = 'extraRoute'; $routes->add($routeName, $route); + + $this->loaded = true; return $routes; } From e8ea35714c3a015f887e39e6ddde77921e65f218 Mon Sep 17 00:00:00 2001 From: deguif Date: Wed, 11 Sep 2013 14:04:39 +0200 Subject: [PATCH 0578/2078] Fix routes table in routing documentation --- book/routing.rst | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/book/routing.rst b/book/routing.rst index 1274d4b9274..507863cfcbb 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -422,13 +422,15 @@ longer required. The URL ``/blog`` will match this route and the value of the ``page`` parameter will be set to ``1``. The URL ``/blog/2`` will also match, giving the ``page`` parameter a value of ``2``. Perfect. -+---------+------------+ -| /blog | {page} = 1 | -+---------+------------+ -| /blog/1 | {page} = 1 | -+---------+------------+ -| /blog/2 | {page} = 2 | -+---------+------------+ ++--------------------+-------+-----------------------+ +| URL | route | parameters | ++====================+=======+=======================+ +| /blog | blog | {page} = 1 | ++--------------------+-------+-----------------------+ +| /blog/1 | blog | {page} = 1 | ++--------------------+-------+-----------------------+ +| /blog/2 | blog | {page} = 2 | ++--------------------+-------+-----------------------+ .. tip:: From 89d987acd66873b8ff7630a6d7e406fd664a4c3d Mon Sep 17 00:00:00 2001 From: WouterJ Date: Wed, 18 Sep 2013 17:45:13 +0200 Subject: [PATCH 0579/2078] Added final override section --- cookbook/bundles/inheritance.rst | 13 +++++---- cookbook/bundles/override.rst | 50 +++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/cookbook/bundles/inheritance.rst b/cookbook/bundles/inheritance.rst index cfb56b52db0..4fcafbea24f 100644 --- a/cookbook/bundles/inheritance.rst +++ b/cookbook/bundles/inheritance.rst @@ -73,8 +73,8 @@ original method, and change its functionality:: the controller using the standard ``FOSUserBundle:Registration:register`` syntax in routes and templates. This is the best practice. -Overriding Resources: Templates, Routing, Validation, etc -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Overriding Resources: Templates, Routing, etc +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Most resources can also be overridden, simply by creating a file in the same location as your parent bundle. @@ -86,7 +86,7 @@ you can create your own file in the same location of ``AcmeUserBundle``. Symfony will ignore the file that lives inside the ``FOSUserBundle`` entirely, and use your file instead. -The same goes for routing files, validation configuration and other resources. +The same goes for routing files and some other resources. .. note:: @@ -97,8 +97,9 @@ The same goes for routing files, validation configuration and other resources. .. caution:: - Translation files do not work in the same way as described above. Read - :ref:`override-translations` if you want to learn how to override - translations. + Translation and validation files do not work in the same way as described + above. Read ":ref:`override-translations`" if you want to learn how to + override translations and see ":ref:`override-validation`" for tricks to + override the validation. .. _`FOSUserBundle`: https://github.com/friendsofsymfony/fosuserbundle diff --git a/cookbook/bundles/override.rst b/cookbook/bundles/override.rst index a78bb9fc062..094e2f6b5b6 100644 --- a/cookbook/bundles/override.rst +++ b/cookbook/bundles/override.rst @@ -117,10 +117,58 @@ rather than:: $builder->add('name', new CustomType()); +.. _override-validation: + Validation metadata ------------------- -In progress... +Symfony loads all validation configuration files from every bundle and +combines them into one validation metadata tree. This means you are able to +add new constraints to a property, but you cannot override it. + +To override this, the 3th party bundle needs to have configuration for +:ref:`validation groups `. For instance, +the FOSUserBundle has this configuration. To create your own validation, add +the constraints to a new validation group: + +.. configuration-block:: + + .. code-block:: yaml + + # src/Acme/UserBundle/Resources/config/validation.yml + Fos\UserBundle\Model\User: + properties: + plainPassword: + - NotBlank: + groups: [AcmeValidation] + - Length: + min: 6 + minMessage: fos_user.password.short + groups: [AcmeValidation] + + .. code-block:: xml + + + + + + + + + + + + + + + + +Now, update the FosUserBundle configuration, so it uses your validation groups +instead of the original ones. .. _override-translations: From da94d961d65af877b26727a8f6c63266eb225818 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Wed, 18 Sep 2013 18:06:01 +0200 Subject: [PATCH 0580/2078] Fixed wrong redirecting --- cookbook/form/index.rst | 5 +++++ cookbook/form/use_virtuals_forms.rst | 5 +++++ redirection_map | 1 - 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 cookbook/form/use_virtuals_forms.rst diff --git a/cookbook/form/index.rst b/cookbook/form/index.rst index d148a76ac55..5aea7405d4c 100644 --- a/cookbook/form/index.rst +++ b/cookbook/form/index.rst @@ -14,3 +14,8 @@ Form unit_testing use_empty_data direct_submit + +.. toctree:: + :hidden: + + use_virtuals_forms diff --git a/cookbook/form/use_virtuals_forms.rst b/cookbook/form/use_virtuals_forms.rst new file mode 100644 index 00000000000..9f8ed394cff --- /dev/null +++ b/cookbook/form/use_virtuals_forms.rst @@ -0,0 +1,5 @@ +How to use the Virtual Form Field Option +======================================== + +As of Symfony 2.3, the ``virtual`` option is renamed to ``inherit_data``. You +can read everything about the new option in ":doc:`/cookbook/form/inherit_data_option`". diff --git a/redirection_map b/redirection_map index 98f19697f46..36dd9800c63 100644 --- a/redirection_map +++ b/redirection_map @@ -20,5 +20,4 @@ /components/routing /components/routing/introduction /cookbook/console/generating_urls /cookbook/console/sending_emails /components/yaml /components/yaml/introduction -/cookbook/form/use_virtuals_forms /cookbook/form/inherit_data_option /components/templating /components/templating/introduction From 899d0f0d9964aeda17b0716bd772eb75cb304da5 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Wed, 18 Sep 2013 19:10:45 +0200 Subject: [PATCH 0581/2078] Fixed embedded references --- book/controller.rst | 9 +-- book/doctrine.rst | 14 ++--- book/forms.rst | 27 ++++----- book/from_flat_php_to_symfony2.rst | 12 ++-- book/http_fundamentals.rst | 14 ++--- book/installation.rst | 4 +- book/internals.rst | 4 +- book/page_creation.rst | 10 ++-- book/routing.rst | 8 +-- book/security.rst | 20 +++---- book/service_container.rst | 6 +- book/templating.rst | 10 ++-- book/testing.rst | 8 +-- book/validation.rst | 12 ++-- .../console/helpers/formatterhelper.rst | 2 +- components/console/introduction.rst | 2 +- components/css_selector.rst | 2 +- components/dependency_injection/advanced.rst | 4 +- .../dependency_injection/compilation.rst | 2 +- .../dependency_injection/introduction.rst | 4 +- components/dependency_injection/workflow.rst | 14 ++--- components/dom_crawler.rst | 6 +- .../container_aware_dispatcher.rst | 2 +- components/event_dispatcher/introduction.rst | 4 +- components/form/introduction.rst | 20 +++---- components/http_foundation/introduction.rst | 6 +- components/http_kernel/introduction.rst | 46 +++++++-------- components/routing/hostname_pattern.rst | 4 +- components/routing/introduction.rst | 6 +- components/templating/helpers/slotshelper.rst | 2 +- contributing/community/releases.rst | 2 +- contributing/documentation/format.rst | 2 +- contributing/documentation/overview.rst | 2 +- contributing/documentation/standards.rst | 4 +- contributing/map.rst.inc | 6 +- cookbook/assetic/asset_management.rst | 10 ++-- cookbook/assetic/uglifyjs.rst | 4 +- cookbook/bundles/best_practices.rst | 4 +- cookbook/bundles/extension.rst | 8 +-- cookbook/cache/varnish.rst | 4 +- cookbook/configuration/environments.rst | 2 +- .../front_controllers_and_kernel.rst | 6 +- cookbook/console/logging.rst | 4 +- cookbook/controller/error_pages.rst | 2 +- cookbook/controller/service.rst | 2 +- cookbook/doctrine/common_extensions.rst | 4 +- .../doctrine/event_listeners_subscribers.rst | 4 +- cookbook/doctrine/file_uploads.rst | 6 +- cookbook/doctrine/registration_form.rst | 4 +- .../event_dispatcher/before_after_filters.rst | 2 +- cookbook/form/create_form_type_extension.rst | 6 +- cookbook/form/data_transformers.rst | 2 +- cookbook/form/dynamic_form_modification.rst | 2 +- cookbook/form/form_collections.rst | 2 +- cookbook/form/form_customization.rst | 4 +- cookbook/form/unit_testing.rst | 2 +- cookbook/logging/monolog.rst | 4 +- cookbook/security/entity_provider.rst | 6 +- cookbook/security/form_login.rst | 2 +- cookbook/security/securing_services.rst | 6 +- cookbook/session/locale_sticky_session.rst | 4 +- cookbook/session/sessions_directory.rst | 2 +- cookbook/templating/global_variables.rst | 2 +- cookbook/testing/database.rst | 2 +- cookbook/testing/profiling.rst | 2 +- cookbook/workflow/_vendor_deps.rst.inc | 2 +- quick_tour/the_view.rst | 2 +- reference/configuration/framework.rst | 2 +- reference/configuration/security.rst | 4 +- reference/constraints/All.rst | 4 +- reference/constraints/Blank.rst | 2 +- reference/constraints/Callback.rst | 6 +- reference/constraints/CardScheme.rst | 4 +- reference/constraints/Choice.rst | 4 +- reference/constraints/Collection.rst | 4 +- reference/constraints/Count.rst | 6 +- reference/constraints/Country.rst | 2 +- reference/constraints/Date.rst | 2 +- reference/constraints/DateTime.rst | 2 +- reference/constraints/Email.rst | 2 +- reference/constraints/False.rst | 2 +- reference/constraints/File.rst | 8 +-- reference/constraints/Image.rst | 12 ++-- reference/constraints/Ip.rst | 2 +- reference/constraints/Language.rst | 2 +- reference/constraints/Length.rst | 6 +- reference/constraints/Locale.rst | 2 +- reference/constraints/Luhn.rst | 2 +- reference/constraints/Max.rst | 4 +- reference/constraints/MaxLength.rst | 4 +- reference/constraints/Min.rst | 4 +- reference/constraints/MinLength.rst | 4 +- reference/constraints/NotBlank.rst | 2 +- reference/constraints/NotNull.rst | 2 +- reference/constraints/Null.rst | 2 +- reference/constraints/Range.rst | 6 +- reference/constraints/Regex.rst | 4 +- reference/constraints/Time.rst | 2 +- reference/constraints/True.rst | 2 +- reference/constraints/Type.rst | 6 +- reference/constraints/UniqueEntity.rst | 4 +- reference/constraints/Url.rst | 2 +- reference/constraints/UserPassword.rst | 2 +- reference/constraints/Valid.rst | 2 +- reference/dic_tags.rst | 2 +- reference/forms/twig_reference.rst | 4 +- reference/forms/types/birthday.rst | 10 ++-- reference/forms/types/checkbox.rst | 4 +- reference/forms/types/choice.rst | 52 ++++++++--------- reference/forms/types/collection.rst | 8 +-- reference/forms/types/country.rst | 6 +- reference/forms/types/date.rst | 2 +- reference/forms/types/datetime.rst | 10 ++-- reference/forms/types/email.rst | 6 +- reference/forms/types/entity.rst | 6 +- reference/forms/types/field.rst | 2 +- reference/forms/types/file.rst | 4 +- reference/forms/types/form.rst | 2 +- reference/forms/types/hidden.rst | 4 +- reference/forms/types/integer.rst | 4 +- reference/forms/types/language.rst | 6 +- reference/forms/types/locale.rst | 6 +- reference/forms/types/map.rst.inc | 56 +++++++++---------- reference/forms/types/money.rst | 4 +- reference/forms/types/number.rst | 4 +- reference/forms/types/password.rst | 4 +- reference/forms/types/percent.rst | 4 +- reference/forms/types/radio.rst | 8 +-- reference/forms/types/repeated.rst | 4 +- reference/forms/types/search.rst | 6 +- reference/forms/types/text.rst | 4 +- reference/forms/types/textarea.rst | 4 +- reference/forms/types/time.rst | 2 +- reference/forms/types/timezone.rst | 6 +- reference/forms/types/url.rst | 4 +- reference/map.rst.inc | 6 +- reference/twig_reference.rst | 18 +++--- 137 files changed, 412 insertions(+), 410 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 7583924414d..ff9206158c1 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -196,7 +196,7 @@ see :ref:`controller-string-syntax`. .. tip:: - You can learn much more about the routing system in the :doc:`Routing chapter`. + You can learn much more about the routing system in the :doc:`Routing chapter `. .. index:: single: Controller; Controller arguments @@ -397,7 +397,7 @@ itself. .. note:: - You can also define your :doc:`Controllers as Services`. + You can also define your :doc:`Controllers as Services `. This is optional, but can give you more control over the exact dependencies that are injected into your controllers. @@ -494,7 +494,7 @@ value to each variable. Like other base ``Controller`` methods, the ``forward`` method is just a shortcut for core Symfony2 functionality. A forward can be accomplished directly by duplicating the current request. When this - :ref:`sub request` is executed via the ``http_kernel`` + :ref:`sub request ` is executed via the ``http_kernel`` service the ``HttpKernel`` returns a ``Response`` object:: use Symfony\Component\HttpKernel/HttpKernelInterface; @@ -549,7 +549,8 @@ The Symfony templating engine is explained in great detail in the .. tip:: You can even avoid calling the ``render`` method by using the ``@Template`` - annotation. See the :doc:`FrameworkExtraBundle documentation` + annotation. See the + :doc:`FrameworkExtraBundle documentation ` more details. .. tip:: diff --git a/book/doctrine.rst b/book/doctrine.rst index 033a72447a9..a97d783864b 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -473,7 +473,7 @@ in your application. To do this, run: new column to the existing ``product`` table. An even better way to take advantage of this functionality is via - :doc:`migrations`, which allow you to + :doc:`migrations `, which allow you to generate these SQL statements and store them in migration classes that can be run systematically on your production server in order to track and migrate your database schema safely and reliably. @@ -581,7 +581,7 @@ on its ``id`` value:: You can achieve the equivalent of this without writing any code by using the ``@ParamConverter`` shortcut. See the - :doc:`FrameworkExtraBundle documentation` + :doc:`FrameworkExtraBundle documentation ` for more details. When you query for a particular type of object, you always use what's known @@ -758,7 +758,7 @@ for just one object, you can use the ``getSingleResult()`` method instead:: // ... The DQL syntax is incredibly powerful, allowing you to easily join between -entities (the topic of :ref:`relations` will be +entities (the topic of :ref:`relations ` will be covered later), group, etc. For more information, see the official Doctrine `Doctrine Query Language`_ documentation. @@ -1112,7 +1112,7 @@ table, and ``product.category_id`` column, and new foreign key: This task should only be really used during development. For a more robust method of systematically updating your production database, read about - :doc:`Doctrine migrations`. + :doc:`Doctrine migrations `. Saving Related Entities ~~~~~~~~~~~~~~~~~~~~~~~ @@ -1300,7 +1300,7 @@ Configuration Doctrine is highly configurable, though you probably won't ever need to worry about most of its options. To find out more about configuring Doctrine, see -the Doctrine section of the :doc:`reference manual`. +the Doctrine section of the :doc:`reference manual `. Lifecycle Callbacks ------------------- @@ -1412,7 +1412,7 @@ These include thing such as *Sluggable*, *Timestampable*, *Loggable*, *Translata and *Tree*. For more information on how to find and use these extensions, see the cookbook -article about :doc:`using common Doctrine extensions`. +article about :doc:`using common Doctrine extensions `. .. _book-doctrine-field-types: @@ -1591,7 +1591,7 @@ that allow you to take different actions as objects go through their persistence lifecycle. For more information about Doctrine, see the *Doctrine* section of the -:doc:`cookbook`, which includes the following articles: +:doc:`cookbook `, which includes the following articles: * :doc:`/bundles/DoctrineFixturesBundle/index` * :doc:`/cookbook/doctrine/common_extensions` diff --git a/book/forms.rst b/book/forms.rst index 3cdae81abe8..713cea4a077 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -382,7 +382,7 @@ corresponding errors printed out with the form. blank fields. Validation is a very powerful feature of Symfony2 and has its own -:doc:`dedicated chapter`. +:doc:`dedicated chapter `. .. index:: single: Forms; Validation groups @@ -404,7 +404,7 @@ you'll need to specify which validation group(s) your form should use:: 'validation_groups' => array('registration'), ))->add(...); -If you're creating :ref:`form classes` (a +If you're creating :ref:`form classes ` (a good practice), then you'll need to add the following to the ``setDefaultOptions()`` method:: @@ -489,7 +489,7 @@ Field Type Options Each field type has a number of options that can be used to configure it. For example, the ``dueDate`` field is currently being rendered as 3 select -boxes. However, the :doc:`date field` can be +boxes. However, the :doc:`date field ` can be configured to be rendered as a single text box (where the user would enter the date as a string in the box):: @@ -508,7 +508,8 @@ the documentation for each type. any field. By default, the ``required`` option is set to ``true``, meaning that HTML5-ready browsers will apply client-side validation if the field is left blank. If you don't want this behavior, either set the ``required`` - option on your field to ``false`` or :ref:`disable HTML5 validation`. + option on your field to ``false`` or + :ref:`disable HTML5 validation `. Also note that setting the ``required`` option to ``true`` will **not** result in server-side validation to be applied. In other words, if a @@ -661,7 +662,7 @@ Take a look at each part: It's usually a good idea to place a call to this helper at the bottom of each form (in case you forgot to output a field or don't want to bother manually rendering hidden fields). This helper is also useful for taking - advantage of the automatic :ref:`CSRF Protection`. + advantage of the automatic :ref:`CSRF Protection `. The majority of the work is done by the ``form_row`` helper, which renders the label, errors and HTML form widget of each field inside a ``div`` tag @@ -794,7 +795,7 @@ Twig Template Function Reference ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If you're using Twig, a full reference of the form rendering functions is -available in the :doc:`reference manual`. +available in the :doc:`reference manual `. Read this to know everything about the helpers available and the options that can be used with each. @@ -985,7 +986,7 @@ HTML form and then translate user-submitted data back to the original object. As such, the topic of persisting the ``Task`` object to the database is entirely unrelated to the topic of forms. But, if you've configured the ``Task`` class to be persisted via Doctrine (i.e. you've added -:ref:`mapping metadata` for it), then persisting +:ref:`mapping metadata ` for it), then persisting it after a form submission can be done when the form is valid:: if ($form->isValid()) { @@ -1001,7 +1002,7 @@ you can fetch it from the form:: $task = $form->getData(); -For more information, see the :doc:`Doctrine ORM chapter`. +For more information, see the :doc:`Doctrine ORM chapter `. The key thing to understand is that when the form is bound, the submitted data is transferred to the underlying object immediately. If you want to @@ -1166,7 +1167,7 @@ form with many ``Product`` sub-forms). This is done by using the ``collection`` field type. For more information see the ":doc:`/cookbook/form/form_collections`" cookbook -entry and the :doc:`collection` field type reference. +entry and the :doc:`collection ` field type reference. .. index:: single: Forms; Theming @@ -1354,7 +1355,7 @@ override the default error rendering for *all* fields, copy and customize the .. tip:: The "parent" type of each field type is available in the - :doc:`form type reference` for each field type. + :doc:`form type reference ` for each field type. .. index:: single: Forms; Global Theming @@ -1643,7 +1644,7 @@ array of your submitted data, how can you add constraints to the data of your form? The answer is to setup the constraints yourself, and attach them to the individual -fields. The overall approach is covered a bit more in the :ref:`validation chapter`, +fields. The overall approach is covered a bit more in the :ref:`validation chapter `, but here's a short example: .. versionadded:: 2.1 @@ -1689,11 +1690,11 @@ take the data submitted by the user and to re-apply it to the object. There's still much more to learn about the powerful world of forms, such as how to handle :doc:`file uploads with Doctrine -` or how to create a form where a dynamic + ` or how to create a form where a dynamic number of sub-forms can be added (e.g. a todo list where you can keep adding more fields via Javascript before submitting). See the cookbook for these topics. Also, be sure to lean on the -:doc:`field type reference documentation`, which +:doc:`field type reference documentation `, which includes examples of how to use each field type and its options. Learn more from the Cookbook diff --git a/book/from_flat_php_to_symfony2.rst b/book/from_flat_php_to_symfony2.rst index 7fca407dd9a..d3d290d21ad 100644 --- a/book/from_flat_php_to_symfony2.rst +++ b/book/from_flat_php_to_symfony2.rst @@ -582,7 +582,7 @@ them for you. Here's the same sample application, now built in Symfony2:: } } -The two controllers are still lightweight. Each uses the :doc:`Doctrine ORM library` +The two controllers are still lightweight. Each uses the :doc:`Doctrine ORM library ` to retrieve objects from the database and the ``Templating`` component to render a template and return a ``Response`` object. The list template is now quite a bit simpler: @@ -667,7 +667,7 @@ controller method is responsible for returning the final ``Response`` object. There's really not much else to it. For a visual representation of how Symfony2 handles each request, see the -:ref:`request flow diagram`. +:ref:`request flow diagram `. Where Symfony2 Delivers ~~~~~~~~~~~~~~~~~~~~~~~ @@ -681,8 +681,8 @@ migrating the blog from flat PHP to Symfony2 has improved life: allows for new developers to be productive in your project more quickly; * 100% of the code you write is for *your* application. You **don't need - to develop or maintain low-level utilities** such as :ref:`autoloading`, - :doc:`routing`, or rendering :doc:`controllers`; + to develop or maintain low-level utilities** such as :ref:`autoloading `, + :doc:`routing `, or rendering :doc:`controllers `; * Symfony2 gives you **access to open source tools** such as Doctrine and the Templating, Security, Form, Validation and Translation components (to name @@ -694,7 +694,7 @@ migrating the blog from flat PHP to Symfony2 has improved life: * Symfony2's HTTP-centric architecture gives you access to powerful tools such as **HTTP caching** powered by **Symfony2's internal HTTP cache** or more powerful tools such as `Varnish`_. This is covered in a later chapter - all about :doc:`caching`. + all about :doc:`caching `. And perhaps best of all, by using Symfony2, you now have access to a whole set of **high-quality open source tools developed by the Symfony2 community**! @@ -745,7 +745,7 @@ The corresponding ``layout.html.twig`` template is also easier to write: Twig is well-supported in Symfony2. And while PHP templates will always be supported in Symfony2, the many advantages of Twig will continue to -be discussed. For more information, see the :doc:`templating chapter`. +be discussed. For more information, see the :doc:`templating chapter `. Learn more from the Cookbook ---------------------------- diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index 1654678bffc..c8a781a7e67 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -455,12 +455,12 @@ by adding an entry for ``/contact`` to your routing configuration file: .. note:: - This example uses :doc:`YAML` to define the routing + This example uses :doc:`YAML ` to define the routing configuration. Routing configuration can also be written in other formats such as XML or PHP. When someone visits the ``/contact`` page, this route is matched, and the -specified controller is executed. As you'll learn in the :doc:`routing chapter`, +specified controller is executed. As you'll learn in the :doc:`routing chapter `, the ``AcmeDemoBundle:Main:contact`` string is a short syntax that points to a specific PHP method ``contactAction`` inside a class called ``MainController``:: @@ -479,7 +479,7 @@ specific PHP method ``contactAction`` inside a class called ``MainController``:: In this very simple example, the controller simply creates a :class:`Symfony\\Component\\HttpFoundation\\Response` object with the HTML -"``

Contact us!

"``. In the :doc:`controller chapter`, +"``

Contact us!

"``. In the :doc:`controller chapter `, you'll learn how a controller can render templates, allowing your "presentation" code (i.e. anything that actually writes out HTML) to live in a separate template file. This frees up the controller to worry only about the hard @@ -512,11 +512,11 @@ libraries that can be used inside *any* PHP project. These libraries, called the *Symfony2 Components*, contain something useful for almost any situation, regardless of how your project is developed. To name a few: -* :doc:`HttpFoundation` - Contains +* :doc:`HttpFoundation ` - Contains the ``Request`` and ``Response`` classes, as well as other classes for handling sessions and file uploads; -* :doc:`Routing` - Powerful and fast routing system that +* :doc:`Routing ` - Powerful and fast routing system that allows you to map a specific URI (e.g. ``/contact``) to some information about how that request should be handled (e.g. execute the ``contactAction()`` method); @@ -527,11 +527,11 @@ regardless of how your project is developed. To name a few: * `Validator`_ A system for creating rules about data and then validating whether or not user-submitted data follows those rules; -* :doc:`ClassLoader` An autoloading library that allows +* :doc:`ClassLoader ` An autoloading library that allows PHP classes to be used without needing to manually ``require`` the files containing those classes; -* :doc:`Templating` A toolkit for rendering templates, +* :doc:`Templating ` A toolkit for rendering templates, handling template inheritance (i.e. a template is decorated with a layout) and performing other common template tasks; diff --git a/book/installation.rst b/book/installation.rst index 698177d1c0e..3c32a36804e 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -21,7 +21,7 @@ Installing a Symfony2 Distribution First, check that you have installed and configured a Web server (such as Apache) with PHP 5.3.8 or higher. For more information on Symfony2 - requirements, see the :doc:`requirements reference`. + requirements, see the :doc:`requirements reference `. Symfony2 packages "distributions", which are fully-functional applications that include the Symfony2 core libraries, a selection of useful bundles, a @@ -308,7 +308,7 @@ If you're new to Symfony, check out ":doc:`page_creation`", where you'll learn how to create pages, change configuration, and do everything else you'll need in your new application. -Be sure to also check out the :doc:`Cookbook`, which contains +Be sure to also check out the :doc:`Cookbook `, which contains a wide variety of articles about solving specific problems with Symfony. .. note:: diff --git a/book/internals.rst b/book/internals.rst index 10cd050e34f..399f0d87daf 100644 --- a/book/internals.rst +++ b/book/internals.rst @@ -236,7 +236,7 @@ add the following code at the beginning of your listener method:: .. tip:: If you are not yet familiar with the Symfony2 Event Dispatcher, read the - :doc:`Event Dispatcher Component Documentation` + :doc:`Event Dispatcher Component Documentation ` section first. .. index:: @@ -432,7 +432,7 @@ The Event Dispatcher The event dispatcher is a standalone component that is responsible for much of the underlying logic and flow behind a Symfony request. For more information, -see the :doc:`Event Dispatcher Component Documentation`. +see the :doc:`Event Dispatcher Component Documentation `. .. seealso:: diff --git a/book/page_creation.rst b/book/page_creation.rst index dc100a0c5e4..5b92fddada4 100644 --- a/book/page_creation.rst +++ b/book/page_creation.rst @@ -286,7 +286,7 @@ application should greet you: .. tip:: - You can also view your app in the "prod" :ref:`environment` + You can also view your app in the "prod" :ref:`environment ` by visiting: .. code-block:: text @@ -600,7 +600,7 @@ in your application and to optimize them the way you want. .. note:: While you'll learn the basics here, an entire cookbook entry is devoted - to the organization and best practices of :doc:`bundles`. + to the organization and best practices of :doc:`bundles `. A bundle is simply a structured set of files within a directory that implement a single feature. You might create a ``BlogBundle``, a ``ForumBundle`` or @@ -675,7 +675,7 @@ called ``AcmeTestBundle.php``:: .. tip:: - The name ``AcmeTestBundle`` follows the standard :ref:`Bundle naming conventions`. + The name ``AcmeTestBundle`` follows the standard :ref:`Bundle naming conventions `. You could also choose to shorten the name of the bundle to simply ``TestBundle`` by naming this class ``TestBundle`` (and naming the file ``TestBundle.php``). @@ -884,7 +884,7 @@ The extension alias (configuration key) can also be used: .. note:: See the cookbook article: :doc:`How to expose a Semantic Configuration for - a Bundle` for information on adding + a Bundle ` for information on adding configuration for your own bundle. .. index:: @@ -942,7 +942,7 @@ cached files and allow them to rebuild: .. note:: The ``test`` environment is used when running automated tests and cannot - be accessed directly through the browser. See the :doc:`testing chapter` + be accessed directly through the browser. See the :doc:`testing chapter ` for more details. .. index:: diff --git a/book/routing.rst b/book/routing.rst index 1274d4b9274..ca19b6f2520 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -79,7 +79,7 @@ for you to use in your controller (keep reading). The ``_controller`` parameter is a special key that tells Symfony which controller should be executed when a URL matches this route. The ``_controller`` string -is called the :ref:`logical name`. It follows a +is called the :ref:`logical name `. It follows a pattern that points to a specific PHP class and method:: // src/Acme/BlogBundle/Controller/BlogController.php @@ -818,9 +818,9 @@ that are special: each adds a unique piece of functionality inside your applicat * ``_controller``: As you've seen, this parameter is used to determine which controller is executed when the route is matched; -* ``_format``: Used to set the request format (:ref:`read more`); +* ``_format``: Used to set the request format (:ref:`read more `); -* ``_locale``: Used to set the locale on the request (:ref:`read more`); +* ``_locale``: Used to set the locale on the request (:ref:`read more `); .. tip:: @@ -1062,7 +1062,7 @@ from the new routing resource. .. tip:: You can also define routes using annotations. See the - :doc:`FrameworkExtraBundle documentation` + :doc:`FrameworkExtraBundle documentation ` to see how. Adding a Host regex to Imported Routes diff --git a/book/security.rst b/book/security.rst index fbe468213ef..63dbfc76126 100644 --- a/book/security.rst +++ b/book/security.rst @@ -226,7 +226,7 @@ sort of message indicating that access has been denied. When Symfony denies the user access, the user sees an error screen and receives a 403 HTTP status code (``Forbidden``). You can customize the access denied error screen by following the directions in the - :ref:`Error Pages` cookbook entry + :ref:`Error Pages ` cookbook entry to customize the 403 error page. Finally, if the ``admin`` user requests ``/admin/foo``, a similar process @@ -285,7 +285,7 @@ then protect access to certain areas with roles. By using HTTP Authentication, you can effortlessly tap into the native username/password box offered by all browsers. However, Symfony supports many authentication mechanisms out of the box. For details on all of them, see the -:doc:`Security Configuration Reference`. +:doc:`Security Configuration Reference `. In this section, you'll enhance this process by allowing the user to authenticate via a traditional HTML login form. @@ -530,7 +530,7 @@ The form has very few requirements. First, by submitting the form to ``/login_ch (via the ``login_check`` route), the security system will intercept the form submission and process the form for you automatically. Second, the security system expects the submitted fields to be called ``_username`` and ``_password`` -(these field names can be :ref:`configured`). +(these field names can be :ref:`configured `). And that's it! When you submit the form, the security system will automatically check the user's credentials and either authenticate the user or send the @@ -756,8 +756,8 @@ is used to enforce access. Each ``access_control`` has several options that configure two different things: -* (a) :ref:`should the incoming request match this access control entry` -* (b) :ref:`once it matches, should some sort of access restriction be enforced`: +* (a) :ref:`should the incoming request match this access control entry ` +* (b) :ref:`once it matches, should some sort of access restriction be enforced `: .. _security-book-access-control-matching-options: @@ -886,7 +886,7 @@ Securing by IP Certain situations may arise when you may need to restrict access to a given path based on IP. This is particularly relevant in the case of -:ref:`Edge Side Includes` (ESI), for example. When ESI is +:ref:`Edge Side Includes ` (ESI), for example. When ESI is enabled, it's recommended to secure access to ESI URLs. Indeed, some ESI may contain some private content like the current logged in user's information. To prevent any direct access to these resources from a web browser (by guessing the @@ -1392,8 +1392,8 @@ that the hashed password can't be decoded (i.e. you can't determine the password from the hashed password). .. versionadded:: 2.2 - As of Symfony 2.2 you can also use the :ref:`PBKDF2` - and :ref:`BCrypt` password encoders. + As of Symfony 2.2 you can also use the :ref:`PBKDF2 ` + and :ref:`BCrypt ` password encoders. Determining the Hashed Password ............................... @@ -1439,7 +1439,7 @@ In a controller this can be shortcut to: role. In a Twig Template this object can be accessed via the ``app.user`` key, -which calls the :method:`GlobalVariables::getUser()` +which calls the :method:`GlobalVariables::getUser() ` method: .. configuration-block:: @@ -1805,7 +1805,7 @@ a route so that you can use it to generate the URL: Once the user has been logged out, he will be redirected to whatever path is defined by the ``target`` parameter above (e.g. the ``homepage``). For more information on configuring the logout, see the -:doc:`Security Configuration Reference`. +:doc:`Security Configuration Reference `. .. _book-security-template: diff --git a/book/service_container.rst b/book/service_container.rst index 21a83d89379..24526c7319b 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -31,7 +31,7 @@ the service container makes writing good code so easy. .. tip:: If you want to know a lot more after reading this chapter, check out - the :doc:`Dependency Injection Component Documentation`. + the :doc:`Dependency Injection Component Documentation `. .. index:: single: Service Container; What is a service? @@ -183,7 +183,7 @@ later how you can configure a service that has multiple instances in the In this example, the controller extends Symfony's base Controller, which gives you access to the service container itself. You can then use the ``get`` method to locate and retrieve the ``my_mailer`` service from - the service container. You can also define your :doc:`controllers as services`. + the service container. You can also define your :doc:`controllers as services `. This is a bit more advanced and not necessary, but it allows you to inject only the services you need into your controller. @@ -537,7 +537,7 @@ notifying you of options that are missing or the wrong data type. When installing or configuring a bundle, see the bundle's documentation for how the services for the bundle should be installed and configured. The options -available for the core bundles can be found inside the :doc:`Reference Guide`. +available for the core bundles can be found inside the :doc:`Reference Guide `. .. note:: diff --git a/book/templating.rst b/book/templating.rst index 0b62b8c152b..fc16b8c1c39 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -103,7 +103,7 @@ by default. You can even `add your own extensions`_ to Twig as needed. .. tip:: Registering a Twig extension is as easy as creating a new service and tagging - it with ``twig.extension`` :ref:`tag`. + it with ``twig.extension`` :ref:`tag `. As you'll see throughout the documentation, Twig also supports functions and new functions can be easily added. For example, the following uses a @@ -458,7 +458,7 @@ section. .. note:: The available "engines" can be configured and even new engines added. - See :ref:`Templating Configuration` for more details. + See :ref:`Templating Configuration ` for more details. .. index:: single: Templating; Tags and helpers @@ -671,7 +671,7 @@ Whenever you find that you need a variable or a piece of information that you don't have access to in a template, consider rendering a controller. Controllers are fast to execute and promote good code organization and reuse. Of course, like all controllers, they should ideally be "skinny", meaning -that as much code as possible lives in reusable :doc:`services`. +that as much code as possible lives in reusable :doc:`services `. Asynchronous Content with hinclude.js ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1124,7 +1124,7 @@ automatically: .. tip:: You can add your own global template variables. See the cookbook example - on :doc:`Global Variables`. + on :doc:`Global Variables `. .. index:: single: Templating; The templating service @@ -1192,7 +1192,7 @@ configuration file: )); Several configuration options are available and are covered in the -:doc:`Configuration Appendix`. +:doc:`Configuration Appendix `. .. note:: diff --git a/book/testing.rst b/book/testing.rst index db5fb373933..1f035eb73ac 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -175,7 +175,7 @@ you'll use to crawl your site:: $crawler = $client->request('GET', '/demo/hello/Fabien'); -The ``request()`` method (see :ref:`more about the request method`) +The ``request()`` method (see :ref:`more about the request method `) returns a :class:`Symfony\\Component\\DomCrawler\\Crawler` object which can be used to select elements in the Response, click on links, and submit forms. @@ -337,7 +337,7 @@ giving you a nice API for uploading files. .. tip:: You will learn more about the ``Link`` and ``Form`` objects in the - :ref:`Crawler` section below. + :ref:`Crawler ` section below. The ``request`` method can also be used to simulate form submissions directly or perform more complex requests:: @@ -741,7 +741,7 @@ You can also override HTTP headers on a per request basis:: .. tip:: The test client is available as a service in the container in the ``test`` - environment (or wherever the :ref:`framework.test` + environment (or wherever the :ref:`framework.test ` option is enabled). This means you can override the service entirely if you need to. @@ -776,7 +776,7 @@ the installed third-party bundles: -To include other directories in the code coverage, also edit the ```` +To include other directories in the code coverage, also edit the `` `` section: .. code-block:: xml diff --git a/book/validation.rst b/book/validation.rst index 1f922f833e0..158e7cc3c6e 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -33,7 +33,7 @@ your application:: So far, this is just an ordinary class that serves some purpose inside your application. The goal of validation is to tell you whether or not the data of an object is valid. For this to work, you'll configure a list of rules -(called :ref:`constraints`) that the object must +(called :ref:`constraints `) that the object must follow in order to be valid. These rules can be specified via a number of different formats (YAML, XML, annotations, or PHP). @@ -237,7 +237,7 @@ workflow looks like the following from inside a controller:: This example uses an ``AuthorType`` form class, which is not shown here. -For more information, see the :doc:`Forms` chapter. +For more information, see the :doc:`Forms ` chapter. .. index:: pair: Validation; Configuration @@ -318,8 +318,8 @@ the ":doc:`/cookbook/validation/custom_constraint`" article of the cookbook. Constraint Configuration ~~~~~~~~~~~~~~~~~~~~~~~~ -Some constraints, like :doc:`NotBlank`, -are simple whereas others, like the :doc:`Choice` +Some constraints, like :doc:`NotBlank `, +are simple whereas others, like the :doc:`Choice ` constraint, have several configuration options available. Suppose that the ``Author`` class has another property, ``gender`` that can be set to either "male" or "female": @@ -669,7 +669,7 @@ Classes ~~~~~~~ Some constraints apply to the entire class being validated. For example, -the :doc:`Callback` constraint is a generic +the :doc:`Callback ` constraint is a generic constraint that's applied to the class itself. When that class is validated, methods specified by that constraint are simply executed so that each can provide more custom validation. @@ -1136,7 +1136,7 @@ it looks like this:: By calling ``validateValue`` on the validator, you can pass in a raw value and the constraint object that you want to validate that value against. A full list of the available constraints - as well as the full class name for each -constraint - is available in the :doc:`constraints reference` +constraint - is available in the :doc:`constraints reference ` section . The ``validateValue`` method returns a :class:`Symfony\\Component\\Validator\\ConstraintViolationList` diff --git a/components/console/helpers/formatterhelper.rst b/components/console/helpers/formatterhelper.rst index cad14a16619..565be6e6bab 100644 --- a/components/console/helpers/formatterhelper.rst +++ b/components/console/helpers/formatterhelper.rst @@ -16,7 +16,7 @@ in the default helper set, which you can get by calling The methods return a string, which you'll usually render to the console by passing it to the -:method:`OutputInterface::writeln` method. +:method:`OutputInterface::writeln ` method. Print Messages in a Section --------------------------- diff --git a/components/console/introduction.rst b/components/console/introduction.rst index fa7344c7826..8133d071fef 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -191,7 +191,7 @@ level. For example:: } When the quiet level is used, all output is suppressed as the default -:method:`Symfony\Component\Console\Output::write` +:method:`Symfony\Component\Console\Output::write ` method returns without actually printing. Using Command Arguments diff --git a/components/css_selector.rst b/components/css_selector.rst index c5f5c0aabf7..2367b0fde7c 100644 --- a/components/css_selector.rst +++ b/components/css_selector.rst @@ -62,7 +62,7 @@ You can use this expression with, for instance, :phpclass:`DOMXPath` or .. tip:: - The :method:`Crawler::filter()` method + The :method:`Crawler::filter() ` method uses the ``CssSelector`` component to find elements based on a CSS selector string. See the :doc:`/components/dom_crawler` for more details. diff --git a/components/dependency_injection/advanced.rst b/components/dependency_injection/advanced.rst index 7bed45e2021..35d99771ca6 100644 --- a/components/dependency_injection/advanced.rst +++ b/components/dependency_injection/advanced.rst @@ -65,7 +65,7 @@ Synthetic Services Synthetic services are services that are injected into the container instead of being created by the container. -For example, if you're using the :doc:`HttpKernel` +For example, if you're using the :doc:`HttpKernel ` component with the DependencyInjection component, then the ``request`` service is injected in the :method:`ContainerAwareHttpKernel::handle() ` @@ -102,7 +102,7 @@ to configure how a service is created by the container. As the service isn't created by the container, these options are omitted. Now, you can inject the class by using -:method:`Container::set`:: +:method:`Container::set `:: // ... $container->set('request', new MyRequest(...)); diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index be24ed45de7..af1fd1444f5 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -148,7 +148,7 @@ like this:: ) Whilst you can manually manage merging the different files, it is much better -to use :doc:`the Config Component` to merge +to use :doc:`the Config Component ` to merge and validate the config values. Using the configuration processing you could access the config value this way:: diff --git a/components/dependency_injection/introduction.rst b/components/dependency_injection/introduction.rst index 88bc49e4e8f..c52fe256310 100644 --- a/components/dependency_injection/introduction.rst +++ b/components/dependency_injection/introduction.rst @@ -184,7 +184,7 @@ for the services rather than using PHP to define the services as in the above examples. In anything but the smallest applications it make sense to organize the service definitions by moving them into one or more configuration files. To do this you also need to install -:doc:`the Config Component`. +:doc:`the Config Component `. Loading an XML config file:: @@ -209,7 +209,7 @@ Loading a YAML config file:: .. note:: If you want to load YAML config files then you will also need to install - :doc:`The YAML component`. + :doc:`The YAML component `. If you *do* want to use PHP to create the services then you can move this into a separate config file and load it in a similar way:: diff --git a/components/dependency_injection/workflow.rst b/components/dependency_injection/workflow.rst index 98b411af398..a9b2222be2b 100644 --- a/components/dependency_injection/workflow.rst +++ b/components/dependency_injection/workflow.rst @@ -24,12 +24,12 @@ Working with cached Container Before building it, the kernel checks to see if a cached version of the container exists. The ``HttpKernel`` has a debug setting and if this is false, the cached version is used if it exists. If debug is true then the kernel -:doc:`checks to see if configuration is fresh` +:doc:`checks to see if configuration is fresh ` and if it is, the cached version of the container is used. If not then the container is built from the application-level configuration and the bundles's extension configuration. -Read :ref:`Dumping the Configuration for Performance` +Read :ref:`Dumping the Configuration for Performance ` for more details. Application-level Configuration @@ -40,9 +40,9 @@ files are loaded which are then merged when the extensions are processed. This allows for different configuration for different environments e.g. dev, prod. These files contain parameters and services that are loaded directly into -the container as per :ref:`Setting Up the Container with Configuration Files`. +the container as per :ref:`Setting Up the Container with Configuration Files `. They also contain configuration that is processed by extensions as per -:ref:`Managing Configuration with Extensions`. +:ref:`Managing Configuration with Extensions `. These are considered to be bundle configuration since each bundle contains an Extension class. @@ -51,17 +51,17 @@ Bundle-level Configuration with Extensions By convention, each bundle contains an Extension class which is in the bundle's ``DependencyInjection`` directory. These are registered with the ``ContainerBuilder`` -when the kernel is booted. When the ``ContainerBuilder`` is :doc:`compiled`, +when the kernel is booted. When the ``ContainerBuilder`` is :doc:`compiled `, the application-level configuration relevant to the bundle's extension is passed to the Extension which also usually loads its own config file(s), typically from the bundle's ``Resources/config`` directory. The application-level config is usually processed -with a :doc:`Configuration object` also stored +with a :doc:`Configuration object ` also stored in the bundle's ``DependencyInjection`` directory. Compiler passes to allow Interaction between Bundles ---------------------------------------------------- -:ref:`Compiler passes` are +:ref:`Compiler passes ` are used to allow interaction between different bundles as they cannot affect each other's configuration in the extension classes. One of the main uses is to process tagged services, allowing bundles to register services to picked diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index d0df2ee208c..bb45d6c2beb 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -55,12 +55,12 @@ interacting with html links and forms as you traverse through the HTML tree. .. note:: The DomCrawler will attempt to automatically fix your HTML to match the - official specification. For example, if you nest a ``

`` tag inside - another ``

`` tag, it will be moved to be a sibling of the parent tag. + official specification. For example, if you nest a ``

`` tag inside + another ``

`` tag, it will be moved to be a sibling of the parent tag. This is expected and is part of the HTML5 spec. But if you're getting unexpected behavior, this could be a cause. And while the ``DomCrawler`` isn't meant to dump content, you can see the "fixed" version if your HTML - by :ref:`dumping it`. + by :ref:`dumping it `. Node Filtering ~~~~~~~~~~~~~~ diff --git a/components/event_dispatcher/container_aware_dispatcher.rst b/components/event_dispatcher/container_aware_dispatcher.rst index 0e2551da0d5..eca7d823870 100644 --- a/components/event_dispatcher/container_aware_dispatcher.rst +++ b/components/event_dispatcher/container_aware_dispatcher.rst @@ -12,7 +12,7 @@ Introduction The :class:`Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher` is a special event dispatcher implementation which is coupled to the service container -that is part of :doc:`the Dependency Injection component`. +that is part of :doc:`the Dependency Injection component `. It allows services to be specified as event listeners making the event dispatcher extremely powerful. diff --git a/components/event_dispatcher/introduction.rst b/components/event_dispatcher/introduction.rst index 06804bb16fb..d03ee05364e 100644 --- a/components/event_dispatcher/introduction.rst +++ b/components/event_dispatcher/introduction.rst @@ -94,7 +94,7 @@ Event Names and Event Objects When the dispatcher notifies listeners, it passes an actual ``Event`` object to those listeners. The base ``Event`` class is very simple: it contains a method for stopping :ref:`event -propagation`, but not much else. +propagation `, but not much else. Often times, data about a specific event needs to be passed along with the ``Event`` object so that the listeners have needed information. In the case of @@ -538,7 +538,7 @@ Dispatcher Shortcuts .. versionadded:: 2.1 ``EventDispatcher::dispatch()`` method returns the event since Symfony 2.1. -The :method:`EventDispatcher::dispatch` +The :method:`EventDispatcher::dispatch ` method always returns an :class:`Symfony\\Component\\EventDispatcher\\Event` object. This allows for various shortcuts. For example if one does not need a custom event object, one can simply rely on a plain diff --git a/components/form/introduction.rst b/components/form/introduction.rst index d6af2ad8863..a66ac33d342 100644 --- a/components/form/introduction.rst +++ b/components/form/introduction.rst @@ -51,7 +51,7 @@ support for very important features: messages for submitted data. The Symfony2 Form component relies on other libraries to solve these problems. -Most of the time you will use Twig and the Symfony :doc:`HttpFoundation`, +Most of the time you will use Twig and the Symfony :doc:`HttpFoundation `, Translation and Validator components, but you can replace any of these with a different library of your choice. @@ -67,7 +67,7 @@ Request Handling To process form data, you'll need to grab information off of the request (typically ``$_POST`` data) and pass the array of submitted data to :method:`Symfony\\Component\\Form\\Form::bind`. -The Form component optionally integrates with Symfony's :doc:`HttpFoundation` +The Form component optionally integrates with Symfony's :doc:`HttpFoundation ` component to make this even easier. To integrate the HttpFoundation component, add the @@ -155,7 +155,7 @@ line to your ``composer.json`` file: } } -The TwigBridge integration provides you with several :doc:`Twig Functions` +The TwigBridge integration provides you with several :doc:`Twig Functions ` that help you render each the HTML widget, label and error for each field (as well as a few other things). To configure the integration, you'll need to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension\\FormExtension`:: @@ -193,7 +193,7 @@ The exact details of your `Twig Configuration`_ will vary, but the goal is always to add the :class:`Symfony\\Bridge\\Twig\\Extension\\FormExtension` to Twig, which gives you access to the Twig functions for rendering forms. To do this, you first need to create a :class:`Symfony\\Bridge\\Twig\\Form\\TwigRendererEngine`, -where you define your :ref:`form themes` +where you define your :ref:`form themes ` (i.e. resources/files that define form HTML markup). For general details on rendering forms, see :doc:`/cookbook/form/form_customization`. @@ -219,7 +219,7 @@ with Symfony's ``Translation`` component, or add the 2 Twig filters yourself, via your own Twig extension. To use the built-in integration, be sure that your project has Symfony's -``Translation`` and :doc:`Config` components +``Translation`` and :doc:`Config ` components installed. If you're using Composer, you could get the latest 2.1 version of each of these by adding the following to your ``composer.json`` file: @@ -404,10 +404,10 @@ is created from the form factory. As you can see, creating a form is like writing a recipe: you call ``add`` for each new field you want to create. The first argument to ``add`` is the name of your field, and the second is the field "type". The Form component -comes with a lot of :doc:`built-in types`. +comes with a lot of :doc:`built-in types `. -Now that you've built your form, learn how to :ref:`render` -it and :ref:`process the form submission`. +Now that you've built your form, learn how to :ref:`render ` +it and :ref:`process the form submission `. Setting Default Values ~~~~~~~~~~~~~~~~~~~~~~ @@ -443,7 +443,7 @@ builder: .. tip:: In this example, the default data is an array. Later, when you use the - :ref:`data_class` option to bind data directly + :ref:`data_class ` option to bind data directly to objects, your default data will be an instance of that object. .. _component-form-intro-rendering-form: @@ -618,4 +618,4 @@ and the errors will display next to the fields on error. .. _Packagist: https://packagist.org/packages/symfony/form .. _Twig: http://twig.sensiolabs.org -.. _`Twig Configuration`: http://twig.sensiolabs.org/doc/intro.html \ No newline at end of file +.. _`Twig Configuration`: http://twig.sensiolabs.org/doc/intro.html diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index e29ac869d07..604e12972ea 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -61,7 +61,7 @@ can be accessed via several public properties: * ``cookies``: equivalent of ``$_COOKIE``; -* ``attributes``: no equivalent - used by your app to store other data (see :ref:`below`) +* ``attributes``: no equivalent - used by your app to store other data (see :ref:`below `) * ``files``: equivalent of ``$_FILES``; @@ -174,7 +174,7 @@ thanks to the public ``attributes`` property, which is also an instance of to attach information that belongs to the Request and that needs to be accessed from many different points in your application. For information on how this is used in the Symfony2 framework, see -:ref:`the Symfony2 book`. +:ref:`the Symfony2 book `. Identifying a Request ~~~~~~~~~~~~~~~~~~~~~ @@ -266,7 +266,7 @@ Accessing other Data The ``Request`` class has many other methods that you can use to access the request information. Have a look at -:class:`the Request API` +:class:`the Request API ` for more information about them. .. _component-http-foundation-response: diff --git a/components/http_kernel/introduction.rst b/components/http_kernel/introduction.rst index 07d43c286c5..4d705242d2e 100644 --- a/components/http_kernel/introduction.rst +++ b/components/http_kernel/introduction.rst @@ -55,8 +55,8 @@ matter how varied the architecture of that system:: ); } -Internally, :method:`HttpKernel::handle()` - -the concrete implementation of :method:`HttpKernelInterface::handle()` - +Internally, :method:`HttpKernel::handle() ` - +the concrete implementation of :method:`HttpKernelInterface::handle() ` - defines a workflow that starts with a :class:`Symfony\\Component\\HttpFoundation\\Request` and ends with a :class:`Symfony\\Component\\HttpFoundation\\Response`. @@ -79,8 +79,8 @@ and talks about how one specific implementation of the HttpKernel - the Symfony Framework - works. Initially, using the :class:`Symfony\\Component\\HttpKernel\\HttpKernel` -is really simple, and involves creating an :doc:`event dispatcher` -and a :ref:`controller resolver` +is really simple, and involves creating an :doc:`event dispatcher ` +and a :ref:`controller resolver ` (explained below). To complete your working kernel, you'll add more event listeners to the events discussed below:: @@ -130,9 +130,9 @@ For general information on adding listeners to the events below, see parts of the system, or return a ``Response`` if possible (e.g. a security layer that denies access). -:ref:`Kernel Events Information Table` +:ref:`Kernel Events Information Table ` -The first event that is dispatched inside :method:`HttpKernel::handle` +The first event that is dispatched inside :method:`HttpKernel::handle ` is ``kernel.request``, which may have a variety of different listeners. .. image:: /images/components/http_kernel/02-kernel-request.png @@ -145,7 +145,7 @@ that listener may return a :class:`Symfony\\Component\\HttpFoundation\\RedirectR to the login page or a 403 Access Denied response. If a ``Response`` is returned at this stage, the process skips directly to -the :ref:`kernel.response` event. +the :ref:`kernel.response ` event. .. image:: /images/components/http_kernel/03-kernel-request-response.png :align: center @@ -156,7 +156,7 @@ object. Another common listener is routing. A router listener may process the ``Request`` and determine the controller that should be rendered (see the next section). -In fact, the ``Request`` object has an ":ref:`attributes`" +In fact, the ``Request`` object has an ":ref:`attributes `" bag which is a perfect spot to store this extra, application-specific data about the request. This means that if your router listener somehow determines the controller, it can store it on the ``Request`` attributes (which can be used @@ -174,7 +174,7 @@ attributes). This class executes the routing layer, which returns an *array* of information about the matched request, including the ``_controller`` and any placeholders that are in the route's pattern (e.g. ``{slug}``). See - :doc:`Routing Component`. + :doc:`Routing Component `. This array of information is stored in the :class:`Symfony\\Component\\HttpFoundation\\Request` object's ``attributes`` array. Adding the routing information here doesn't @@ -267,7 +267,7 @@ will be called after another event - ``kernel.controller`` - is dispatched. **Typical Purposes**: Initialize things or change the controller just before the controller is executed. -:ref:`Kernel Events Information Table` +:ref:`Kernel Events Information Table ` After the controller callable has been determined, ``HttpKernel::handle`` dispatches the ``kernel.controller`` event. Listeners to this event might initialize @@ -279,7 +279,7 @@ the controller is executed. For some examples, see the Symfony2 section below. :align: center Listeners to this event can also change the controller callable completely -by calling :method:`FilterControllerEvent::setController` +by calling :method:`FilterControllerEvent::setController ` on the event object that's passed to listeners on this event. .. sidebar:: ``kernel.controller`` in the Symfony Framework @@ -290,7 +290,7 @@ on the event object that's passed to listeners on this event. One interesting listener comes from the :doc:`SensioFrameworkExtraBundle `, which is packaged with the Symfony Standard Edition. This listener's - :doc:`@ParamConverter` + :doc:`@ParamConverter ` functionality allows you to pass a full object (e.g. a ``Post`` object) to your controller instead of a scalar value (e.g. an ``id`` parameter that was on your route). The listener - ``ParamConverterListener`` - uses @@ -351,13 +351,13 @@ for each page that is built. Usually, the controller will return a ``Response`` object. If this is true, then the work of the kernel is just about done! In this case, the next step -is the :ref:`kernel.response` event. +is the :ref:`kernel.response ` event. .. image:: /images/components/http_kernel/09-controller-returns-response.png :align: center But if the controller returns anything besides a ``Response``, then the kernel -has a little bit more work to do - :ref:`kernel.view` +has a little bit more work to do - :ref:`kernel.view ` (since the end goal is *always* to generate a ``Response`` object). .. note:: @@ -373,7 +373,7 @@ has a little bit more work to do - :ref:`kernel.view` +:ref:`Kernel Events Information Table ` If the controller doesn't return a ``Response`` object, then the kernel dispatches another event - ``kernel.view``. The job of a listener to this event is to @@ -398,7 +398,7 @@ return a ``Response``. event. However, one core bundle - :doc:`SensioFrameworkExtraBundle ` - *does* add a listener to this event. If your controller returns an array, - and you place the :doc:`@Template` + and you place the :doc:`@Template ` annotation above the controller, then this listener renders a template, passes the array you returned from your controller to that template, and creates a ``Response`` containing the returned content from that @@ -416,19 +416,19 @@ return a ``Response``. **Typical Purposes**: Modify the ``Response`` object just before it is sent -:ref:`Kernel Events Information Table` +:ref:`Kernel Events Information Table ` The end goal of the kernel is to transform a ``Request`` into a ``Response``. The -``Response`` might be created during the :ref:`kernel.request` -event, returned from the :ref:`controller`, -or returned by one of the listeners to the :ref:`kernel.view` +``Response`` might be created during the :ref:`kernel.request ` +event, returned from the :ref:`controller `, +or returned by one of the listeners to the :ref:`kernel.view ` event. Regardless of who creates the ``Response``, another event - ``kernel.response`` is dispatched directly afterwards. A typical listener to this event will modify the ``Response`` object in some way, such as modifying headers, adding cookies, or even changing the content of the ``Response`` itself (e.g. injecting some -JavaScript before the end ```` tag of an HTML response). +JavaScript before the end `` `` tag of an HTML response). After this event is dispatched, the final ``Response`` object is returned from :method:`Symfony\\Component\\HttpKernel\\HttpKernel::handle`. In the @@ -457,7 +457,7 @@ method, which sends the headers and prints the ``Response`` content. **Typical Purposes**: To perform some "heavy" action after the response has been streamed to the user -:ref:`Kernel Events Information Table` +:ref:`Kernel Events Information Table ` The final event of the HttpKernel process is ``kernel.terminate`` and is unique because it occurs *after* the ``HttpKernel::handle`` method, and after the @@ -495,7 +495,7 @@ Handling Exceptions:: the ``kernel.exception`` event **Typical Purposes**: Handle some type of exception and create an appropriate ``Response`` to return for the exception -:ref:`Kernel Events Information Table` +:ref:`Kernel Events Information Table ` If an exception is thrown at any point inside ``HttpKernel::handle``, another event - ``kernel.exception`` is thrown. Internally, the body of the ``handle`` diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst index 38bc0f143eb..dfe5df8a445 100644 --- a/components/routing/hostname_pattern.rst +++ b/components/routing/hostname_pattern.rst @@ -63,9 +63,9 @@ only if the host is ``m.example.com``. Placeholders and Requirements in Hostname Patterns -------------------------------------------------- -If you're using the :doc:`DependencyInjection Component` +If you're using the :doc:`DependencyInjection Component ` (or the full Symfony2 Framework), then you can use -:ref:`service container parameters` as +:ref:`service container parameters ` as variables anywhere in your routes. You can avoid hardcoding the domain name by using a placeholder and a requirement. diff --git a/components/routing/introduction.rst b/components/routing/introduction.rst index e152ee742cd..12a032eb9d4 100644 --- a/components/routing/introduction.rst +++ b/components/routing/introduction.rst @@ -49,12 +49,12 @@ your autoloader to load the Routing component:: Be careful when using ``$_SERVER['REQUEST_URI']``, as it may include any query parameters on the URL, which will cause problems with route matching. An easy way to solve this is to use the HttpFoundation component - as explained :ref:`below`. + as explained :ref:`below `. You can add as many routes as you like to a :class:`Symfony\\Component\\Routing\\RouteCollection`. -The :method:`RouteCollection::add()` +The :method:`RouteCollection::add() ` method takes two arguments. The first is the name of the route. The second is a :class:`Symfony\\Component\\Routing\\Route` object, which expects a URL path and some array of custom variables in its constructor. This array @@ -184,7 +184,7 @@ with this class via its constructor:: Normally you can pass the values from the ``$_SERVER`` variable to populate the :class:`Symfony\\Component\\Routing\\RequestContext`. But If you use the -:doc:`HttpFoundation` component, you can use its +:doc:`HttpFoundation ` component, you can use its :class:`Symfony\\Component\\HttpFoundation\\Request` class to feed the :class:`Symfony\\Component\\Routing\\RequestContext` in a shortcut:: diff --git a/components/templating/helpers/slotshelper.rst b/components/templating/helpers/slotshelper.rst index 01d1dff84d8..82be58a5db4 100644 --- a/components/templating/helpers/slotshelper.rst +++ b/components/templating/helpers/slotshelper.rst @@ -54,7 +54,7 @@ Extending Templates The :method:`Symfony\\Component\\Templating\\PhpEngine::extend` method is called in the sub-template to set its parent template. Then :method:`$view['slots']->set() -` can be used to + ` can be used to set the content of a slot. All content which is not explicitly set in a slot is in the ``_content`` slot. diff --git a/contributing/community/releases.rst b/contributing/community/releases.rst index 46862b05ab3..c849a38408a 100644 --- a/contributing/community/releases.rst +++ b/contributing/community/releases.rst @@ -127,7 +127,7 @@ Deprecations When a feature implementation cannot be replaced with a better one without breaking backward compatibility, there is still the possibility to deprecate the old implementation and add a new preferred one along side. Read the -:ref:`conventions` document to +:ref:`conventions ` document to learn more about how deprecations are handled in Symfony. Rationale diff --git a/contributing/documentation/format.rst b/contributing/documentation/format.rst index c3677aaa471..665111a5399 100644 --- a/contributing/documentation/format.rst +++ b/contributing/documentation/format.rst @@ -199,7 +199,7 @@ Installing the Sphinx extensions # add the extensions to the list of extensions extensions = [..., 'sensio.sphinx.refinclude', 'sensio.sphinx.configurationblock', 'sensio.sphinx.phpcode'] - # enable highlighting for PHP code not between ```` by default + # enable highlighting for PHP code not between `` `` by default lexers['php'] = PhpLexer(startinline=True) lexers['php-annotations'] = PhpLexer(startinline=True) diff --git a/contributing/documentation/overview.rst b/contributing/documentation/overview.rst index 8e1e0a81b20..3c538295a93 100644 --- a/contributing/documentation/overview.rst +++ b/contributing/documentation/overview.rst @@ -218,7 +218,7 @@ For this example, suppose version 2.1 has just reached its end of maintenance: When a new Branch is created for a Release ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -During the :ref:`stabilization phase`, a +During the :ref:`stabilization phase `, a new branch on the documentation is created. For example, if version 2.3 were being stabilized, then a new 2.3 branch would be created for it. When this happens, the following items are done: diff --git a/contributing/documentation/standards.rst b/contributing/documentation/standards.rst index 3c7f301ef8f..f7ca59167aa 100644 --- a/contributing/documentation/standards.rst +++ b/contributing/documentation/standards.rst @@ -48,13 +48,13 @@ Example Code Examples ------------- -* The code follows the :doc:`Symfony Coding Standards` +* The code follows the :doc:`Symfony Coding Standards ` as well as the `Twig Coding Standards`_; * To avoid horizontal scrolling on code blocks, we prefer to break a line correctly if it crosses the 85th character; * When you fold one or more lines of code, place ``...`` in a comment at the point of the fold. These comments are: ``// ...`` (php), ``# ...`` (yaml/bash), ``{# ... #}`` - (twig), ```` (xml/html), ``; ...`` (ini), ``...`` (text); + (twig), `` `` (xml/html), ``; ...`` (ini), ``...`` (text); * When you fold a part of a line, e.g. a variable value, put ``...`` (without comment) at the place of the fold; * Description of the folded code: (optional) diff --git a/contributing/map.rst.inc b/contributing/map.rst.inc index 4e42fb384b2..d8d8cd578c2 100644 --- a/contributing/map.rst.inc +++ b/contributing/map.rst.inc @@ -4,9 +4,9 @@ * :doc:`Patches ` * :doc:`Security ` * :doc:`Tests ` - * :doc:`Coding Standards` - * :doc:`Code Conventions` - * :doc:`Git` + * :doc:`Coding Standards ` + * :doc:`Code Conventions ` + * :doc:`Git ` * :doc:`License ` * **Documentation** diff --git a/cookbook/assetic/asset_management.rst b/cookbook/assetic/asset_management.rst index 8580c15cf67..c4a63112278 100644 --- a/cookbook/assetic/asset_management.rst +++ b/cookbook/assetic/asset_management.rst @@ -4,8 +4,8 @@ How to Use Assetic for Asset Management ======================================= -Assetic combines two major ideas: :ref:`assets` and -:ref:`filters`. The assets are files such as CSS, +Assetic combines two major ideas: :ref:`assets ` and +:ref:`filters `. The assets are files such as CSS, JavaScript and image files. The filters are things that can be applied to these files before they are served to the browser. This allows a separation between the asset files stored in the application and the files actually presented @@ -43,8 +43,8 @@ Using Assetic provides many advantages over directly serving the files. The files do not need to be stored where they are served from and can be drawn from various sources such as from within a bundle. -You can use Assetic to process both :ref:`CSS stylesheets` -and :ref:`JavaScript files`. The philosophy +You can use Assetic to process both :ref:`CSS stylesheets ` +and :ref:`JavaScript files `. The philosophy behind adding either is basically the same, but with a slightly different syntax. .. _cookbook-assetic-including-javascript: @@ -117,7 +117,7 @@ inside a ``stylesheets`` block: But because Assetic changes the paths to your assets, this *will* break any background images (or other paths) that uses relative paths, unless you use -the :ref:`cssrewrite` filter. +the :ref:`cssrewrite ` filter. .. note:: diff --git a/cookbook/assetic/uglifyjs.rst b/cookbook/assetic/uglifyjs.rst index 0fa70ba3306..3dfa3a05a3b 100644 --- a/cookbook/assetic/uglifyjs.rst +++ b/cookbook/assetic/uglifyjs.rst @@ -169,8 +169,8 @@ apply this filter when debug mode is off (e.g. ``app.php``): To try this out, switch to your ``prod`` environment (``app.php``). But before -you do, don't forget to :ref:`clear your cache` -and :ref:`dump your assetic assets`. +you do, don't forget to :ref:`clear your cache ` +and :ref:`dump your assetic assets `. .. tip:: diff --git a/cookbook/bundles/best_practices.rst b/cookbook/bundles/best_practices.rst index 337e802b475..d0c029f50a2 100644 --- a/cookbook/bundles/best_practices.rst +++ b/cookbook/bundles/best_practices.rst @@ -143,7 +143,7 @@ instance, a ``HelloController`` controller is stored in class name is ``Bundle\HelloBundle\Controller\HelloController``. All classes and files must follow the Symfony2 coding :doc:`standards -`. + `. Some classes should be seen as facades and should be as short as possible, like Commands, Helpers, Listeners, and Controllers. @@ -184,7 +184,7 @@ Documentation All classes and functions must come with full PHPDoc. Extensive documentation should also be provided in the :doc:`reStructuredText -` format, under the ``Resources/doc/`` + ` format, under the ``Resources/doc/`` directory; the ``Resources/doc/index.rst`` file is the only mandatory file and must be the entry point for the documentation. diff --git a/cookbook/bundles/extension.rst b/cookbook/bundles/extension.rst index e7f7bb1bf59..164d35e575c 100644 --- a/cookbook/bundles/extension.rst +++ b/cookbook/bundles/extension.rst @@ -44,7 +44,7 @@ When you create a bundle, you have two choices on how to handle configuration: You can specify your services in a configuration file (e.g. ``services.yml``) that lives in your bundle and then import it from your main application configuration. This is really easy, quick and totally effective. If you - make use of :ref:`parameters`, then + make use of :ref:`parameters `, then you still have the flexibility to customize your bundle from your application configuration. See ":ref:`service-container-imports-directive`" for more details. @@ -75,7 +75,7 @@ The second method has several specific advantages: * Smart merging when several configuration files (e.g. ``config_dev.yml`` and ``config.yml``) override each other's configuration; -* Configuration validation (if you use a :ref:`Configuration Class`); +* Configuration validation (if you use a :ref:`Configuration Class `); * IDE auto-completion when you create an XSD and developers use XML. @@ -251,7 +251,7 @@ It's your job, then, to decide how these configurations should be merged together. You might, for example, have later values override previous values or somehow merge them together. -Later, in the :ref:`Configuration Class` +Later, in the :ref:`Configuration Class ` section, you'll learn of a truly robust way to handle this. But for now, you might just merge them manually:: @@ -493,7 +493,7 @@ configuration arrays together. The ``Configuration`` class can be much more complicated than shown here, supporting array nodes, "prototype" nodes, advanced validation, XML-specific -normalization and advanced merging. You can read more about this in :doc:`the Config Component documentation`. +normalization and advanced merging. You can read more about this in :doc:`the Config Component documentation `. You can also see it action by checking out some of the core Configuration classes, such as the one from the `FrameworkBundle Configuration`_ or the `TwigBundle Configuration`_. diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index fa2170304f9..64d8ab616c9 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -8,7 +8,7 @@ Because Symfony2's cache uses the standard HTTP cache headers, the :ref:`symfony-gateway-cache` can easily be replaced with any other reverse proxy. Varnish is a powerful, open-source, HTTP accelerator capable of serving cached content quickly and including support for :ref:`Edge Side -Includes`. +Includes `. .. index:: single: Varnish; configuration @@ -203,7 +203,7 @@ absolute URLs: .. note:: - Remember to configure :ref:`framework.trusted_proxies` + Remember to configure :ref:`framework.trusted_proxies ` in the Symfony configuration so that Varnish is seen as a trusted proxy and the ``X-Forwarded-`` headers are used. diff --git a/cookbook/configuration/environments.rst b/cookbook/configuration/environments.rst index b1dea887b47..c75638c74ba 100644 --- a/cookbook/configuration/environments.rst +++ b/cookbook/configuration/environments.rst @@ -138,7 +138,7 @@ either the ``app.php`` (for the ``prod`` environment) or the ``app_dev.php`` The given URLs assume that your web server is configured to use the ``web/`` directory of the application as its root. Read more in - :doc:`Installing Symfony2`. + :doc:`Installing Symfony2 `. If you open up one of these files, you'll quickly see that the environment used by each is explicitly set: diff --git a/cookbook/configuration/front_controllers_and_kernel.rst b/cookbook/configuration/front_controllers_and_kernel.rst index 2066898592f..5cd3d647938 100644 --- a/cookbook/configuration/front_controllers_and_kernel.rst +++ b/cookbook/configuration/front_controllers_and_kernel.rst @@ -44,7 +44,7 @@ to `decorate`_ the kernel with additional features. Examples include: * Configuring the autoloader or adding additional autoloading mechanisms; * Adding HTTP level caching by wrapping the kernel with an instance of - :ref:`AppCache`. + :ref:`AppCache `. The front controller can be chosen by requesting URLs like: @@ -105,7 +105,7 @@ called the ``AppKernel``. Again, the Symfony2 Standard Edition provides an `AppKernel`_ in the ``app/`` directory. This class uses the name of the environment - which is passed to -the Kernel's :method:`constructor` +the Kernel's :method:`constructor ` method and is available via :method:`Symfony\\Component\\HttpKernel\\Kernel::getEnvironment` - to decide which bundles to create. The logic for that is in ``registerBundles()``, a method meant to be extended by you when you start adding bundles to your @@ -145,7 +145,7 @@ This method is responsible for loading the application's configuration from the right *environment*. Environments have been covered extensively -:doc:`in the previous chapter`, +:doc:`in the previous chapter `, and you probably remember that the Standard Edition comes with three of them - ``dev``, ``prod`` and ``test``. diff --git a/cookbook/console/logging.rst b/cookbook/console/logging.rst index bbddf0c7646..50c21d5ebce 100644 --- a/cookbook/console/logging.rst +++ b/cookbook/console/logging.rst @@ -80,7 +80,7 @@ method, where exception handling should happen: .. caution:: Due to the nature of the core :class:`Symfony\\Component\\Console\\Application` - class, much of the :method:`run` + class, much of the :method:`run ` method has to be duplicated and even a private property ``originalAutoExit`` re-implemented. This serves as an example of what you *could* do in your code, though there is a high risk that something may break when upgrading @@ -187,7 +187,7 @@ In the code above, you disable exception catching so the parent ``run`` method will throw all exceptions. When an exception is caught, you simple log it by accessing the ``logger`` service from the service container and then handle the rest of the logic in the same way that the parent ``run`` method does -(specifically, since the parent :method:`run` +(specifically, since the parent :method:`run ` method will not handle exceptions rendering and status code handling when ``catchExceptions`` is set to false, it has to be done in the overridden method). diff --git a/cookbook/controller/error_pages.rst b/cookbook/controller/error_pages.rst index e6b4b371952..a61292f8434 100644 --- a/cookbook/controller/error_pages.rst +++ b/cookbook/controller/error_pages.rst @@ -18,7 +18,7 @@ control you need: 2. Replace the default exception controller ``twig.controller.exception:showAction`` with your own controller and handle it however you want (see - :ref:`exception_controller in the Twig reference`). + :ref:`exception_controller in the Twig reference `). The default exception controller is registered as a service - the actual class is ``Symfony\Bundle\TwigBundle\Controller\ExceptionController``. diff --git a/cookbook/controller/service.rst b/cookbook/controller/service.rst index d22042f726a..cb88f742c6b 100644 --- a/cookbook/controller/service.rst +++ b/cookbook/controller/service.rst @@ -133,7 +133,7 @@ the route ``_controller`` value: You can also use annotations to configure routing using a controller defined as a service. See the - :doc:`FrameworkExtraBundle documentation` + :doc:`FrameworkExtraBundle documentation ` for details. Alternatives to Base Controller Methods diff --git a/cookbook/doctrine/common_extensions.rst b/cookbook/doctrine/common_extensions.rst index 89954c4ce92..32ede55465a 100644 --- a/cookbook/doctrine/common_extensions.rst +++ b/cookbook/doctrine/common_extensions.rst @@ -14,7 +14,7 @@ functionality for `Sluggable`_, `Translatable`_, `Timestampable`_, `Loggable`_, The usage for each of these extensions is explained in that repository. However, to install/activate each extension you must register and activate an -:doc:`Event Listener`. +:doc:`Event Listener `. To do this, you have two options: #. Use the `StofDoctrineExtensionsBundle`_, which integrates the above library. @@ -30,4 +30,4 @@ To do this, you have two options: .. _`Loggable`: https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/loggable.md .. _`Tree`: https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/tree.md .. _`Sortable`: https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/sortable.md -.. _`Install Gedmo Doctrine2 extensions in Symfony2`: https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/symfony2.md \ No newline at end of file +.. _`Install Gedmo Doctrine2 extensions in Symfony2`: https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/symfony2.md diff --git a/cookbook/doctrine/event_listeners_subscribers.rst b/cookbook/doctrine/event_listeners_subscribers.rst index 99b6a947571..50cfb09ab90 100644 --- a/cookbook/doctrine/event_listeners_subscribers.rst +++ b/cookbook/doctrine/event_listeners_subscribers.rst @@ -8,7 +8,7 @@ How to Register Event Listeners and Subscribers Doctrine packages a rich event system that fires events when almost anything happens inside the system. For you, this means that you can create arbitrary -:doc:`services` and tell Doctrine to notify those +:doc:`services ` and tell Doctrine to notify those objects whenever a certain action (e.g. ``prePersist``) happens within Doctrine. This could be useful, for example, to create an independent search index whenever an object in your database is saved. @@ -23,7 +23,7 @@ Configuring the Listener/Subscriber ----------------------------------- To register a service to act as an event listener or subscriber you just have -to :ref:`tag` it with the appropriate name. Depending +to :ref:`tag ` it with the appropriate name. Depending on your use-case, you can hook a listener into every DBAL connection and ORM entity manager or just into one specific DBAL connection and all the entity managers that use this connection. diff --git a/cookbook/doctrine/file_uploads.rst b/cookbook/doctrine/file_uploads.rst index 9e839905cb6..362d06cf8ec 100644 --- a/cookbook/doctrine/file_uploads.rst +++ b/cookbook/doctrine/file_uploads.rst @@ -7,7 +7,7 @@ How to handle File Uploads with Doctrine Handling file uploads with Doctrine entities is no different than handling any other file upload. In other words, you're free to move the file in your controller after handling a form submission. For examples of how to do this, -see the :doc:`file type reference` page. +see the :doc:`file type reference ` page. If you choose to, you can also integrate the file upload into your entity lifecycle (i.e. creation, update and removal). In this case, as your entity @@ -91,14 +91,14 @@ file. .. tip:: If you have not done so already, you should probably read the - :doc:`file` type documentation first to + :doc:`file ` type documentation first to understand how the basic upload process works. .. note:: If you're using annotations to specify your validation rules (as shown in this example), be sure that you've enabled validation by annotation - (see :ref:`validation configuration`). + (see :ref:`validation configuration `). To handle the actual file upload in the form, use a "virtual" ``file`` field. For example, if you're building your form directly in a controller, it might diff --git a/cookbook/doctrine/registration_form.rst b/cookbook/doctrine/registration_form.rst index e274cf1c639..0912d02d5c4 100644 --- a/cookbook/doctrine/registration_form.rst +++ b/cookbook/doctrine/registration_form.rst @@ -82,7 +82,7 @@ the class. .. note:: If you want to integrate this User within the security system, you need - to implement the :ref:`UserInterface` of the + to implement the :ref:`UserInterface ` of the security component. Create a Form for the Model @@ -286,7 +286,7 @@ Add New Routes Next, update your routes. If you're placing your routes inside your bundle (as shown here), don't forget to make sure that the routing file is being -:ref:`imported`. +:ref:`imported `. .. configuration-block:: diff --git a/cookbook/event_dispatcher/before_after_filters.rst b/cookbook/event_dispatcher/before_after_filters.rst index 3ea82f65a95..1a38dc39ee5 100755 --- a/cookbook/event_dispatcher/before_after_filters.rst +++ b/cookbook/event_dispatcher/before_after_filters.rst @@ -11,7 +11,7 @@ or hooks. In symfony1, this was achieved with the preExecute and postExecute methods. Most major frameworks have similar methods but there is no such thing in Symfony2. The good news is that there is a much better way to interfere with the -Request -> Response process using the :doc:`EventDispatcher component`. +Request -> Response process using the :doc:`EventDispatcher component `. Token validation Example ------------------------ diff --git a/cookbook/form/create_form_type_extension.rst b/cookbook/form/create_form_type_extension.rst index a75eaefc7ca..c9ab81a401a 100644 --- a/cookbook/form/create_form_type_extension.rst +++ b/cookbook/form/create_form_type_extension.rst @@ -4,7 +4,7 @@ How to Create a Form Type Extension =================================== -:doc:`Custom form field types` are great when +:doc:`Custom form field types ` are great when you need field types with a specific purpose, such as a gender selector, or a VAT number input. @@ -88,7 +88,7 @@ to override one of the following methods: * ``finishView()`` For more information on what those methods do, you can refer to the -:doc:`Creating Custom Field Types` +:doc:`Creating Custom Field Types ` cookbook article. Registering your Form Type Extension as a Service @@ -135,7 +135,7 @@ Adding the extension Business Logic The goal of your extension is to display nice images next to file inputs (when the underlying model contains images). For that purpose, let's assume that you use an approach similar to the one described in -:doc:`How to handle File Uploads with Doctrine`: +:doc:`How to handle File Uploads with Doctrine `: you have a Media model with a file property (corresponding to the file field in the form) and a path property (corresponding to the image path in the database):: diff --git a/cookbook/form/data_transformers.rst b/cookbook/form/data_transformers.rst index e0bd57113ae..802581c1ff8 100644 --- a/cookbook/form/data_transformers.rst +++ b/cookbook/form/data_transformers.rst @@ -244,7 +244,7 @@ a field for issue numbers 2) You need to worry about passing in the ``em`` option whenever you're creating a form that uses the transformer. -Because of these, you may choose to :doc:`create a custom field type`. +Because of these, you may choose to :doc:`create a custom field type `. First, create the custom field type class:: // src/Acme/TaskBundle/Form/Type/IssueSelectorType.php diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 8316335c3a8..1499657714d 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -115,7 +115,7 @@ is new (e.g. hasn't been persisted to the database). Based on that, the subscrib might look like the following: .. versionadded:: 2.2 - The ability to pass a string into :method:`FormInterface::add` + The ability to pass a string into :method:`FormInterface::add ` was added in Symfony 2.2. .. code-block:: php diff --git a/cookbook/form/form_collections.rst b/cookbook/form/form_collections.rst index a3be1c8172e..2210c9f5b16 100755 --- a/cookbook/form/form_collections.rst +++ b/cookbook/form/form_collections.rst @@ -112,7 +112,7 @@ goal is to allow the tags of a ``Task`` to be modified right inside the task form itself, create a form for the ``Task`` class. Notice that you embed a collection of ``TagType`` forms using the -:doc:`collection` field type:: +:doc:`collection ` field type:: // src/Acme/TaskBundle/Form/Type/TaskType.php namespace Acme\TaskBundle\Form\Type; diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index 5aa5bff48b5..20ac50db40e 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -668,7 +668,7 @@ Other Common Customizations So far, this recipe has shown you several different ways to customize a single piece of how a form is rendered. The key is to customize a specific fragment that corresponds to the portion of the form you want to control (see -:ref:`naming form blocks`). +:ref:`naming form blocks `). In the next sections, you'll see how you can make several common form customizations. To apply these customizations, use one of the methods described in the @@ -681,7 +681,7 @@ Customizing Error Output The form component only handles *how* the validation errors are rendered, and not the actual validation error messages. The error messages themselves are determined by the validation constraints you apply to your objects. - For more information, see the chapter on :doc:`validation`. + For more information, see the chapter on :doc:`validation `. There are many different ways to customize how errors are rendered when a form is submitted with errors. The error messages for a field are rendered diff --git a/cookbook/form/unit_testing.rst b/cookbook/form/unit_testing.rst index def51102f93..c7e4d8993ca 100644 --- a/cookbook/form/unit_testing.rst +++ b/cookbook/form/unit_testing.rst @@ -156,7 +156,7 @@ Adding custom Extensions ------------------------ It often happens that you use some options that are added by -:doc:`form extensions`. One of the +:doc:`form extensions `. One of the cases may be the ``ValidatorExtension`` with its ``invalid_message`` option. The ``TypeTestCase`` loads only the core form extension so an "Invalid option" exception will be raised if you try to use it for testing a class that depends diff --git a/cookbook/logging/monolog.rst b/cookbook/logging/monolog.rst index f31952a33e2..11cb46e41fd 100644 --- a/cookbook/logging/monolog.rst +++ b/cookbook/logging/monolog.rst @@ -36,7 +36,7 @@ to write the logs (the handlers can be shared). .. tip:: When injecting the logger in a service you can - :ref:`use a custom channel` control which "channel" + :ref:`use a custom channel ` control which "channel" the logger will log to. The basic handler is the ``StreamHandler`` which writes logs in a stream @@ -226,7 +226,7 @@ only for a specific handler. A processor is simply a callable receiving the record as its first argument. Processors are configured using the ``monolog.processor`` DIC tag. See the -:ref:`reference about it`. +:ref:`reference about it `. Adding a Session/Request Token ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index bd87aef3694..61b27ea4310 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -42,7 +42,7 @@ focus on the most important methods that come from the .. tip:: - You can :ref:`generate the missing getter and setters` + You can :ref:`generate the missing getter and setters ` by running: .. code-block:: bash @@ -165,7 +165,7 @@ focus on the most important methods that come from the .. tip:: - :ref:`Generate the database table` + :ref:`Generate the database table ` for your ``User`` entity by running: .. code-block:: bash @@ -237,7 +237,7 @@ Authenticating Someone against a Database Authenticating a Doctrine user against the database with the Symfony security layer is a piece of cake. Everything resides in the configuration of the -:doc:`SecurityBundle` stored in the +:doc:`SecurityBundle ` stored in the ``app/config/security.yml`` file. Below is an example of configuration where the user will enter his/her diff --git a/cookbook/security/form_login.rst b/cookbook/security/form_login.rst index c20a4cb6b74..6d6290e995c 100644 --- a/cookbook/security/form_login.rst +++ b/cookbook/security/form_login.rst @@ -4,7 +4,7 @@ How to customize your Form Login ================================ -Using a :ref:`form login` for authentication is +Using a :ref:`form login ` for authentication is a common, and flexible, method for handling authentication in Symfony2. Pretty much every aspect of the form login can be customized. The full, default configuration is shown in the next section. diff --git a/cookbook/security/securing_services.rst b/cookbook/security/securing_services.rst index 810b83fc9b6..d83b33b94cc 100644 --- a/cookbook/security/securing_services.rst +++ b/cookbook/security/securing_services.rst @@ -5,7 +5,7 @@ How to secure any Service or Method in your Application ======================================================= -In the security chapter, you can see how to :ref:`secure a controller` +In the security chapter, you can see how to :ref:`secure a controller ` by requesting the ``security.context`` service from the Service Container and checking the current user's role:: @@ -148,10 +148,10 @@ You can also secure method calls in any service with annotations by using the optional `JMSSecurityExtraBundle`_ bundle. This bundle is included in the Symfony2 Standard Distribution. -To enable the annotations functionality, :ref:`tag` +To enable the annotations functionality, :ref:`tag ` the service you want to secure with the ``security.secure_service`` tag (you can also automatically enable this functionality for all services, see -the :ref:`sidebar` below): +the :ref:`sidebar ` below): .. configuration-block:: diff --git a/cookbook/session/locale_sticky_session.rst b/cookbook/session/locale_sticky_session.rst index ddd130528ed..48f27c477b0 100644 --- a/cookbook/session/locale_sticky_session.rst +++ b/cookbook/session/locale_sticky_session.rst @@ -14,7 +14,7 @@ Creating LocaleListener ----------------------- To simulate that the locale is stored in a session, you need to create and -register a :doc:`new event listener`. +register a :doc:`new event listener `. The listener will look something like this. Typically, ``_locale`` is used as a routing parameter to signify the locale, though it doesn't really matter how you determine the desired locale from the request:: @@ -96,7 +96,7 @@ Then register the listener: That's it! Now celebrate by changing the user's locale and seeing that it's sticky throughout the request. Remember, to get the user's locale, always -use the :method:`Request::getLocale` +use the :method:`Request::getLocale ` method:: // from a controller... diff --git a/cookbook/session/sessions_directory.rst b/cookbook/session/sessions_directory.rst index c041c555ef7..98353e75066 100644 --- a/cookbook/session/sessions_directory.rst +++ b/cookbook/session/sessions_directory.rst @@ -17,7 +17,7 @@ that your current sessions aren't lost when you clear Symfony's cache. method of session management available within Symfony. See :doc:`/components/http_foundation/session_configuration` for a discussion of session save handlers. There is also an entry in the cookbook - about storing sessions in the :doc:`database`. + about storing sessions in the :doc:`database `. To change the directory in which Symfony saves session data, you only need change the framework configuration. In this example, you will change the diff --git a/cookbook/templating/global_variables.rst b/cookbook/templating/global_variables.rst index 536157ac092..78ed01009bc 100644 --- a/cookbook/templating/global_variables.rst +++ b/cookbook/templating/global_variables.rst @@ -131,5 +131,5 @@ Using a Twig Extension If the global variable you want to set is more complicated - say an object - then you won't be able to use the above method. Instead, you'll need to create -a :ref:`Twig Extension` and return the +a :ref:`Twig Extension ` and return the global variable as one of the entries in the ``getGlobals`` method. diff --git a/cookbook/testing/database.rst b/cookbook/testing/database.rst index 2abb0f294e8..13ba54d32d0 100644 --- a/cookbook/testing/database.rst +++ b/cookbook/testing/database.rst @@ -27,7 +27,7 @@ class. .. tip:: It is possible (and a good idea) to inject your repository directly by - registering your repository as a :doc:`factory service` + registering your repository as a :doc:`factory service ` This is a little bit more work to setup, but makes testing easier as you only need to mock the repository. diff --git a/cookbook/testing/profiling.rst b/cookbook/testing/profiling.rst index 49d31a4c89f..2ee70f00eae 100644 --- a/cookbook/testing/profiling.rst +++ b/cookbook/testing/profiling.rst @@ -71,5 +71,5 @@ finish. It's easy to achieve if you embed the token in the error message:: .. tip:: - Read the API for built-in :doc:`data collectors` + Read the API for built-in :doc:`data collectors ` to learn more about their interfaces. diff --git a/cookbook/workflow/_vendor_deps.rst.inc b/cookbook/workflow/_vendor_deps.rst.inc index 90b8dfa264a..5fc208ed177 100644 --- a/cookbook/workflow/_vendor_deps.rst.inc +++ b/cookbook/workflow/_vendor_deps.rst.inc @@ -11,7 +11,7 @@ you need for each. By default, these libraries are downloaded by running a ``php composer.phar install`` "downloader" binary. This ``composer.phar`` file is from a library called -`Composer`_ and you can read more about installing it in the :ref:`Installation` +`Composer`_ and you can read more about installing it in the :ref:`Installation ` chapter. The ``composer.phar`` file reads from the ``composer.json`` file at the root diff --git a/quick_tour/the_view.rst b/quick_tour/the_view.rst index 9d9413837ac..bf8e8d4210b 100644 --- a/quick_tour/the_view.rst +++ b/quick_tour/the_view.rst @@ -286,7 +286,7 @@ the basics is easy, and you will soon learn that this simplicity is hidden under a very flexible architecture. But I'm getting ahead of myself. First, you need to learn more about the controller -and that's exactly the topic of the :doc:`next part of this tutorial`. +and that's exactly the topic of the :doc:`next part of this tutorial `. Ready for another 10 minutes with Symfony2? .. _Twig: http://twig.sensiolabs.org/ diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index db6cb3f28e6..b9187691f2f 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -41,7 +41,7 @@ Configuration * `assets_version`_ * `assets_version_format`_ * `profiler`_ - * :ref:`enabled` + * :ref:`enabled ` secret ~~~~~~ diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index 7871cf21aa5..dc41ad19f6a 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -236,7 +236,7 @@ The Login Form and Process This path **must** be accessible by a normal, un-authenticated user, else you may create a redirect loop. For details, see - ":ref:`Avoid Common Pitfalls`". + ":ref:`Avoid Common Pitfalls `". * ``check_path`` (type: ``string``, default: ``/login_check``) This is the route or path that your login form must submit to. The @@ -366,7 +366,7 @@ persisting the encoded password alone is enough. Firewall Context ---------------- -Most applications will only need one :ref:`firewall`. +Most applications will only need one :ref:`firewall `. But if your application *does* use multiple firewalls, you'll notice that if you're authenticated in one firewall, you're not automatically authenticated in another. In other words, the systems don't share a common "context": each diff --git a/reference/constraints/All.rst b/reference/constraints/All.rst index 64af3c51c41..2e45602375d 100644 --- a/reference/constraints/All.rst +++ b/reference/constraints/All.rst @@ -5,7 +5,7 @@ When applied to an array (or Traversable object), this constraint allows you to apply a collection of constraints to each element of the array. +----------------+------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ | Options | - `constraints`_ | +----------------+------------------------------------------------------------------------+ @@ -103,7 +103,7 @@ Options constraints ~~~~~~~~~~~ -**type**: ``array`` [:ref:`default option`] +**type**: ``array`` [:ref:`default option `] This required option is the array of validation constraints that you want to apply to each element of the underlying array. diff --git a/reference/constraints/Blank.rst b/reference/constraints/Blank.rst index 1461ee6b180..029099e0c77 100644 --- a/reference/constraints/Blank.rst +++ b/reference/constraints/Blank.rst @@ -7,7 +7,7 @@ to ``null``. To force that a value strictly be equal to ``null``, see the blank, see :doc:`/reference/constraints/NotBlank`. +----------------+-----------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ | Options | - `message`_ | +----------------+-----------------------------------------------------------------------+ diff --git a/reference/constraints/Callback.rst b/reference/constraints/Callback.rst index a367ac9f5d5..59495889506 100644 --- a/reference/constraints/Callback.rst +++ b/reference/constraints/Callback.rst @@ -18,7 +18,7 @@ can do anything, including creating and assigning validation errors. add validator "violations". +----------------+------------------------------------------------------------------------+ -| Applies to | :ref:`class` | +| Applies to | :ref:`class ` | +----------------+------------------------------------------------------------------------+ | Options | - `methods`_ | +----------------+------------------------------------------------------------------------+ @@ -122,7 +122,7 @@ Options methods ~~~~~~~ -**type**: ``array`` **default**: ``array()`` [:ref:`default option`] +**type**: ``array`` **default**: ``array()`` [:ref:`default option `] This is an array of the methods that should be executed during the validation process. Each method can be one of the following formats: @@ -226,5 +226,5 @@ process. Each method can be one of the following formats: the option to make your callback either a PHP closure or a non-static callback. It is *not* currently possible, however, to specify a :term:`service` as a constraint. To validate using a service, you should - :doc:`create a custom validation constraint` + :doc:`create a custom validation constraint ` and add that new constraint to your class. diff --git a/reference/constraints/CardScheme.rst b/reference/constraints/CardScheme.rst index 77447ecedce..172ddbfdf70 100644 --- a/reference/constraints/CardScheme.rst +++ b/reference/constraints/CardScheme.rst @@ -9,7 +9,7 @@ company. It can be used to validate the number before trying to initiate a payme through a payment gateway. +----------------+--------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+--------------------------------------------------------------------------+ | Options | - `schemes`_ | | | - `message`_ | @@ -101,7 +101,7 @@ Available Options schemes ------- -**type**: ``mixed`` [:ref:`default option`] +**type**: ``mixed`` [:ref:`default option `] This option is required and represents the name of the number scheme used to validate the credit card number, it can either be a string or an array. Valid diff --git a/reference/constraints/Choice.rst b/reference/constraints/Choice.rst index ab4571b7b57..1dadf269eed 100644 --- a/reference/constraints/Choice.rst +++ b/reference/constraints/Choice.rst @@ -6,7 +6,7 @@ set of *valid* choices. It can also be used to validate that each item in an array of items is one of those valid choices. +----------------+-----------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ | Options | - `choices`_ | | | - `callback`_ | @@ -263,7 +263,7 @@ Available Options choices ~~~~~~~ -**type**: ``array`` [:ref:`default option`] +**type**: ``array`` [:ref:`default option `] A required option (unless `callback`_ is specified) - this is the array of options that should be considered in the valid set. The input value diff --git a/reference/constraints/Collection.rst b/reference/constraints/Collection.rst index 4a040117ad5..ae25d16bb87 100644 --- a/reference/constraints/Collection.rst +++ b/reference/constraints/Collection.rst @@ -11,7 +11,7 @@ This constraint can also make sure that certain collection keys are present and that extra keys are not present. +----------------+--------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+--------------------------------------------------------------------------+ | Options | - `fields`_ | | | - `allowExtraFields`_ | @@ -287,7 +287,7 @@ Options fields ~~~~~~ -**type**: ``array`` [:ref:`default option`] +**type**: ``array`` [:ref:`default option `] This option is required, and is an associative array defining all of the keys in the collection and, for each key, exactly which validator(s) should diff --git a/reference/constraints/Count.rst b/reference/constraints/Count.rst index 7bf7763cf7b..fe37a3e54f7 100644 --- a/reference/constraints/Count.rst +++ b/reference/constraints/Count.rst @@ -8,7 +8,7 @@ element count is *between* some minimum and maximum value. The Count constraint was added in Symfony 2.1. +----------------+---------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ | Options | - `min`_ | | | - `max`_ | @@ -108,7 +108,7 @@ Options min ~~~ -**type**: ``integer`` [:ref:`default option`] +**type**: ``integer`` [:ref:`default option `] This required option is the "min" count value. Validation will fail if the given collection elements count is **less** than this min value. @@ -116,7 +116,7 @@ collection elements count is **less** than this min value. max ~~~ -**type**: ``integer`` [:ref:`default option`] +**type**: ``integer`` [:ref:`default option `] This required option is the "max" count value. Validation will fail if the given collection elements count is **greater** than this max value. diff --git a/reference/constraints/Country.rst b/reference/constraints/Country.rst index 291583d842a..a3e38f20628 100644 --- a/reference/constraints/Country.rst +++ b/reference/constraints/Country.rst @@ -4,7 +4,7 @@ Country Validates that a value is a valid two-letter country code. +----------------+------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ | Options | - `message`_ | +----------------+------------------------------------------------------------------------+ diff --git a/reference/constraints/Date.rst b/reference/constraints/Date.rst index d6816777b06..d65275e8dff 100644 --- a/reference/constraints/Date.rst +++ b/reference/constraints/Date.rst @@ -6,7 +6,7 @@ or a string (or an object that can be cast into a string) that follows a valid YYYY-MM-DD format. +----------------+--------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+--------------------------------------------------------------------+ | Options | - `message`_ | +----------------+--------------------------------------------------------------------+ diff --git a/reference/constraints/DateTime.rst b/reference/constraints/DateTime.rst index 7a13b8044c0..c46d1f87134 100644 --- a/reference/constraints/DateTime.rst +++ b/reference/constraints/DateTime.rst @@ -6,7 +6,7 @@ object or a string (or an object that can be cast into a string) that follows a valid YYYY-MM-DD HH:MM:SS format. +----------------+------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ | Options | - `message`_ | +----------------+------------------------------------------------------------------------+ diff --git a/reference/constraints/Email.rst b/reference/constraints/Email.rst index f0ea3098655..d4be658f92c 100644 --- a/reference/constraints/Email.rst +++ b/reference/constraints/Email.rst @@ -5,7 +5,7 @@ Validates that a value is a valid email address. The underlying value is cast to a string before being validated. +----------------+---------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ | Options | - `message`_ | | | - `checkMX`_ | diff --git a/reference/constraints/False.rst b/reference/constraints/False.rst index 339128cef66..3bcc33fb309 100644 --- a/reference/constraints/False.rst +++ b/reference/constraints/False.rst @@ -8,7 +8,7 @@ string "``0``". Also see :doc:`True `. +----------------+---------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ | Options | - `message`_ | +----------------+---------------------------------------------------------------------+ diff --git a/reference/constraints/File.rst b/reference/constraints/File.rst index c54d70fc0db..8ece814cd7a 100644 --- a/reference/constraints/File.rst +++ b/reference/constraints/File.rst @@ -8,16 +8,16 @@ Validates that a value is a valid "file", which can be one of the following: * A valid :class:`Symfony\\Component\\HttpFoundation\\File\\File` object (including objects of class :class:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile`). -This constraint is commonly used in forms with the :doc:`file` +This constraint is commonly used in forms with the :doc:`file ` form type. .. tip:: - If the file you're validating is an image, try the :doc:`Image` + If the file you're validating is an image, try the :doc:`Image ` constraint. +----------------+---------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ | Options | - `maxSize`_ | | | - `mimeTypes`_ | @@ -38,7 +38,7 @@ Basic Usage ----------- This constraint is most commonly used on a property that will be rendered -in a form as a :doc:`file` form type. For example, +in a form as a :doc:`file ` form type. For example, suppose you're creating an author form where you can upload a "bio" PDF for the author. In your form, the ``bioFile`` property would be a ``file`` type. The ``Author`` class might look as follows:: diff --git a/reference/constraints/Image.rst b/reference/constraints/Image.rst index f3a0cae3c62..7492dfed500 100644 --- a/reference/constraints/Image.rst +++ b/reference/constraints/Image.rst @@ -1,18 +1,18 @@ Image ===== -The Image constraint works exactly like the :doc:`File` +The Image constraint works exactly like the :doc:`File ` constraint, except that its `mimeTypes`_ and `mimeTypesMessage` options are automatically setup to work for image files specifically. Additionally, as of Symfony 2.1, it has options so you can validate against the width and height of the image. -See the :doc:`File` constraint for the bulk of +See the :doc:`File ` constraint for the bulk of the documentation on this constraint. +----------------+----------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+----------------------------------------------------------------------+ | Options | - `mimeTypes`_ | | | - `minWidth`_ | @@ -25,7 +25,7 @@ the documentation on this constraint. | | - `minWidthMessage`_ | | | - `maxHeightMessage`_ | | | - `minHeightMessage`_ | -| | - See :doc:`File` for inherited options | +| | - See :doc:`File ` for inherited options | +----------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\File` | +----------------+----------------------------------------------------------------------+ @@ -36,7 +36,7 @@ Basic Usage ----------- This constraint is most commonly used on a property that will be rendered -in a form as a :doc:`file` form type. For example, +in a form as a :doc:`file ` form type. For example, suppose you're creating an author form where you can upload a "headshot" image for the author. In your form, the ``headshot`` property would be a ``file`` type. The ``Author`` class might look as follows:: @@ -146,7 +146,7 @@ and that it is between a certain width and height. Options ------- -This constraint shares all of its options with the :doc:`File` +This constraint shares all of its options with the :doc:`File ` constraint. It does, however, modify two of the default option values and add several other options. diff --git a/reference/constraints/Ip.rst b/reference/constraints/Ip.rst index b4ef5e28378..2a92e978f1e 100644 --- a/reference/constraints/Ip.rst +++ b/reference/constraints/Ip.rst @@ -6,7 +6,7 @@ the value as IPv4, but a number of different options exist to validate as IPv6 and many other combinations. +----------------+---------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ | Options | - `version`_ | | | - `message`_ | diff --git a/reference/constraints/Language.rst b/reference/constraints/Language.rst index de1f33560e8..582ce3380aa 100644 --- a/reference/constraints/Language.rst +++ b/reference/constraints/Language.rst @@ -4,7 +4,7 @@ Language Validates that a value is a valid language code. +----------------+------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ | Options | - `message`_ | +----------------+------------------------------------------------------------------------+ diff --git a/reference/constraints/Length.rst b/reference/constraints/Length.rst index 54d32ef62fa..309d715be5e 100644 --- a/reference/constraints/Length.rst +++ b/reference/constraints/Length.rst @@ -7,7 +7,7 @@ Validates that a given string length is *between* some minimum and maximum value The Length constraint was added in Symfony 2.1. +----------------+----------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+----------------------------------------------------------------------+ | Options | - `min`_ | | | - `max`_ | @@ -108,7 +108,7 @@ Options min ~~~ -**type**: ``integer`` [:ref:`default option`] +**type**: ``integer`` [:ref:`default option `] This required option is the "min" length value. Validation will fail if the given value's length is **less** than this min value. @@ -116,7 +116,7 @@ value's length is **less** than this min value. max ~~~ -**type**: ``integer`` [:ref:`default option`] +**type**: ``integer`` [:ref:`default option `] This required option is the "max" length value. Validation will fail if the given value's length is **greater** than this max value. diff --git a/reference/constraints/Locale.rst b/reference/constraints/Locale.rst index 6f1e992adc7..a39d1493b79 100644 --- a/reference/constraints/Locale.rst +++ b/reference/constraints/Locale.rst @@ -8,7 +8,7 @@ The "value" for each locale is either the two letter ISO639-1 *language* code the ISO3166 *country* code (e.g. ``fr_FR`` for French/France). +----------------+------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ | Options | - `message`_ | +----------------+------------------------------------------------------------------------+ diff --git a/reference/constraints/Luhn.rst b/reference/constraints/Luhn.rst index 2c7d261e434..58697e94184 100644 --- a/reference/constraints/Luhn.rst +++ b/reference/constraints/Luhn.rst @@ -9,7 +9,7 @@ It is useful as a first step to validating a credit card: before communicating w payment gateway. +----------------+-----------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ | Options | - `message`_ | +----------------+-----------------------------------------------------------------------+ diff --git a/reference/constraints/Max.rst b/reference/constraints/Max.rst index 93723ef35db..6e4e723dbe6 100644 --- a/reference/constraints/Max.rst +++ b/reference/constraints/Max.rst @@ -10,7 +10,7 @@ Max Validates that a given number is *less* than some maximum number. +----------------+--------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+--------------------------------------------------------------------+ | Options | - `limit`_ | | | - `message`_ | @@ -95,7 +95,7 @@ Options limit ~~~~~ -**type**: ``integer`` [:ref:`default option`] +**type**: ``integer`` [:ref:`default option `] This required option is the "max" value. Validation will fail if the given value is **greater** than this max value. diff --git a/reference/constraints/MaxLength.rst b/reference/constraints/MaxLength.rst index 786b90f10d1..f3630abb21c 100644 --- a/reference/constraints/MaxLength.rst +++ b/reference/constraints/MaxLength.rst @@ -10,7 +10,7 @@ MaxLength Validates that the length of a string is not larger than the given limit. +----------------+-------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-------------------------------------------------------------------------+ | Options | - `limit`_ | | | - `message`_ | @@ -90,7 +90,7 @@ Options limit ~~~~~ -**type**: ``integer`` [:ref:`default option`] +**type**: ``integer`` [:ref:`default option `] This required option is the "max" value. Validation will fail if the length of the give string is **greater** than this number. diff --git a/reference/constraints/Min.rst b/reference/constraints/Min.rst index 232ee37652d..2a9e3679fab 100644 --- a/reference/constraints/Min.rst +++ b/reference/constraints/Min.rst @@ -10,7 +10,7 @@ Min Validates that a given number is *greater* than some minimum number. +----------------+--------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+--------------------------------------------------------------------+ | Options | - `limit`_ | | | - `message`_ | @@ -95,7 +95,7 @@ Options limit ~~~~~ -**type**: ``integer`` [:ref:`default option`] +**type**: ``integer`` [:ref:`default option `] This required option is the "min" value. Validation will fail if the given value is **less** than this min value. diff --git a/reference/constraints/MinLength.rst b/reference/constraints/MinLength.rst index 373c5039cd7..9ce206e93c6 100644 --- a/reference/constraints/MinLength.rst +++ b/reference/constraints/MinLength.rst @@ -10,7 +10,7 @@ MinLength Validates that the length of a string is at least as long as the given limit. +----------------+-------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-------------------------------------------------------------------------+ | Options | - `limit`_ | | | - `message`_ | @@ -95,7 +95,7 @@ Options limit ~~~~~ -**type**: ``integer`` [:ref:`default option`] +**type**: ``integer`` [:ref:`default option `] This required option is the "min" value. Validation will fail if the length of the give string is **less** than this number. diff --git a/reference/constraints/NotBlank.rst b/reference/constraints/NotBlank.rst index b7d7bec9e2b..b4317c4802a 100644 --- a/reference/constraints/NotBlank.rst +++ b/reference/constraints/NotBlank.rst @@ -6,7 +6,7 @@ and also not equal to ``null``. To force that a value is simply not equal to ``null``, see the :doc:`/reference/constraints/NotNull` constraint. +----------------+------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ | Options | - `message`_ | +----------------+------------------------------------------------------------------------+ diff --git a/reference/constraints/NotNull.rst b/reference/constraints/NotNull.rst index b038d92fd8c..6b6053c2ede 100644 --- a/reference/constraints/NotNull.rst +++ b/reference/constraints/NotNull.rst @@ -6,7 +6,7 @@ a value is simply not blank (not a blank string), see the :doc:`/reference/cons constraint. +----------------+-----------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ | Options | - `message`_ | +----------------+-----------------------------------------------------------------------+ diff --git a/reference/constraints/Null.rst b/reference/constraints/Null.rst index bbf3d0939ef..d63b1e7a94f 100644 --- a/reference/constraints/Null.rst +++ b/reference/constraints/Null.rst @@ -6,7 +6,7 @@ is simply blank (blank string or ``null``), see the :doc:`/reference/constraint constraint. To ensure that a property is not null, see :doc:`/reference/constraints/NotNull`. +----------------+-----------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ | Options | - `message`_ | +----------------+-----------------------------------------------------------------------+ diff --git a/reference/constraints/Range.rst b/reference/constraints/Range.rst index b47eb6d6440..913c7fed292 100644 --- a/reference/constraints/Range.rst +++ b/reference/constraints/Range.rst @@ -7,7 +7,7 @@ Validates that a given number is *between* some minimum and maximum number. The Range constraint was added in Symfony 2.1. +----------------+---------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ | Options | - `min`_ | | | - `max`_ | @@ -107,7 +107,7 @@ Options min ~~~ -**type**: ``integer`` [:ref:`default option`] +**type**: ``integer`` [:ref:`default option `] This required option is the "min" value. Validation will fail if the given value is **less** than this min value. @@ -115,7 +115,7 @@ value is **less** than this min value. max ~~~ -**type**: ``integer`` [:ref:`default option`] +**type**: ``integer`` [:ref:`default option `] This required option is the "max" value. Validation will fail if the given value is **greater** than this max value. diff --git a/reference/constraints/Regex.rst b/reference/constraints/Regex.rst index 2bdf0a8a87c..1595ff4c042 100644 --- a/reference/constraints/Regex.rst +++ b/reference/constraints/Regex.rst @@ -4,7 +4,7 @@ Regex Validates that a value matches a regular expression. +----------------+-----------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+-----------------------------------------------------------------------+ | Options | - `pattern`_ | | | - `htmlPattern`_ | @@ -166,7 +166,7 @@ Options pattern ~~~~~~~ -**type**: ``string`` [:ref:`default option`] +**type**: ``string`` [:ref:`default option `] This required option is the regular expression pattern that the input will be matched against. By default, this validator will fail if the input string diff --git a/reference/constraints/Time.rst b/reference/constraints/Time.rst index 0ada2796e26..7fdeea6445b 100644 --- a/reference/constraints/Time.rst +++ b/reference/constraints/Time.rst @@ -6,7 +6,7 @@ or a string (or an object that can be cast into a string) that follows a valid "HH:MM:SS" format. +----------------+------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+------------------------------------------------------------------------+ | Options | - `message`_ | +----------------+------------------------------------------------------------------------+ diff --git a/reference/constraints/True.rst b/reference/constraints/True.rst index ba5ca5997d8..5228bda9634 100644 --- a/reference/constraints/True.rst +++ b/reference/constraints/True.rst @@ -8,7 +8,7 @@ string "``1``". Also see :doc:`False `. +----------------+---------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ | Options | - `message`_ | +----------------+---------------------------------------------------------------------+ diff --git a/reference/constraints/Type.rst b/reference/constraints/Type.rst index 41849ba3086..dd854258183 100644 --- a/reference/constraints/Type.rst +++ b/reference/constraints/Type.rst @@ -6,9 +6,9 @@ should be an array, you can use this constraint with the ``array`` type option to validate this. +----------------+---------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ -| Options | - :ref:`type` | +| Options | - :ref:`type ` | | | - `message`_ | +----------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Validator\\Constraints\\Type` | @@ -91,7 +91,7 @@ Options type ~~~~ -**type**: ``string`` [:ref:`default option`] +**type**: ``string`` [:ref:`default option `] This required option is the fully qualified class name or one of the PHP datatypes as determined by PHP's ``is_`` functions. diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index c6376469403..276d19c64aa 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -6,7 +6,7 @@ unique. This is commonly used, for example, to prevent a new user to register using an email address that already exists in the system. +----------------+-------------------------------------------------------------------------------------+ -| Applies to | :ref:`class` | +| Applies to | :ref:`class ` | +----------------+-------------------------------------------------------------------------------------+ | Options | - `fields`_ | | | - `message`_ | @@ -117,7 +117,7 @@ Options fields ~~~~~~ -**type**: ``array`` | ``string`` [:ref:`default option`] +**type**: ``array`` | ``string`` [:ref:`default option `] This required option is the field (or list of fields) on which this entity should be unique. For example, if you specified both the ``email`` and ``name`` diff --git a/reference/constraints/Url.rst b/reference/constraints/Url.rst index 51f5d8c093e..818156e3d73 100644 --- a/reference/constraints/Url.rst +++ b/reference/constraints/Url.rst @@ -4,7 +4,7 @@ Url Validates that a value is a valid URL string. +----------------+---------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ | Options | - `message`_ | | | - `protocols`_ | diff --git a/reference/constraints/UserPassword.rst b/reference/constraints/UserPassword.rst index 3fcf47ea9c1..caa3fed7a72 100644 --- a/reference/constraints/UserPassword.rst +++ b/reference/constraints/UserPassword.rst @@ -22,7 +22,7 @@ but needs to enter his old password for security. automatically by the security system. +----------------+--------------------------------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+--------------------------------------------------------------------------------------------+ | Options | - `message`_ | +----------------+--------------------------------------------------------------------------------------------+ diff --git a/reference/constraints/Valid.rst b/reference/constraints/Valid.rst index 70110f8da26..137a357a0f5 100644 --- a/reference/constraints/Valid.rst +++ b/reference/constraints/Valid.rst @@ -6,7 +6,7 @@ as properties on an object being validated. This allows you to validate an object and all sub-objects associated with it. +----------------+---------------------------------------------------------------------+ -| Applies to | :ref:`property or method` | +| Applies to | :ref:`property or method ` | +----------------+---------------------------------------------------------------------+ | Options | - `traverse`_ | +----------------+---------------------------------------------------------------------+ diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index 1e5a8f3e7ac..5c0be67b18b 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -333,7 +333,7 @@ form.type_guesser **Purpose**: Add your own logic for "form type guessing" -This tag allows you to add your own logic to the :ref:`Form Guessing` +This tag allows you to add your own logic to the :ref:`Form Guessing ` process. By default, form guessing is done by "guessers" based on the validation metadata and Doctrine metadata (if you're using Doctrine). diff --git a/reference/forms/twig_reference.rst b/reference/forms/twig_reference.rst index e34b4c6e463..e01ecd05d41 100644 --- a/reference/forms/twig_reference.rst +++ b/reference/forms/twig_reference.rst @@ -7,8 +7,8 @@ Twig Template Form Function and Variable Reference When working with forms in a template, there are two powerful things at your disposal: -* :ref:`Functions` for rendering each part of a form -* :ref:`Variables` for getting *any* information about any field +* :ref:`Functions ` for rendering each part of a form +* :ref:`Variables ` for getting *any* information about any field You'll use functions often to render your fields. Variables, on the other hand, are less commonly-used, but infinitely powerful since you can access diff --git a/reference/forms/types/birthday.rst b/reference/forms/types/birthday.rst index fc1b58378be..39f3beb6da0 100644 --- a/reference/forms/types/birthday.rst +++ b/reference/forms/types/birthday.rst @@ -4,13 +4,13 @@ birthday Field Type =================== -A :doc:`date` field that specializes in handling +A :doc:`date ` field that specializes in handling birthdate data. Can be rendered as a single text box, three text boxes (month, day, and year), or three select boxes. -This type is essentially the same as the :doc:`date` +This type is essentially the same as the :doc:`date ` type, but with a more appropriate default for the `years`_ option. The `years`_ option defaults to 120 years ago to the current year. @@ -37,7 +37,7 @@ option defaults to 120 years ago to the current year. | | - `mapped`_ | | | - `virtual`_ | +----------------------+-------------------------------------------------------------------------------+ -| Parent type | :doc:`date` | +| Parent type | :doc:`date ` | +----------------------+-------------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType` | +----------------------+-------------------------------------------------------------------------------+ @@ -56,7 +56,7 @@ relevant when the ``widget`` option is set to ``choice``. Inherited options ----------------- -These options inherit from the :doc:`date` type: +These options inherit from the :doc:`date ` type: .. include:: /reference/forms/types/options/date_widget.rst.inc @@ -74,7 +74,7 @@ These options inherit from the :doc:`date` type: .. include:: /reference/forms/types/options/user_timezone.rst.inc -These options inherit from the :doc:`date` type: +These options inherit from the :doc:`date ` type: .. include:: /reference/forms/types/options/invalid_message.rst.inc diff --git a/reference/forms/types/checkbox.rst b/reference/forms/types/checkbox.rst index e72400d2684..fa56992f3fd 100644 --- a/reference/forms/types/checkbox.rst +++ b/reference/forms/types/checkbox.rst @@ -21,7 +21,7 @@ if the box is unchecked, the value will be set to false. | | - `error_mapping`_ | | | - `mapped`_ | +-------------+------------------------------------------------------------------------+ -| Parent type | :doc:`field` | +| Parent type | :doc:`field ` | +-------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType` | +-------------+------------------------------------------------------------------------+ @@ -50,7 +50,7 @@ not affect the value that's set on your object. Inherited options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index 8c9c924f862..7e4a17bbbee 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -10,31 +10,31 @@ It can be rendered as a ``select`` tag, radio buttons, or checkboxes. To use this field, you must specify *either* the ``choice_list`` or ``choices`` option. -+-------------+-----------------------------------------------------------------------------+ -| Rendered as | can be various tags (see below) | -+-------------+-----------------------------------------------------------------------------+ -| Options | - `choices`_ | -| | - `choice_list`_ | -| | - `multiple`_ | -| | - `expanded`_ | -| | - `preferred_choices`_ | -| | - `empty_value`_ | -+-------------+-----------------------------------------------------------------------------+ -| Inherited | - `required`_ | -| options | - `label`_ | -| | - `read_only`_ | -| | - `disabled`_ | -| | - `error_bubbling`_ | -| | - `error_mapping`_ | -| | - `mapped`_ | -| | - `virtual`_ | -| | - `by_reference`_ | -| | - `empty_data`_ | -+-------------+-----------------------------------------------------------------------------+ -| Parent type | :doc:`form` (if expanded), ``field`` otherwise | -+-------------+-----------------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType` | -+-------------+-----------------------------------------------------------------------------+ ++-------------+------------------------------------------------------------------------------+ +| Rendered as | can be various tags (see below) | ++-------------+------------------------------------------------------------------------------+ +| Options | - `choices`_ | +| | - `choice_list`_ | +| | - `multiple`_ | +| | - `expanded`_ | +| | - `preferred_choices`_ | +| | - `empty_value`_ | ++-------------+------------------------------------------------------------------------------+ +| Inherited | - `required`_ | +| options | - `label`_ | +| | - `read_only`_ | +| | - `disabled`_ | +| | - `error_bubbling`_ | +| | - `error_mapping`_ | +| | - `mapped`_ | +| | - `virtual`_ | +| | - `by_reference`_ | +| | - `empty_data`_ | ++-------------+------------------------------------------------------------------------------+ +| Parent type | :doc:`form ` (if expanded), ``field`` otherwise | ++-------------+------------------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType` | ++-------------+------------------------------------------------------------------------------+ Example Usage ------------- @@ -110,7 +110,7 @@ can be created to supply the choices. Inherited options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/collection.rst b/reference/forms/types/collection.rst index 08d581bea2b..484e68dd2a4 100644 --- a/reference/forms/types/collection.rst +++ b/reference/forms/types/collection.rst @@ -27,7 +27,7 @@ forms, which is useful when creating forms that expose one-to-many relationships | | - `empty_data`_ | | | - `mapped`_ | +-------------+-----------------------------------------------------------------------------+ -| Parent type | :doc:`form` | +| Parent type | :doc:`form ` | +-------------+-----------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CollectionType` | +-------------+-----------------------------------------------------------------------------+ @@ -215,7 +215,7 @@ type This is the field type for each item in this collection (e.g. ``text``, ``choice``, etc). For example, if you have an array of email addresses, you'd use the -:doc:`email` type. If you want to embed +:doc:`email ` type. If you want to embed a collection of some other form, create a new instance of your form type and pass it as this option. @@ -225,7 +225,7 @@ options **type**: ``array`` **default**: ``array()`` This is the array that's passed to the form type specified in the `type`_ -option. For example, if you used the :doc:`choice` +option. For example, if you used the :doc:`choice ` type as your `type`_ option (e.g. for a collection of drop-down menus), then you'd need to at least pass the ``choices`` option to the underlying type:: @@ -339,7 +339,7 @@ replaced with the same value. Inherited options ----------------- -These options inherit from the :doc:`field` type. +These options inherit from the :doc:`field ` type. Not all options are listed here - only the most applicable to this type: .. include:: /reference/forms/types/options/label.rst.inc diff --git a/reference/forms/types/country.rst b/reference/forms/types/country.rst index f26700d26c2..cbb83a3f6e4 100644 --- a/reference/forms/types/country.rst +++ b/reference/forms/types/country.rst @@ -37,7 +37,7 @@ you should just use the ``choice`` type directly. | | - `disabled`_ | | | - `mapped`_ | +-------------+-----------------------------------------------------------------------+ -| Parent type | :doc:`choice` | +| Parent type | :doc:`choice ` | +-------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CountryType` | +-------------+-----------------------------------------------------------------------+ @@ -57,7 +57,7 @@ It uses the default locale to determine the language. Inherited options ----------------- -These options inherit from the :doc:`choice` type: +These options inherit from the :doc:`choice ` type: .. include:: /reference/forms/types/options/multiple.rst.inc @@ -71,7 +71,7 @@ These options inherit from the :doc:`choice` type .. include:: /reference/forms/types/options/error_mapping.rst.inc -These options inherit from the :doc:`date` type: +These options inherit from the :doc:`date ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index aa87d713de2..10f5d5467e8 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -136,7 +136,7 @@ error_bubbling Inherited options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/invalid_message.rst.inc diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst index 3793987bd69..1f33c147b58 100644 --- a/reference/forms/types/datetime.rst +++ b/reference/forms/types/datetime.rst @@ -37,7 +37,7 @@ data can be a ``DateTime`` object, a string, a timestamp or an array. | | - `mapped`_ | | | - `virtual`_ | +----------------------+-----------------------------------------------------------------------------+ -| Parent type | :doc:`form` | +| Parent type | :doc:`form ` | +----------------------+-----------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateTimeType` | +----------------------+-----------------------------------------------------------------------------+ @@ -50,14 +50,14 @@ date_widget **type**: ``string`` **default**: ``choice`` -Defines the ``widget`` option for the :doc:`date` type +Defines the ``widget`` option for the :doc:`date ` type time_widget ~~~~~~~~~~~ **type**: ``string`` **default**: ``choice`` -Defines the ``widget`` option for the :doc:`time` type +Defines the ``widget`` option for the :doc:`time ` type input ~~~~~ @@ -83,7 +83,7 @@ date_format **type**: ``integer`` or ``string`` **default**: ``IntlDateFormatter::MEDIUM`` Defines the ``format`` option that will be passed down to the date field. -See the :ref:`date type's format option` +See the :ref:`date type's format option ` for more details. .. include:: /reference/forms/types/options/hours.rst.inc @@ -109,7 +109,7 @@ for more details. Inherited options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/invalid_message.rst.inc diff --git a/reference/forms/types/email.rst b/reference/forms/types/email.rst index 94d586886ee..7653aa8d5f9 100644 --- a/reference/forms/types/email.rst +++ b/reference/forms/types/email.rst @@ -5,7 +5,7 @@ email Field Type ================ The ``email`` field is a text field that is rendered using the HTML5 -```` tag. +`` `` tag. +-------------+---------------------------------------------------------------------+ | Rendered as | ``input`` ``email`` field (a text box) | @@ -20,7 +20,7 @@ The ``email`` field is a text field that is rendered using the HTML5 | | - `error_mapping`_ | | | - `mapped`_ | +-------------+---------------------------------------------------------------------+ -| Parent type | :doc:`field` | +| Parent type | :doc:`field ` | +-------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\EmailType` | +-------------+---------------------------------------------------------------------+ @@ -28,7 +28,7 @@ The ``email`` field is a text field that is rendered using the HTML5 Inherited Options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/max_length.rst.inc diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index c47382d74c6..f52e92aa4b6 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -33,7 +33,7 @@ objects from the database. | | - `error_mapping`_ | | | - `mapped`_ | +-------------+------------------------------------------------------------------+ -| Parent type | :doc:`choice` | +| Parent type | :doc:`choice ` | +-------------+------------------------------------------------------------------+ | Class | :class:`Symfony\\Bridge\\Doctrine\\Form\\Type\\EntityType` | +-------------+------------------------------------------------------------------+ @@ -145,7 +145,7 @@ are documented above. Inherited options ----------------- -These options inherit from the :doc:`choice` type: +These options inherit from the :doc:`choice ` type: .. include:: /reference/forms/types/options/multiple.rst.inc @@ -162,7 +162,7 @@ These options inherit from the :doc:`choice` type .. include:: /reference/forms/types/options/empty_value.rst.inc -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/field.rst b/reference/forms/types/field.rst index ee06911d6bb..753ef6800a5 100644 --- a/reference/forms/types/field.rst +++ b/reference/forms/types/field.rst @@ -5,4 +5,4 @@ The Abstract "field" Type ========================= The ``field`` form type is deprecated as of Symfony 2.1. -Please use the :doc:`Form field type` instead. +Please use the :doc:`Form field type ` instead. diff --git a/reference/forms/types/file.rst b/reference/forms/types/file.rst index f9ff36d3950..7179ccdbd12 100644 --- a/reference/forms/types/file.rst +++ b/reference/forms/types/file.rst @@ -17,7 +17,7 @@ The ``file`` type represents a file input in your form. | | - `error_mapping`_ | | | - `mapped`_ | +-------------+---------------------------------------------------------------------+ -| Parent type | :doc:`form` | +| Parent type | :doc:`form ` | +-------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FileType` | +-------------+---------------------------------------------------------------------+ @@ -84,7 +84,7 @@ how to manage a file upload associated with a Doctrine entity. Inherited options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index 97451e3c39c..82282cae5e9 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -34,5 +34,5 @@ on all fields. virtual ------- -See :doc:`How to use the Virtual Form Field Option` +See :doc:`How to use the Virtual Form Field Option ` diff --git a/reference/forms/types/hidden.rst b/reference/forms/types/hidden.rst index a0e954c3bfe..ab27d4b8351 100644 --- a/reference/forms/types/hidden.rst +++ b/reference/forms/types/hidden.rst @@ -17,7 +17,7 @@ The hidden type represents a hidden input field. | | - `mapped`_ | | | - `error_mapping`_ | +-------------+----------------------------------------------------------------------+ -| Parent type | :doc:`field` | +| Parent type | :doc:`field ` | +-------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\HiddenType` | +-------------+----------------------------------------------------------------------+ @@ -42,7 +42,7 @@ Pass errors to the root form, otherwise they will not be visible. Inherited Options ----------------- -These options inherit from the :doc:`date` type: +These options inherit from the :doc:`date ` type: .. include:: /reference/forms/types/options/data.rst.inc diff --git a/reference/forms/types/integer.rst b/reference/forms/types/integer.rst index b1a3d518eea..109072e50d7 100644 --- a/reference/forms/types/integer.rst +++ b/reference/forms/types/integer.rst @@ -29,7 +29,7 @@ integers. By default, all non-integer values (e.g. 6.78) will round down (e.g. 6 | | - `invalid_message_parameters`_ | | | - `mapped`_ | +-------------+-----------------------------------------------------------------------+ -| Parent type | :doc:`field` | +| Parent type | :doc:`field ` | +-------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\IntegerType` | +-------------+-----------------------------------------------------------------------+ @@ -65,7 +65,7 @@ on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\Integ Inherited options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/language.rst b/reference/forms/types/language.rst index 6f606541d06..4bce0a35ab3 100644 --- a/reference/forms/types/language.rst +++ b/reference/forms/types/language.rst @@ -38,7 +38,7 @@ you should just use the ``choice`` type directly. | | - `disabled`_ | | | - `mapped`_ | +-------------+------------------------------------------------------------------------+ -| Parent type | :doc:`choice` | +| Parent type | :doc:`choice ` | +-------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\LanguageType` | +-------------+------------------------------------------------------------------------+ @@ -58,7 +58,7 @@ default locale to specify the language. Inherited Options ----------------- -These options inherit from the :doc:`choice` type: +These options inherit from the :doc:`choice ` type: .. include:: /reference/forms/types/options/multiple.rst.inc @@ -72,7 +72,7 @@ These options inherit from the :doc:`choice` type .. include:: /reference/forms/types/options/error_mapping.rst.inc -These options inherit from the :doc:`date` type: +These options inherit from the :doc:`date ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/locale.rst b/reference/forms/types/locale.rst index 013ca4b6ec0..d8bb69d6d20 100644 --- a/reference/forms/types/locale.rst +++ b/reference/forms/types/locale.rst @@ -39,7 +39,7 @@ you should just use the ``choice`` type directly. | | - `disabled`_ | | | - `mapped`_ | +-------------+------------------------------------------------------------------------+ -| Parent type | :doc:`choice` | +| Parent type | :doc:`choice ` | +-------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\LanguageType` | +-------------+------------------------------------------------------------------------+ @@ -60,7 +60,7 @@ default locale to specify the language. Inherited options ----------------- -These options inherit from the :doc:`choice` type: +These options inherit from the :doc:`choice ` type: .. include:: /reference/forms/types/options/multiple.rst.inc @@ -74,7 +74,7 @@ These options inherit from the :doc:`choice` type .. include:: /reference/forms/types/options/error_mapping.rst.inc -These options inherit from the :doc:`date` type: +These options inherit from the :doc:`date ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/map.rst.inc b/reference/forms/types/map.rst.inc index 7cd886a40e5..1d200deacb1 100644 --- a/reference/forms/types/map.rst.inc +++ b/reference/forms/types/map.rst.inc @@ -1,55 +1,55 @@ Text Fields ~~~~~~~~~~~ -* :doc:`text` -* :doc:`textarea` -* :doc:`email` -* :doc:`integer` -* :doc:`money` -* :doc:`number` -* :doc:`password` -* :doc:`percent` -* :doc:`search` -* :doc:`url` +* :doc:`text ` +* :doc:`textarea ` +* :doc:`email ` +* :doc:`integer ` +* :doc:`money ` +* :doc:`number ` +* :doc:`password ` +* :doc:`percent ` +* :doc:`search ` +* :doc:`url ` Choice Fields ~~~~~~~~~~~~~ -* :doc:`choice` -* :doc:`entity` -* :doc:`country` -* :doc:`language` -* :doc:`locale` -* :doc:`timezone` +* :doc:`choice ` +* :doc:`entity ` +* :doc:`country ` +* :doc:`language ` +* :doc:`locale ` +* :doc:`timezone ` Date and Time Fields ~~~~~~~~~~~~~~~~~~~~ -* :doc:`date` -* :doc:`datetime` -* :doc:`time` -* :doc:`birthday` +* :doc:`date ` +* :doc:`datetime ` +* :doc:`time ` +* :doc:`birthday ` Other Fields ~~~~~~~~~~~~ -* :doc:`checkbox` -* :doc:`file` -* :doc:`radio` +* :doc:`checkbox ` +* :doc:`file ` +* :doc:`radio ` Field Groups ~~~~~~~~~~~~ -* :doc:`collection` -* :doc:`repeated` +* :doc:`collection ` +* :doc:`repeated ` Hidden Fields ~~~~~~~~~~~~~ -* :doc:`hidden` +* :doc:`hidden ` Base Fields ~~~~~~~~~~~ -* :doc:`field` -* :doc:`form` \ No newline at end of file +* :doc:`field ` +* :doc:`form ` diff --git a/reference/forms/types/money.rst b/reference/forms/types/money.rst index df489534fa4..f7bac78ce2b 100644 --- a/reference/forms/types/money.rst +++ b/reference/forms/types/money.rst @@ -29,7 +29,7 @@ how the input and output of the data is handled. | | - `invalid_message_parameters`_ | | | - `mapped`_ | +-------------+---------------------------------------------------------------------+ -| Parent type | :doc:`field` | +| Parent type | :doc:`field ` | +-------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\MoneyType` | +-------------+---------------------------------------------------------------------+ @@ -83,7 +83,7 @@ to ``0``). Inherited Options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/number.rst b/reference/forms/types/number.rst index ce40bce055c..15918d31993 100644 --- a/reference/forms/types/number.rst +++ b/reference/forms/types/number.rst @@ -25,7 +25,7 @@ you want to use for your number. | | - `invalid_message_parameters`_ | | | - `mapped`_ | +-------------+----------------------------------------------------------------------+ -| Parent type | :doc:`field` | +| Parent type | :doc:`field ` | +-------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\NumberType` | +-------------+----------------------------------------------------------------------+ @@ -73,7 +73,7 @@ option is a constant on the :class:`Symfony\\Component\\Form\\Extension\\Core\\D Inherited Options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/password.rst b/reference/forms/types/password.rst index 8ae6fee67df..7c0243d2956 100644 --- a/reference/forms/types/password.rst +++ b/reference/forms/types/password.rst @@ -21,7 +21,7 @@ The ``password`` field renders an input password text box. | | - `error_mapping`_ | | | - `mapped`_ | +-------------+------------------------------------------------------------------------+ -| Parent type | :doc:`text` | +| Parent type | :doc:`text ` | +-------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\PasswordType` | +-------------+------------------------------------------------------------------------+ @@ -44,7 +44,7 @@ Put simply, if for some reason you want to render your password field Inherited Options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/max_length.rst.inc diff --git a/reference/forms/types/percent.rst b/reference/forms/types/percent.rst index 33e566fbf5f..9ac7a2c4cfa 100644 --- a/reference/forms/types/percent.rst +++ b/reference/forms/types/percent.rst @@ -28,7 +28,7 @@ This field adds a percentage sign "``%``" after the input box. | | - `invalid_message_parameters`_ | | | - `mapped`_ | +-------------+-----------------------------------------------------------------------+ -| Parent type | :doc:`field` | +| Parent type | :doc:`field ` | +-------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\PercentType` | +-------------+-----------------------------------------------------------------------+ @@ -67,7 +67,7 @@ places, use this option. Inherited Options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/radio.rst b/reference/forms/types/radio.rst index f2fa999e97a..634548ee76a 100644 --- a/reference/forms/types/radio.rst +++ b/reference/forms/types/radio.rst @@ -9,8 +9,8 @@ be set to the specified value. Radio buttons cannot be unchecked - the value onl changes when another radio button with the same name gets checked. The ``radio`` type isn't usually used directly. More commonly it's used -internally by other types such as :doc:`choice`. -If you want to have a Boolean field, use :doc:`checkbox`. +internally by other types such as :doc:`choice `. +If you want to have a Boolean field, use :doc:`checkbox `. +-------------+---------------------------------------------------------------------+ | Rendered as | ``input`` ``radio`` field | @@ -25,7 +25,7 @@ If you want to have a Boolean field, use :doc:`checkbox` | +| Parent type | :doc:`field ` | +-------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RadioType` | +-------------+---------------------------------------------------------------------+ @@ -44,7 +44,7 @@ not affect the value that's set on your object. Inherited Options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/repeated.rst b/reference/forms/types/repeated.rst index 83e1878b316..75707b6f110 100644 --- a/reference/forms/types/repeated.rst +++ b/reference/forms/types/repeated.rst @@ -27,7 +27,7 @@ accuracy. | | - `mapped`_ | | | - `error_mapping`_ | +-------------+------------------------------------------------------------------------+ -| Parent type | :doc:`field` | +| Parent type | :doc:`field ` | +-------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RepeatedType` | +-------------+------------------------------------------------------------------------+ @@ -186,7 +186,7 @@ error_bubbling Inherited options ----------------- -These options inherit from the :doc:`date` type: +These options inherit from the :doc:`date ` type: .. include:: /reference/forms/types/options/invalid_message.rst.inc diff --git a/reference/forms/types/search.rst b/reference/forms/types/search.rst index 463e8cbf600..038c50295c2 100644 --- a/reference/forms/types/search.rst +++ b/reference/forms/types/search.rst @@ -4,7 +4,7 @@ search Field Type ================= -This renders an ```` field, which is a text box with +This renders an `` `` field, which is a text box with special functionality supported by some browsers. Read about the input search field at `DiveIntoHTML5.info`_ @@ -22,7 +22,7 @@ Read about the input search field at `DiveIntoHTML5.info`_ | | - `error_mapping`_ | | | - `mapped`_ | +-------------+----------------------------------------------------------------------+ -| Parent type | :doc:`text` | +| Parent type | :doc:`text ` | +-------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\SearchType` | +-------------+----------------------------------------------------------------------+ @@ -30,7 +30,7 @@ Read about the input search field at `DiveIntoHTML5.info`_ Inherited Options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/max_length.rst.inc diff --git a/reference/forms/types/text.rst b/reference/forms/types/text.rst index 2dd4e1479c3..fb7a0466a6d 100644 --- a/reference/forms/types/text.rst +++ b/reference/forms/types/text.rst @@ -19,7 +19,7 @@ The text field represents the most basic input text field. | | - `error_mapping`_ | | | - `mapped`_ | +-------------+--------------------------------------------------------------------+ -| Parent type | :doc:`field` | +| Parent type | :doc:`field ` | +-------------+--------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType` | +-------------+--------------------------------------------------------------------+ @@ -28,7 +28,7 @@ The text field represents the most basic input text field. Inherited Options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/max_length.rst.inc diff --git a/reference/forms/types/textarea.rst b/reference/forms/types/textarea.rst index 2c6f6b6c632..2e38c72f0f0 100644 --- a/reference/forms/types/textarea.rst +++ b/reference/forms/types/textarea.rst @@ -19,7 +19,7 @@ Renders a ``textarea`` HTML element. | | - `error_mapping`_ | | | - `mapped`_ | +-------------+------------------------------------------------------------------------+ -| Parent type | :doc:`field` | +| Parent type | :doc:`field ` | +-------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TextareaType` | +-------------+------------------------------------------------------------------------+ @@ -27,7 +27,7 @@ Renders a ``textarea`` HTML element. Inherited Options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/max_length.rst.inc diff --git a/reference/forms/types/time.rst b/reference/forms/types/time.rst index 5034e14e97e..3174197f9d2 100644 --- a/reference/forms/types/time.rst +++ b/reference/forms/types/time.rst @@ -137,7 +137,7 @@ error_bubbling Inherited options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/invalid_message.rst.inc diff --git a/reference/forms/types/timezone.rst b/reference/forms/types/timezone.rst index 535a552f75e..3806b3dc43d 100644 --- a/reference/forms/types/timezone.rst +++ b/reference/forms/types/timezone.rst @@ -33,7 +33,7 @@ you should just use the ``choice`` type directly. | | - `error_mapping`_ | | | - `mapped`_ | +-------------+------------------------------------------------------------------------+ -| Parent type | :doc:`choice` | +| Parent type | :doc:`choice ` | +-------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TimezoneType` | +-------------+------------------------------------------------------------------------+ @@ -52,7 +52,7 @@ The Timezone type defaults the choice_list to all timezones returned by Inherited options ----------------- -These options inherit from the :doc:`choice` type: +These options inherit from the :doc:`choice ` type: .. include:: /reference/forms/types/options/multiple.rst.inc @@ -62,7 +62,7 @@ These options inherit from the :doc:`choice` type .. include:: /reference/forms/types/options/empty_value.rst.inc -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/url.rst b/reference/forms/types/url.rst index ce25cb82fe3..2802b715d1b 100644 --- a/reference/forms/types/url.rst +++ b/reference/forms/types/url.rst @@ -23,7 +23,7 @@ have a protocol. | | - `error_mapping`_ | | | - `mapped`_ | +-------------+-------------------------------------------------------------------+ -| Parent type | :doc:`text` | +| Parent type | :doc:`text ` | +-------------+-------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\UrlType` | +-------------+-------------------------------------------------------------------+ @@ -43,7 +43,7 @@ the data is bound to the form. Inherited Options ----------------- -These options inherit from the :doc:`field` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/max_length.rst.inc diff --git a/reference/map.rst.inc b/reference/map.rst.inc index f94634919a2..2fdd8210ced 100755 --- a/reference/map.rst.inc +++ b/reference/map.rst.inc @@ -18,11 +18,11 @@ * **Forms and Validation** - * :doc:`Form Field Type Reference` + * :doc:`Form Field Type Reference ` * :doc:`Validation Constraints Reference ` - * :doc:`Twig Template Function and Variable Reference` + * :doc:`Twig Template Function and Variable Reference ` -* :doc:`Twig Extensions (forms, filters, tags, etc) Reference` +* :doc:`Twig Extensions (forms, filters, tags, etc) Reference ` * **Other Areas** diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index d2ff0dc9e31..88efb03223e 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -50,22 +50,22 @@ Functions +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``form_enctype(view)`` | This will render the required ``enctype="multipart/form-data"`` attribute | | | if the form contains at least one file upload field, more information in | -| | in :ref:`the Twig Form reference`. | +| | in :ref:`the Twig Form reference `. | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``form_widget(view, variables = {})`` | This will render a complete form or a specific HTML widget of a field, | -| | more information in :ref:`the Twig Form reference`. | +| | more information in :ref:`the Twig Form reference `. | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``form_errors(view)`` | This will render any errors for the given field or the "global" errors, | -| | more information in :ref:`the Twig Form reference`. | +| | more information in :ref:`the Twig Form reference `. | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``form_label(view, label = null, variables = {})`` | This will render the label for the given field, more information in | -| | :ref:`the Twig Form reference`. | +| | :ref:`the Twig Form reference `. | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``form_row(view, variables = {})`` | This will render the row (the field's label, errors and widget) of the | -| | given field, more information in :ref:`the Twig Form reference`. | +| | given field, more information in :ref:`the Twig Form reference `. | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``form_rest(view, variables = {})`` | This will render all fields that have not yet been rendered, more | -| | information in :ref:`the Twig Form reference`. | +| | information in :ref:`the Twig Form reference `. | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``csrf_token(intention)`` | This will render a CSRF token. Use this function if you want CSRF protection without | | | creating a form | @@ -97,10 +97,10 @@ Filters +---------------------------------------------------------------------------------+-------------------------------------------------------------------+ | ``text|trans(arguments = {}, domain = 'messages', locale = null)`` | This will translate the text into the current language, more | | | information in . | -| | :ref:`Translation Filters`. | +| | :ref:`Translation Filters `. | +---------------------------------------------------------------------------------+-------------------------------------------------------------------+ | ``text|transchoice(count, arguments = {}, domain = 'messages', locale = null)`` | This will translate the text with pluralization, more information | -| | in :ref:`Translation Filters`. | +| | in :ref:`Translation Filters `. | +---------------------------------------------------------------------------------+-------------------------------------------------------------------+ | ``variable|yaml_encode(inline = 0)`` | This will transform the variable text into a YAML syntax. | +---------------------------------------------------------------------------------+-------------------------------------------------------------------+ @@ -181,7 +181,7 @@ Those bundles can have other Twig extensions: `the official Twig Extensions documentation`_ * **Assetic** adds the ``{% stylesheets %}``, ``{% javascripts %}`` and ``{% image %}`` tags. You can read more about them in - :doc:`the Assetic Documentation`; + :doc:`the Assetic Documentation `; .. _`the official Twig Extensions documentation`: http://twig.sensiolabs.org/doc/extensions/index.html .. _`http://twig.sensiolabs.org/documentation`: http://twig.sensiolabs.org/documentation From f0bb2dc7798732b8636f7375e6739f6f83e7ee1b Mon Sep 17 00:00:00 2001 From: Uri Goldshtein Date: Thu, 19 Sep 2013 15:18:19 +0200 Subject: [PATCH 0582/2078] Change order of annotations to be the same as the gengerator | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | doctrine | Fixed tickets | --- book/doctrine.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index 033a72447a9..6a628e85576 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -272,8 +272,8 @@ in a number of different formats including YAML, XML or directly inside the class Product { /** - * @ORM\Id * @ORM\Column(type="integer") + * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; From 628ad7f6f42549a4c2045b83c4ff0790d67c33f3 Mon Sep 17 00:00:00 2001 From: youbs Date: Wed, 18 Sep 2013 23:16:53 +0200 Subject: [PATCH 0583/2078] added docs about child forms customization --- cookbook/form/form_customization.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index 5aa5bff48b5..7e060340a50 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -298,6 +298,24 @@ When the ``form.age`` widget is rendered, Symfony will use the ``integer_widget` block from the new template and the ``input`` tag will be wrapped in the ``div`` element specified in the customized block. +Child Forms +~~~~~~~~~~~ + +You can apply a form theme to a specific child of your form: + +.. code-block:: html+jinja + + {% form_theme form.child 'AcmeDemoBundle:Form:fields.html.twig' %} + +This is useful when you want to have a custom theme for a nested form different +than the one of your main form. Just specify both your themes: + +.. code-block:: html+jinja + + {% form_theme form 'AcmeDemoBundle:Form:fields.html.twig' %} + + {% form_theme form.child 'AcmeDemoBundle:Form:fields_child.html.twig' %} + .. _cookbook-form-php-theming: Form Theming in PHP @@ -333,6 +351,13 @@ When the ``form.age`` widget is rendered, Symfony will use the customized ``integer_widget.html.php`` template and the ``input`` tag will be wrapped in the ``div`` element. +If you want to apply a theme to a specific child form, pass it to the ``setTheme`` +method: + +.. code-block:: php + + setTheme($form['child'], 'AcmeDemoBundle:Form/Child'); ?> + .. _cookbook-form-twig-import-base-blocks: Referencing Base Form Blocks (Twig specific) From 54adf73ac765ee87d6fb841c14a56ad4f324ad3d Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 24 Sep 2013 21:46:09 -0500 Subject: [PATCH 0584/2078] [#3003] Adding details about validation for 4096 password length and protecting against attacks with custom password encoders --- book/security.rst | 7 +++++++ components/security/authentication.rst | 20 ++++++++++++++++++-- cookbook/doctrine/registration_form.rst | 18 ++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/book/security.rst b/book/security.rst index fbe468213ef..ae2456668c5 100644 --- a/book/security.rst +++ b/book/security.rst @@ -1410,6 +1410,13 @@ can always be determined in the following way from a controller:: $password = $encoder->encodePassword('ryanpass', $user->getSalt()); $user->setPassword($password); +.. caution:: + + When you allow a user to submit a plaintext password (e.g. registration + form, change password form), you *must* have validation that guarantees + that the password is 4096 characters or less. Read more details in + :ref:`How to implement a simple Registration Form `. + Retrieving the User Object ~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/components/security/authentication.rst b/components/security/authentication.rst index 9af8c9265c9..016dde98c46 100644 --- a/components/security/authentication.rst +++ b/components/security/authentication.rst @@ -190,8 +190,21 @@ Each encoder should implement :class:`Symfony\\Component\\Security\\Core\\Encode or be an array with a ``class`` and an ``arguments`` key, which allows the encoder factory to construct the encoder only when it is needed. -Password Encoders -~~~~~~~~~~~~~~~~~ +Creating a Custom Password Encoder +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There are many built-in password encoders. But if you need to create your +own, it just needs to follow these rules: + +#. The class must implement :class:`Symfony\\Component\\Security\\Core\\Encoder\\PasswordEncoderInterface`; + +#. The first line in ``encodePassword`` and ``isPasswordValid`` must check + to make sure the password is not too long (e.g. 4096). This is for security + (see `CVE-2013-5750`_), and you can copy the `BasePasswordEncoder::checkPasswordLength`_ + implementation from Symfony 2.4. + +Using Password Encoders +~~~~~~~~~~~~~~~~~~~~~~~ When the :method:`Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactory::getEncoder` method of the password encoder factory is called with the user object as @@ -213,3 +226,6 @@ which should be used to encode this user's password:: $user->getPassword(), $password, $user->getSalt()); + +.. _`CVE-2013-5750`: http://symfony.com/blog/cve-2013-5750-security-issue-in-fosuserbundle-login-form +.. _`BasePasswordEncoder::checkPasswordLength`: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Security/Core/Encoder/BasePasswordEncoder.php \ No newline at end of file diff --git a/cookbook/doctrine/registration_form.rst b/cookbook/doctrine/registration_form.rst index e274cf1c639..8d9b4b3ff16 100644 --- a/cookbook/doctrine/registration_form.rst +++ b/cookbook/doctrine/registration_form.rst @@ -45,6 +45,7 @@ You have a simple ``User`` entity mapped to the database:: /** * @ORM\Column(type="string", length=255) * @Assert\NotBlank() + * @Assert\Length(max = 4096) */ protected $plainPassword; @@ -85,6 +86,21 @@ the class. to implement the :ref:`UserInterface` of the security component. +.. _cookbook-registration-password-max: + +.. sidebar:: Why the 4096 Password Limit? + + Notice that the ``plainPassword`` has a max length of ``4096`` characters. + For security purposes (`CVE-2013-5750`_), Symfony limits the plain password + length to 4096 characters when encoding it. Adding this constraint makes + sure that your form will give a validation error if anyone tries a super-long + password. + + You'll need to add this constraint anywhere in your application where + your user submits a plaintext password (e.g. change password form). The + only place where you don't need to worry about this is your login form, + since Symfony's Security component handles this for you. + Create a Form for the Model --------------------------- @@ -346,3 +362,5 @@ That's it! Your form now validates, and allows you to save the ``User`` object to the database. The extra ``terms`` checkbox on the ``Registration`` model class is used during validation, but not actually used afterwards when saving the User to the database. + +.. _`CVE-2013-5750`: http://symfony.com/blog/cve-2013-5750-security-issue-in-fosuserbundle-login-form From 3afb275aa0ece8004dd8819849404e6bf678e457 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 11 Sep 2013 17:51:27 +0200 Subject: [PATCH 0585/2078] fixing link to the templating docs --- book/http_fundamentals.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index 1654678bffc..e9e2195c674 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -531,9 +531,9 @@ regardless of how your project is developed. To name a few: PHP classes to be used without needing to manually ``require`` the files containing those classes; -* :doc:`Templating` A toolkit for rendering templates, - handling template inheritance (i.e. a template is decorated with a layout) - and performing other common template tasks; +* :doc:`Templating` A toolkit for rendering + templates, handling template inheritance (i.e. a template is decorated with + a layout) and performing other common template tasks; * `Security`_ - A powerful library for handling all types of security inside an application; From ae6f12b66d3e8ae309e84954617c0793c88c347b Mon Sep 17 00:00:00 2001 From: KatharinaSt Date: Wed, 11 Sep 2013 22:33:08 +0200 Subject: [PATCH 0586/2078] Update installation.rst Possible spelling mistake? --- book/installation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/installation.rst b/book/installation.rst index 698177d1c0e..a44845ef803 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -229,7 +229,7 @@ If there are any issues, correct them now before moving on. Many systems allow you to use the ``chmod +a`` command. Try this first, and if you get an error - try the next method. This uses a command to - try to determine your web server user and set is as ``APACHEUSER``: + try to determine your web server user and set it as ``APACHEUSER``: .. code-block:: bash From 55c34806787901a8bba5fdb2a5f544b0e1968f2a Mon Sep 17 00:00:00 2001 From: KatharinaSt Date: Wed, 11 Sep 2013 23:06:06 +0200 Subject: [PATCH 0587/2078] Update installation.rst Fixed typo at second position. --- book/installation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/installation.rst b/book/installation.rst index a44845ef803..eecd2da5b83 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -246,7 +246,7 @@ If there are any issues, correct them now before moving on. Some systems don't support ``chmod +a``, but do support another utility called ``setfacl``. You may need to `enable ACL support`_ on your partition and install setfacl before using it (as is the case with Ubuntu). This - uses a command to try to determine your web server user and set is as + uses a command to try to determine your web server user and set it as ``APACHEUSER``: .. code-block:: bash From b4dedd9c31fa270757357edc6fc7159f8e1b6cbe Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Thu, 26 Sep 2013 20:43:06 +0200 Subject: [PATCH 0588/2078] CS fixes --- components/dependency_injection/definitions.rst | 2 +- components/filesystem.rst | 4 ++-- cookbook/configuration/apache_router.rst | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/dependency_injection/definitions.rst b/components/dependency_injection/definitions.rst index 2b1dbac6d43..6c930edf95c 100644 --- a/components/dependency_injection/definitions.rst +++ b/components/dependency_injection/definitions.rst @@ -66,7 +66,7 @@ To get an array of the constructor arguments for a definition you can use:: or to get a single argument by its position:: $definition->getArgument($index); - //e.g. $definition->getArgument(0) for the first argument + // e.g. $definition->getArgument(0) for the first argument You can add a new argument to the end of the arguments array using:: diff --git a/components/filesystem.rst b/components/filesystem.rst index 5b1dc701217..44e010b88d1 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -178,9 +178,9 @@ Rename :method:`Symfony\\Component\\Filesystem\\Filesystem::rename` is used to rename files and directories:: - //rename a file + // rename a file $fs->rename('/tmp/processed_video.ogg', '/path/to/store/video_647.ogg'); - //rename a directory + // rename a directory $fs->rename('/tmp/files', '/path/to/store/files'); symlink diff --git a/cookbook/configuration/apache_router.rst b/cookbook/configuration/apache_router.rst index beac6121416..451596d3540 100644 --- a/cookbook/configuration/apache_router.rst +++ b/cookbook/configuration/apache_router.rst @@ -129,11 +129,11 @@ to ``ApacheRequest`` in ``web/app.php``:: require_once __DIR__.'/../app/bootstrap.php.cache'; require_once __DIR__.'/../app/AppKernel.php'; - //require_once __DIR__.'/../app/AppCache.php'; + // require_once __DIR__.'/../app/AppCache.php'; use Symfony\Component\HttpFoundation\ApacheRequest; $kernel = new AppKernel('prod', false); $kernel->loadClassCache(); - //$kernel = new AppCache($kernel); + // $kernel = new AppCache($kernel); $kernel->handle(ApacheRequest::createFromGlobals())->send(); From 8a8682f1d055992458239a0db21479542a8dd3d8 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 28 Sep 2013 17:51:13 -0500 Subject: [PATCH 0589/2078] [#2913] Minor tweaks to the built-out class loader component docs by @xabbuh --- book/performance.rst | 2 ++ .../class_loader/cache_class_loader.rst | 10 +++---- components/class_loader/class_loader.rst | 11 +++----- .../class_loader/debug_class_loader.rst | 13 +++++---- components/class_loader/introduction.rst | 18 ++++++++----- components/class_loader/map_class_loader.rst | 27 +++++++++---------- 6 files changed, 40 insertions(+), 41 deletions(-) diff --git a/book/performance.rst b/book/performance.rst index 51c19f1b762..7ecc1da2937 100644 --- a/book/performance.rst +++ b/book/performance.rst @@ -88,6 +88,8 @@ as comments in this file:: // ... +For more details, see :doc:`/components/class_loader/cache_class_loader`. + .. note:: When using the APC autoloader, if you add new classes, they will be found diff --git a/components/class_loader/cache_class_loader.rst b/components/class_loader/cache_class_loader.rst index 550968c778d..dbce3ce1929 100644 --- a/components/class_loader/cache_class_loader.rst +++ b/components/class_loader/cache_class_loader.rst @@ -34,7 +34,7 @@ ApcClassLoader require_once '/path/to/src/Symfony/Component/ClassLoader/ApcClassLoader.php'; - // instance of a class that implements a findFile() method + // instance of a class that implements a findFile() method, like the ClassLoader $loader = ...; // my_prefix is the APC namespace prefix to use @@ -43,8 +43,7 @@ ApcClassLoader // register the cached class loader $cachedLoader->register(); - // eventually deactivate the non-cached loader if it was registered - // previously + // deactivate the original, non-cached loader if it was registered previously $loader->unregister(); XcacheClassLoader @@ -58,7 +57,7 @@ it is straightforward:: require_once '/path/to/src/Symfony/Component/ClassLoader/XcacheClassLoader.php'; - // instance of a class that implements a findFile() method + // instance of a class that implements a findFile() method, like the ClassLoader $loader = ...; // my_prefix is the XCache namespace @@ -67,8 +66,7 @@ it is straightforward:: // register the cached class loader $cachedLoader->register(); - // eventually deactivate the non-cached loader if it was registered - // previously + // deactivate the original, non-cached loader if it was registered previously $loader->unregister(); .. _APC: http://php.net/manual/en/book.apc.php diff --git a/components/class_loader/class_loader.rst b/components/class_loader/class_loader.rst index 390ef5161d8..c5f2d65b70d 100644 --- a/components/class_loader/class_loader.rst +++ b/components/class_loader/class_loader.rst @@ -4,13 +4,10 @@ The PSR-0 Class Loader ====================== -Introduction ------------- - .. versionadded:: 2.1 The ``ClassLoader`` class was added in Symfony 2.1. -If your classes and third-party libraries follow the `PSR-0`_ standards, you +If your classes and third-party libraries follow the `PSR-0`_ standard, you can use the :class:`Symfony\\Component\\ClassLoader\\ClassLoader` class to load all of your project's classes. @@ -79,9 +76,9 @@ projects:: In this example, if you try to use a class in the ``Doctrine\Common`` namespace or one of its children, the autoloader will first look for the class under the -``doctrine-common`` directory, and it will then fallback to the default -``Doctrine`` directory (the last one configured) if not found, before giving up. -The order of the registrations is significant in this case. +``doctrine-common`` directory. If not found, it will then fallback to the default +``Doctrine`` directory (the last one configured) before giving up. The order +of the prefix registrations is significant in this case. .. _PEAR: http://pear.php.net/manual/en/standards.naming.php .. _PSR-0: http://symfony.com/PSR0 diff --git a/components/class_loader/debug_class_loader.rst b/components/class_loader/debug_class_loader.rst index c861afcc7d4..2af2e158401 100644 --- a/components/class_loader/debug_class_loader.rst +++ b/components/class_loader/debug_class_loader.rst @@ -7,14 +7,13 @@ Debugging a Class Loader .. versionadded:: 2.1 The ``DebugClassLoader`` class was added in Symfony 2.1. -When a class isn't found by the registered autoloaders you can use the -:class:`Symfony\\Component\\ClassLoader\\DebugClassLoader`. All autoloaders -which implement a ``findFile()`` method are replaced with a ``DebugClassLoader`` -wrapper. It throws an exception if a file is found but does not declare the -class. +The :class:`Symfony\\Component\\ClassLoader\\DebugClassLoader` attempts to +throw more helpful exceptions when a class isn't found by the registered +autoloaders. All autoloaders that implement a ``findFile()`` method are replaced +with a ``DebugClassLoader`` wrapper. -Using the ``DebugClassLoader`` is as easy as calling its static :method:`DebugClassLoader::enable` -method:: +Using the ``DebugClassLoader`` is as easy as calling its static +:method:`Symfony\\Component\\ClassLoader\\DebugClassLoader::enable` method:: use Symfony\Component\ClassLoader\DebugClassLoader; diff --git a/components/class_loader/introduction.rst b/components/class_loader/introduction.rst index 0f905e7a228..c115d05b709 100644 --- a/components/class_loader/introduction.rst +++ b/components/class_loader/introduction.rst @@ -4,18 +4,21 @@ The Class Loader Component ========================== - The Class Loader Component provides tools to load and cache your project - classes automatically. + The Class Loader Component provides tools to autoload your classes and + cache their locations for performance. Usage ----- -Whenever you use an undefined class, PHP uses the autoloading mechanism to -delegate the loading of a file defining the class. Symfony2 provides two -autoloaders, which are able to load your classes: +Whenever you reference a class that has not been required or included yet, +PHP uses the `autoloading mechanism`_ to delegate the loading of a file defining +the class. Symfony2 provides two autoloaders, which are able to load your classes: -* :doc:`A PSR-0 class loader ` -* :doc:`Load classes based on class-to-file mapping ` +* :doc:`/components/class_loader/class_loader`: loads classes that follow + the `PSR-0` class naming standard; + +* :doc:`/components/class_loader/map_class_loader`: loads classes using + a static map from class name to file path. Additionally, the Symfony Class Loader Component ships with a set of wrapper classes which can be used to add additional functionality on top of existing @@ -33,4 +36,5 @@ You can install the component in 2 different ways: * :doc:`Install it via Composer ` (``symfony/class-loader`` on `Packagist`_). +.. _`autoloading mechanism`: http://php.net/manual/en/language.oop5.autoload.php .. _Packagist: https://packagist.org/packages/symfony/class-loader diff --git a/components/class_loader/map_class_loader.rst b/components/class_loader/map_class_loader.rst index 12b1791e9bd..3304e4b7baf 100644 --- a/components/class_loader/map_class_loader.rst +++ b/components/class_loader/map_class_loader.rst @@ -4,14 +4,20 @@ MapClassLoader ============== -Introduction ------------- +The :class:`Symfony\\Component\\ClassLoader\\MapClassLoader` allows you to +autoload files via a static map from classes to files. This is useful if you +use third-party libraries which don't follow the `PSR-0`_ standards and so +can't use the :doc:`PSR-0 class loader `. -Additionally to any dynamic class loader (like the -:doc:`PSR-0 class loader `) you can use -the :class:`Symfony\\Component\\ClassLoader\\MapClassLoader` to statically map -classes to files. This is useful if you use third-party libraries which don't -follow the `PSR-0`_ standards. +The ``MapClassLoader`` can be used along with the :doc:`PSR-0 class loader ` +by configuring and calling the ``register()`` method on both. + +.. note:: + + The default behavior is to append the ``MapClassLoader`` on the autoload + stack. If you want to use it as the first autoloader, pass ``true`` when + calling the ``register()`` method. Your class loader will then be prepended + on the autoload stack. Usage ----- @@ -29,12 +35,5 @@ an instance of the ``MapClassLoader`` class:: $loader = new MapClassLoader($mapping); $loader->register(); - -.. note:: - - The default behavior is to append the ``MapClassLoader`` on the autoload - stack. If you want to use it as the default autoloader, pass ``true`` - when calling the ``register()`` method. Your class loader will then be - prepended on the autoload stack. .. _PSR-0: http://symfony.com/PSR0 From 03c73e9eccf5a2ed219f2d21c4e1ae7d78ebc2e6 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Tue, 3 Sep 2013 08:50:25 +0200 Subject: [PATCH 0590/2078] Added hint about modifying an unmapped form field --- book/forms.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/book/forms.rst b/book/forms.rst index 3cdae81abe8..31e81d7a8a1 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -897,6 +897,10 @@ the choice is ultimately up to you. The field data can be accessed in a controller with:: $form->get('dueDate')->getData(); + + In addition the data of a unmapped field can also directly be modified :: + + $form->get('dueDate')->setData('dueDate'); Defining your Forms as Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From c0630efd10430cabdf686536bd9b2986b52861d1 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Tue, 3 Sep 2013 11:43:57 +0200 Subject: [PATCH 0591/2078] Fixed typos --- book/forms.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/forms.rst b/book/forms.rst index 31e81d7a8a1..c05f00203ea 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -898,7 +898,7 @@ the choice is ultimately up to you. $form->get('dueDate')->getData(); - In addition the data of a unmapped field can also directly be modified :: + In addition, the data of an unmapped field can also directly be modified:: $form->get('dueDate')->setData('dueDate'); From d215b67d51e03553fc78abe7ed2e81961c3cb418 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Tue, 3 Sep 2013 16:14:27 +0200 Subject: [PATCH 0592/2078] Updated typo --- book/forms.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/forms.rst b/book/forms.rst index c05f00203ea..3fc38ad7fbb 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -898,7 +898,7 @@ the choice is ultimately up to you. $form->get('dueDate')->getData(); - In addition, the data of an unmapped field can also directly be modified:: + In addition, the data of an unmapped field can also be modified directly:: $form->get('dueDate')->setData('dueDate'); From 0587776465b4a7e2520c71305fa11510d5673a85 Mon Sep 17 00:00:00 2001 From: peterrehm Date: Thu, 19 Sep 2013 00:03:52 +0200 Subject: [PATCH 0593/2078] Updated parameter --- book/forms.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/forms.rst b/book/forms.rst index 3fc38ad7fbb..25cd8afa9d4 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -900,7 +900,7 @@ the choice is ultimately up to you. In addition, the data of an unmapped field can also be modified directly:: - $form->get('dueDate')->setData('dueDate'); + $form->get('dueDate')->setData(new \DateTime()); Defining your Forms as Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 94a704220688fdd2aab3988af1a17470dc68fcc6 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 1 Oct 2013 12:37:13 -0400 Subject: [PATCH 0594/2078] [#2949] Trimming whitespace --- book/forms.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/forms.rst b/book/forms.rst index 25cd8afa9d4..0abae855398 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -900,7 +900,7 @@ the choice is ultimately up to you. In addition, the data of an unmapped field can also be modified directly:: - $form->get('dueDate')->setData(new \DateTime()); + $form->get('dueDate')->setData(new \DateTime()); Defining your Forms as Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 1b874cee8a8d62b86c4b91ab236810650213b7eb Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 2 Oct 2013 18:14:43 -0400 Subject: [PATCH 0595/2078] [#2975] Taking the talk about the HTML date field further by updating default values and tweaking related details --- reference/forms/types/options/date_format.rst.inc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/reference/forms/types/options/date_format.rst.inc b/reference/forms/types/options/date_format.rst.inc index 60e0e070c70..cb633073a39 100644 --- a/reference/forms/types/options/date_format.rst.inc +++ b/reference/forms/types/options/date_format.rst.inc @@ -1,7 +1,7 @@ format ~~~~~~ -**type**: ``integer`` or ``string`` **default**: ``IntlDateFormatter::MEDIUM`` +**type**: ``integer`` or ``string`` **default**: `IntlDateFormatter::MEDIUM`_ (or ``yyyy-MM-dd`` if `widget`_ is ``single_text``) Option passed to the ``IntlDateFormatter`` class, used to transform user input into the proper format. This is critical when the `widget`_ option is @@ -10,13 +10,19 @@ By default, the format is determined based on the current user locale: meaning that *the expected format will be different for different users*. You can override it by passing the format as a string. -For more information on valid formats, see `Date/Time Format Syntax`_. For -example, to render a single text box that expects the user to enter ``yyyy-MM-dd``, -use the following options:: +For more information on valid formats, see `Date/Time Format Syntax`_:: $builder->add('date_created', 'date', array( 'widget' => 'single_text', + // this is actually the default format for single_text 'format' => 'yyyy-MM-dd', )); +.. note:: + + If you want your field to be rendered as an HTML5 "date" field, you have + use a ``single_text`` widget with the ``yyyy-MM-dd`` format (the `RFC 3339`_ + format) which is the default value if you use the ``single_text`` widget. + .. _`Date/Time Format Syntax`: http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax +.. _`IntlDateFormatter::MEDIUM`: http://www.php.net/manual/en/class.intldateformatter.php#intl.intldateformatter-constants \ No newline at end of file From 933de7f0b99b6877ac1a40a41c6107b4171d5299 Mon Sep 17 00:00:00 2001 From: Luis Cordova Date: Sun, 15 Sep 2013 02:10:11 -0500 Subject: [PATCH 0596/2078] clarifies that resolve() does return a plain array of options --- components/options_resolver.rst | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/components/options_resolver.rst b/components/options_resolver.rst index 912acf96798..001b7b51349 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -50,10 +50,7 @@ The advantages of doing this will become more obvious as you continue:: $this->options = $resolver->resolve($options); } -The ``$options`` property is an instance of -:class:`Symfony\\Component\\OptionsResolver\\Options`, which implements -:phpclass:`ArrayAccess`, :phpclass:`Iterator` and :phpclass:`Countable`. That -means you can handle it just like a normal array:: +The options property now is a well defined array with all resolved options readily available:: // ... public function getHost() @@ -76,8 +73,6 @@ Now, try to actually use the class:: 'password' => 'pa$$word', )); - echo $mailer->getPassword(); - Right now, you'll receive a :class:`Symfony\\Component\\OptionsResolver\\Exception\\InvalidOptionsException`, which tells you that the options ``host`` and ``password`` do not exist. From a73bc772e54616c908189e4a8f269f3260138762 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Wed, 18 Sep 2013 10:18:15 +0100 Subject: [PATCH 0597/2078] make the advantage and disadvantage of the ACL more clear For me as a SF2 developer to handle data manipulation was pretty new to me. So I asked in the irc and searched the web and finally landed on this documentation page. So it looked like this is the way to go and it is a usual thing like using bundles in SF2. But it isnt, it is a far more complex permission handler which will work upfront and is not that much flexible. I would highly recommend to add at least some notes, so that other developers getting a note on that and can maybe save some days of work as the opposite of me. --- cookbook/security/acl.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cookbook/security/acl.rst b/cookbook/security/acl.rst index dfe4af27ff0..3cbc9816775 100644 --- a/cookbook/security/acl.rst +++ b/cookbook/security/acl.rst @@ -216,3 +216,16 @@ added above: The user is now allowed to view, edit, delete, and un-delete objects. .. _`MongoDBAclBundle`: https://github.com/IamPersistent/MongoDBAclBundle + +Looking for alternatives +------------------------ + +For more simple use cases this seems to be an overhead for many developer. +As a downside there is that in case you change the permissions in any way, +you need to change all the existing granted permissions as well. As well +when you want to change a specific part of the ACL you need to understand +the structure and process of this complex voter. So you should consider if +a classical and simple conditional permission check would fit for you. +Some do it with the existing voter structure as well, or custom build solutions. + +.. _`Voters`: http://symfony.com/doc/current/cookbook/security/voters.html From 3fb6353015dc3219708e016bb3ea9f427c3291c6 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Wed, 18 Sep 2013 13:04:40 +0100 Subject: [PATCH 0598/2078] added xabbuh corrections --- cookbook/security/acl.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/security/acl.rst b/cookbook/security/acl.rst index 3cbc9816775..0a5aa3f1a5c 100644 --- a/cookbook/security/acl.rst +++ b/cookbook/security/acl.rst @@ -217,10 +217,10 @@ The user is now allowed to view, edit, delete, and un-delete objects. .. _`MongoDBAclBundle`: https://github.com/IamPersistent/MongoDBAclBundle -Looking for alternatives +Looking for Alternatives ------------------------ -For more simple use cases this seems to be an overhead for many developer. +For more simple use cases this seems to be an overhead for many developers. As a downside there is that in case you change the permissions in any way, you need to change all the existing granted permissions as well. As well when you want to change a specific part of the ACL you need to understand From 3324e1c335aaf6e7dd61b2160d23a1bf3ec1e369 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Wed, 18 Sep 2013 13:44:27 +0100 Subject: [PATCH 0599/2078] =?UTF-8?q?added=20stof=C2=B4s=20corrections?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cookbook/security/acl.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cookbook/security/acl.rst b/cookbook/security/acl.rst index 0a5aa3f1a5c..461f799fb13 100644 --- a/cookbook/security/acl.rst +++ b/cookbook/security/acl.rst @@ -215,8 +215,6 @@ added above: The user is now allowed to view, edit, delete, and un-delete objects. -.. _`MongoDBAclBundle`: https://github.com/IamPersistent/MongoDBAclBundle - Looking for Alternatives ------------------------ @@ -226,6 +224,7 @@ you need to change all the existing granted permissions as well. As well when you want to change a specific part of the ACL you need to understand the structure and process of this complex voter. So you should consider if a classical and simple conditional permission check would fit for you. -Some do it with the existing voter structure as well, or custom build solutions. +Some do it with the existing voter ":doc:`/cookbook/security/voters`" +structure as well, or a custom build solutions. -.. _`Voters`: http://symfony.com/doc/current/cookbook/security/voters.html +.. _`MongoDBAclBundle`: https://github.com/IamPersistent/MongoDBAclBundle From 74897e35500acfe84d3c456254ad0c142766ee4c Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 2 Oct 2013 18:42:51 -0400 Subject: [PATCH 0600/2078] [#2989] Moving the message about ACL alternatives higher up and furthering the message --- cookbook/security/acl.rst | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/cookbook/security/acl.rst b/cookbook/security/acl.rst index 461f799fb13..3d889bd6d74 100644 --- a/cookbook/security/acl.rst +++ b/cookbook/security/acl.rst @@ -9,6 +9,17 @@ cannot only be based on the person (``Token``) who is requesting access, but also involve a domain object that access is being requested for. This is where the ACL system comes in. +.. sidebar:: Alternatives to ACLS + + Using ACL's isn't trivial, and for simpler use cases, it may be overkill. + If your permission logic could be described by just writing some code (e.g. + to check if a Blog is owned by the current User), then consider using + :doc:`voters `. A voter is passed the object + being voted on, which you can use to make complex decisions and effectively + implement your own ACL. Enforcing authorization (e.g. the ``isGranted`` + part) will look similar to what you see in this entry, but your voter + class will handle the logic behind the scenes, instead of the ACL system. + Imagine you are designing a blog system where your users can comment on your posts. Now, you want a user to be able to edit his own comments, but not those of other users; besides, you yourself want to be able to edit all comments. In @@ -215,16 +226,4 @@ added above: The user is now allowed to view, edit, delete, and un-delete objects. -Looking for Alternatives ------------------------- - -For more simple use cases this seems to be an overhead for many developers. -As a downside there is that in case you change the permissions in any way, -you need to change all the existing granted permissions as well. As well -when you want to change a specific part of the ACL you need to understand -the structure and process of this complex voter. So you should consider if -a classical and simple conditional permission check would fit for you. -Some do it with the existing voter ":doc:`/cookbook/security/voters`" -structure as well, or a custom build solutions. - .. _`MongoDBAclBundle`: https://github.com/IamPersistent/MongoDBAclBundle From cc9bccd3cbaaec6bdd24de96f715209f9de53c4d Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 2 Oct 2013 18:49:30 -0400 Subject: [PATCH 0601/2078] [#2975] Removing duplicate note --- reference/forms/types/date.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index 492dc6aa79b..f214a1d6f38 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -114,13 +114,6 @@ Alternatively, you can specify a string to be displayed for the "blank" value:: .. include:: /reference/forms/types/options/date_format.rst.inc -.. note:: - - If you want your field to be rendered as a HTML5 date field, you have to use - a ``single_text`` widget and the ``yyyy-MM-dd`` format (the `RFC 3339`_ format) - which is the default format if you use the ``single_text`` widget and don't - specify any other format. - .. include:: /reference/forms/types/options/data_timezone.rst.inc .. include:: /reference/forms/types/options/user_timezone.rst.inc From e97e861551f44f6153c1a13f4ecd5b392ec1cb5c Mon Sep 17 00:00:00 2001 From: Nicolas Bastien Date: Thu, 3 Oct 2013 14:34:58 +0200 Subject: [PATCH 0602/2078] [Doc] add link to Varnish website --- cookbook/cache/varnish.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index fa2170304f9..f2180230be3 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -6,7 +6,7 @@ How to use Varnish to speed up my Website Because Symfony2's cache uses the standard HTTP cache headers, the :ref:`symfony-gateway-cache` can easily be replaced with any other reverse -proxy. Varnish is a powerful, open-source, HTTP accelerator capable of serving +proxy. `Varnish`_ is a powerful, open-source, HTTP accelerator capable of serving cached content quickly and including support for :ref:`Edge Side Includes`. @@ -207,5 +207,6 @@ absolute URLs: in the Symfony configuration so that Varnish is seen as a trusted proxy and the ``X-Forwarded-`` headers are used. +.. _`Varnish`: https://www.varnish-cache.org .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch .. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html From a7da13a67b99eaec031fa3c20823e80160277dbc Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 4 Oct 2013 19:23:10 +0200 Subject: [PATCH 0603/2078] fix build errors --- components/debug.rst | 4 ++-- components/intl.rst | 5 +++-- cookbook/form/dynamic_form_modification.rst | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/debug.rst b/components/debug.rst index a718ba6ee74..ac7e3a1948a 100644 --- a/components/debug.rst +++ b/components/debug.rst @@ -31,8 +31,8 @@ Enabling them all is as easy as it can get:: The :method:`Symfony\\Component\\Debug\\Debug::enable` method registers an error handler and an exception handler. If the :doc:`ClassLoader component -` is available, a special class loader is also -registered. +` is available, a special class loader +is also registered. Read the following sections for more information about the different available tools. diff --git a/components/intl.rst b/components/intl.rst index 8bc29c168c5..a335f3a98b3 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -51,8 +51,9 @@ replace the intl classes: Composer automatically exposes these classes in the global namespace. If you don't use Composer but the -:doc:`Symfony ClassLoader component`, you need to -expose them manually by adding the following lines to your autoload code:: +:doc:`Symfony ClassLoader component `, +you need to expose them manually by adding the following lines to your autoload +code:: if (!function_exists('intl_is_failure')) { require '/path/to/Icu/Resources/stubs/functions.php'; diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index 4154ed38eca..9bf7889e485 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -475,7 +475,7 @@ On a form, we can usually listen to the following events: below example uses. The key is to add a ``POST_SUBMIT`` listener to the field that your new field -depends on. If you add a ``POST_SUBMIT`` listener to a form child (e.g. ``sport`), +depends on. If you add a ``POST_SUBMIT`` listener to a form child (e.g. ``sport``), and add new children to the parent form, the Form component will detect the new field automatically and map it to the submitted client data. From de45033ea533b5203861251fb1536e8ba51ebe4e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 4 Oct 2013 19:47:28 +0200 Subject: [PATCH 0604/2078] remove blank line so that the versionadded directive is rendered properly --- cookbook/form/dynamic_form_modification.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/cookbook/form/dynamic_form_modification.rst b/cookbook/form/dynamic_form_modification.rst index ef6f1222975..4a0914d343f 100644 --- a/cookbook/form/dynamic_form_modification.rst +++ b/cookbook/form/dynamic_form_modification.rst @@ -466,7 +466,6 @@ On a form, we can usually listen to the following events: * ``POST_BIND`` .. versionadded:: 2.2.6 - The behavior of the ``POST_BIND`` event changed slightly in 2.2.6, which the below example uses. From 3eefa5039f4e30dc04e114986a20a0c07aba62d0 Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Sat, 5 Oct 2013 11:30:51 +0200 Subject: [PATCH 0605/2078] fix bash command display in components/console/usage --- components/console/usage.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/console/usage.rst b/components/console/usage.rst index 1a73c276ab5..f807d784b64 100755 --- a/components/console/usage.rst +++ b/components/console/usage.rst @@ -80,6 +80,8 @@ with: The verbose flag can optionally take a value between 1 (default) and 3 to output even more verbose messages: +.. code-block:: bash + $ php app/console list --verbose=2 $ php app/console list -vv $ php app/console list --verbose=3 From 1935975b32995d3252b6d741cc4888ab1cbdf607 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 5 Oct 2013 09:24:40 -0400 Subject: [PATCH 0606/2078] [#2990] Minor tweaks to new validation overriding instructions --- cookbook/bundles/override.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/bundles/override.rst b/cookbook/bundles/override.rst index 094e2f6b5b6..341e514ce6c 100644 --- a/cookbook/bundles/override.rst +++ b/cookbook/bundles/override.rst @@ -124,9 +124,9 @@ Validation metadata Symfony loads all validation configuration files from every bundle and combines them into one validation metadata tree. This means you are able to -add new constraints to a property, but you cannot override it. +add new constraints to a property, but you cannot override them. -To override this, the 3th party bundle needs to have configuration for +To override this, the 3rd party bundle needs to have configuration for :ref:`validation groups `. For instance, the FOSUserBundle has this configuration. To create your own validation, add the constraints to a new validation group: From eda61573b890e36c040756a0e576c60ca688ccfb Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 5 Oct 2013 13:29:34 -0400 Subject: [PATCH 0607/2078] [#2996] Tweaks to adding spaces for RST formatting throughout the docs ... there were just some extra spaces, some links were on multiple lines (always), which should be corrected, and some tables got misformatted --- book/forms.rst | 10 ++--- book/http_fundamentals.rst | 2 +- book/page_creation.rst | 6 +-- book/testing.rst | 2 +- components/http_kernel/introduction.rst | 2 +- components/templating/helpers/slotshelper.rst | 7 ++-- contributing/documentation/format.rst | 2 +- contributing/documentation/standards.rst | 2 +- cookbook/bundles/best_practices.rst | 12 +++--- cookbook/bundles/extension.rst | 3 +- cookbook/cache/varnish.rst | 3 +- reference/constraints/Image.rst | 38 +++++++++---------- reference/forms/types/email.rst | 2 +- reference/forms/types/search.rst | 2 +- reference/twig_reference.rst | 18 ++++----- 15 files changed, 55 insertions(+), 56 deletions(-) diff --git a/book/forms.rst b/book/forms.rst index cf77ce296c4..f15d9fac1bd 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -1688,11 +1688,11 @@ HTML form so that the user can modify that data. The second goal of a form is to take the data submitted by the user and to re-apply it to the object. There's still much more to learn about the powerful world of forms, such as -how to handle :doc:`file uploads with Doctrine - ` or how to create a form where a dynamic -number of sub-forms can be added (e.g. a todo list where you can keep adding -more fields via Javascript before submitting). See the cookbook for these -topics. Also, be sure to lean on the +how to handle +:doc:`file uploads with Doctrine ` or how +to create a form where a dynamic number of sub-forms can be added (e.g. a +todo list where you can keep adding more fields via Javascript before submitting). +See the cookbook for these topics. Also, be sure to lean on the :doc:`field type reference documentation `, which includes examples of how to use each field type and its options. diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index 28cba7126e5..902a5065b9e 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -479,7 +479,7 @@ specific PHP method ``contactAction`` inside a class called ``MainController``:: In this very simple example, the controller simply creates a :class:`Symfony\\Component\\HttpFoundation\\Response` object with the HTML -"``

Contact us!

"``. In the :doc:`controller chapter `, +``

Contact us!

``. In the :doc:`controller chapter `, you'll learn how a controller can render templates, allowing your "presentation" code (i.e. anything that actually writes out HTML) to live in a separate template file. This frees up the controller to worry only about the hard diff --git a/book/page_creation.rst b/book/page_creation.rst index 5b92fddada4..415ee3fba94 100644 --- a/book/page_creation.rst +++ b/book/page_creation.rst @@ -883,9 +883,9 @@ The extension alias (configuration key) can also be used: .. note:: - See the cookbook article: :doc:`How to expose a Semantic Configuration for - a Bundle ` for information on adding - configuration for your own bundle. + See the cookbook article: + :doc:`How to expose a Semantic Configuration for a Bundle ` + for information on adding configuration for your own bundle. .. index:: single: Environments; Introduction diff --git a/book/testing.rst b/book/testing.rst index 1f035eb73ac..bb102586c06 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -776,7 +776,7 @@ the installed third-party bundles: -To include other directories in the code coverage, also edit the `` `` +To include other directories in the code coverage, also edit the ```` section: .. code-block:: xml diff --git a/components/http_kernel/introduction.rst b/components/http_kernel/introduction.rst index 4d705242d2e..f8cea723364 100644 --- a/components/http_kernel/introduction.rst +++ b/components/http_kernel/introduction.rst @@ -428,7 +428,7 @@ Regardless of who creates the ``Response``, another event - ``kernel.response`` is dispatched directly afterwards. A typical listener to this event will modify the ``Response`` object in some way, such as modifying headers, adding cookies, or even changing the content of the ``Response`` itself (e.g. injecting some -JavaScript before the end `` `` tag of an HTML response). +JavaScript before the end ```` tag of an HTML response). After this event is dispatched, the final ``Response`` object is returned from :method:`Symfony\\Component\\HttpKernel\\HttpKernel::handle`. In the diff --git a/components/templating/helpers/slotshelper.rst b/components/templating/helpers/slotshelper.rst index 82be58a5db4..cd01977616f 100644 --- a/components/templating/helpers/slotshelper.rst +++ b/components/templating/helpers/slotshelper.rst @@ -53,10 +53,9 @@ Extending Templates The :method:`Symfony\\Component\\Templating\\PhpEngine::extend` method is called in the sub-template to set its parent template. Then -:method:`$view['slots']->set() - ` can be used to -set the content of a slot. All content which is not explicitly set in a slot -is in the ``_content`` slot. +:method:`$view['slots']->set() ` +can be used to set the content of a slot. All content which is not explicitly +set in a slot is in the ``_content`` slot. .. code-block:: html+php diff --git a/contributing/documentation/format.rst b/contributing/documentation/format.rst index b63094282af..8c5f15e4bd8 100644 --- a/contributing/documentation/format.rst +++ b/contributing/documentation/format.rst @@ -199,7 +199,7 @@ Installing the Sphinx extensions # add the extensions to the list of extensions extensions = [..., 'sensio.sphinx.refinclude', 'sensio.sphinx.configurationblock', 'sensio.sphinx.phpcode'] - # enable highlighting for PHP code not between `` `` by default + # enable highlighting for PHP code not between ```` by default lexers['php'] = PhpLexer(startinline=True) lexers['php-annotations'] = PhpLexer(startinline=True) lexers['php-standalone'] = PhpLexer(startinline=True) diff --git a/contributing/documentation/standards.rst b/contributing/documentation/standards.rst index f7ca59167aa..385e0999e4e 100644 --- a/contributing/documentation/standards.rst +++ b/contributing/documentation/standards.rst @@ -54,7 +54,7 @@ Code Examples correctly if it crosses the 85th character; * When you fold one or more lines of code, place ``...`` in a comment at the point of the fold. These comments are: ``// ...`` (php), ``# ...`` (yaml/bash), ``{# ... #}`` - (twig), `` `` (xml/html), ``; ...`` (ini), ``...`` (text); + (twig), ```` (xml/html), ``; ...`` (ini), ``...`` (text); * When you fold a part of a line, e.g. a variable value, put ``...`` (without comment) at the place of the fold; * Description of the folded code: (optional) diff --git a/cookbook/bundles/best_practices.rst b/cookbook/bundles/best_practices.rst index d0c029f50a2..237ae87c29e 100644 --- a/cookbook/bundles/best_practices.rst +++ b/cookbook/bundles/best_practices.rst @@ -142,8 +142,8 @@ instance, a ``HelloController`` controller is stored in ``Bundle/HelloBundle/Controller/HelloController.php`` and the fully qualified class name is ``Bundle\HelloBundle\Controller\HelloController``. -All classes and files must follow the Symfony2 coding :doc:`standards - `. +All classes and files must follow the Symfony2 coding +:doc:`standards `. Some classes should be seen as facades and should be as short as possible, like Commands, Helpers, Listeners, and Controllers. @@ -183,10 +183,10 @@ Documentation All classes and functions must come with full PHPDoc. -Extensive documentation should also be provided in the :doc:`reStructuredText - ` format, under the ``Resources/doc/`` -directory; the ``Resources/doc/index.rst`` file is the only mandatory file and -must be the entry point for the documentation. +Extensive documentation should also be provided in the +:doc:`reStructuredText ` format, under +the ``Resources/doc/`` directory; the ``Resources/doc/index.rst`` file is +the only mandatory file and must be the entry point for the documentation. Controllers ----------- diff --git a/cookbook/bundles/extension.rst b/cookbook/bundles/extension.rst index 23562abd067..27b733e85cf 100644 --- a/cookbook/bundles/extension.rst +++ b/cookbook/bundles/extension.rst @@ -493,7 +493,8 @@ configuration arrays together. The ``Configuration`` class can be much more complicated than shown here, supporting array nodes, "prototype" nodes, advanced validation, XML-specific -normalization and advanced merging. You can read more about this in :doc:`the Config Component documentation `. +normalization and advanced merging. You can read more about this in +:doc:`the Config Component documentation `. You can also see it in action by checking out some of the core Configuration classes, such as the one from the `FrameworkBundle Configuration`_ or the `TwigBundle Configuration`_. diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index 64d8ab616c9..d21631c6150 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -7,8 +7,7 @@ How to use Varnish to speed up my Website Because Symfony2's cache uses the standard HTTP cache headers, the :ref:`symfony-gateway-cache` can easily be replaced with any other reverse proxy. Varnish is a powerful, open-source, HTTP accelerator capable of serving -cached content quickly and including support for :ref:`Edge Side -Includes `. +cached content quickly and including support for :ref:`Edge Side Includes `. .. index:: single: Varnish; configuration diff --git a/reference/constraints/Image.rst b/reference/constraints/Image.rst index 7492dfed500..844bfc35c4c 100644 --- a/reference/constraints/Image.rst +++ b/reference/constraints/Image.rst @@ -11,26 +11,26 @@ the width and height of the image. See the :doc:`File ` constraint for the bulk of the documentation on this constraint. -+----------------+----------------------------------------------------------------------+ -| Applies to | :ref:`property or method ` | -+----------------+----------------------------------------------------------------------+ -| Options | - `mimeTypes`_ | -| | - `minWidth`_ | -| | - `maxWidth`_ | -| | - `maxHeight`_ | -| | - `minHeight`_ | -| | - `mimeTypesMessage`_ | -| | - `sizeNotDetectedMessage`_ | -| | - `maxWidthMessage`_ | -| | - `minWidthMessage`_ | -| | - `maxHeightMessage`_ | -| | - `minHeightMessage`_ | ++----------------+-----------------------------------------------------------------------+ +| Applies to | :ref:`property or method ` | ++----------------+-----------------------------------------------------------------------+ +| Options | - `mimeTypes`_ | +| | - `minWidth`_ | +| | - `maxWidth`_ | +| | - `maxHeight`_ | +| | - `minHeight`_ | +| | - `mimeTypesMessage`_ | +| | - `sizeNotDetectedMessage`_ | +| | - `maxWidthMessage`_ | +| | - `minWidthMessage`_ | +| | - `maxHeightMessage`_ | +| | - `minHeightMessage`_ | | | - See :doc:`File ` for inherited options | -+----------------+----------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Validator\\Constraints\\File` | -+----------------+----------------------------------------------------------------------+ -| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\FileValidator` | -+----------------+----------------------------------------------------------------------+ ++----------------+-----------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Validator\\Constraints\\File` | ++----------------+-----------------------------------------------------------------------+ +| Validator | :class:`Symfony\\Component\\Validator\\Constraints\\FileValidator` | ++----------------+-----------------------------------------------------------------------+ Basic Usage ----------- diff --git a/reference/forms/types/email.rst b/reference/forms/types/email.rst index 7653aa8d5f9..24c67681d5f 100644 --- a/reference/forms/types/email.rst +++ b/reference/forms/types/email.rst @@ -5,7 +5,7 @@ email Field Type ================ The ``email`` field is a text field that is rendered using the HTML5 -`` `` tag. +```` tag. +-------------+---------------------------------------------------------------------+ | Rendered as | ``input`` ``email`` field (a text box) | diff --git a/reference/forms/types/search.rst b/reference/forms/types/search.rst index 038c50295c2..8bd0d53ad8d 100644 --- a/reference/forms/types/search.rst +++ b/reference/forms/types/search.rst @@ -4,7 +4,7 @@ search Field Type ================= -This renders an `` `` field, which is a text box with +This renders an ```` field, which is a text box with special functionality supported by some browsers. Read about the input search field at `DiveIntoHTML5.info`_ diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 88efb03223e..a53b4df25eb 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -50,22 +50,22 @@ Functions +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``form_enctype(view)`` | This will render the required ``enctype="multipart/form-data"`` attribute | | | if the form contains at least one file upload field, more information in | -| | in :ref:`the Twig Form reference `. | +| | in :ref:`the Twig Form reference `. | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``form_widget(view, variables = {})`` | This will render a complete form or a specific HTML widget of a field, | -| | more information in :ref:`the Twig Form reference `. | +| | more information in :ref:`the Twig Form reference `. | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``form_errors(view)`` | This will render any errors for the given field or the "global" errors, | -| | more information in :ref:`the Twig Form reference `. | +| | more information in :ref:`the Twig Form reference `. | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``form_label(view, label = null, variables = {})`` | This will render the label for the given field, more information in | -| | :ref:`the Twig Form reference `. | +| | :ref:`the Twig Form reference `. | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ -| ``form_row(view, variables = {})`` | This will render the row (the field's label, errors and widget) of the | -| | given field, more information in :ref:`the Twig Form reference `. | +| ``form_row(view, variables = {})`` | This will render the row (the field's label, errors and widget) of the given | +| | field, more information in :ref:`the Twig Form reference `. | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``form_rest(view, variables = {})`` | This will render all fields that have not yet been rendered, more | -| | information in :ref:`the Twig Form reference `. | +| | information in :ref:`the Twig Form reference `. | +----------------------------------------------------+--------------------------------------------------------------------------------------------+ | ``csrf_token(intention)`` | This will render a CSRF token. Use this function if you want CSRF protection without | | | creating a form | @@ -97,10 +97,10 @@ Filters +---------------------------------------------------------------------------------+-------------------------------------------------------------------+ | ``text|trans(arguments = {}, domain = 'messages', locale = null)`` | This will translate the text into the current language, more | | | information in . | -| | :ref:`Translation Filters `. | +| | :ref:`Translation Filters `. | +---------------------------------------------------------------------------------+-------------------------------------------------------------------+ | ``text|transchoice(count, arguments = {}, domain = 'messages', locale = null)`` | This will translate the text with pluralization, more information | -| | in :ref:`Translation Filters `. | +| | in :ref:`Translation Filters `. | +---------------------------------------------------------------------------------+-------------------------------------------------------------------+ | ``variable|yaml_encode(inline = 0)`` | This will transform the variable text into a YAML syntax. | +---------------------------------------------------------------------------------+-------------------------------------------------------------------+ From f3e5cff8694793622e3fc184a4b263d857ad4456 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 3 Oct 2013 19:51:13 +0200 Subject: [PATCH 0608/2078] fix typo and move reference to the appropriate file --- reference/forms/types/date.rst | 2 -- reference/forms/types/options/date_format.rst.inc | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index 8297caf6f01..10f5d5467e8 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -151,5 +151,3 @@ These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/virtual.rst.inc .. include:: /reference/forms/types/options/error_mapping.rst.inc - -.. _`RFC 3339`: http://tools.ietf.org/html/rfc3339 diff --git a/reference/forms/types/options/date_format.rst.inc b/reference/forms/types/options/date_format.rst.inc index cb633073a39..d8a6c370825 100644 --- a/reference/forms/types/options/date_format.rst.inc +++ b/reference/forms/types/options/date_format.rst.inc @@ -20,9 +20,10 @@ For more information on valid formats, see `Date/Time Format Syntax`_:: .. note:: - If you want your field to be rendered as an HTML5 "date" field, you have + If you want your field to be rendered as an HTML5 "date" field, you have to use a ``single_text`` widget with the ``yyyy-MM-dd`` format (the `RFC 3339`_ format) which is the default value if you use the ``single_text`` widget. .. _`Date/Time Format Syntax`: http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax -.. _`IntlDateFormatter::MEDIUM`: http://www.php.net/manual/en/class.intldateformatter.php#intl.intldateformatter-constants \ No newline at end of file +.. _`IntlDateFormatter::MEDIUM`: http://www.php.net/manual/en/class.intldateformatter.php#intl.intldateformatter-constants +.. _`RFC 3339`: http://tools.ietf.org/html/rfc3339 From a35a315064de7e4f91146eedd7b0b9107d3fb64b Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 7 Oct 2013 07:36:57 -0400 Subject: [PATCH 0609/2078] [#2998] Very minor tweaks --- cookbook/form/form_customization.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index 6d7d0d3ca6a..ae26d1972e6 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -299,16 +299,16 @@ block from the new template and the ``input`` tag will be wrapped in the ``div`` element specified in the customized block. Child Forms -~~~~~~~~~~~ +........... -You can apply a form theme to a specific child of your form: +You can also apply a form theme to a specific child of your form: .. code-block:: html+jinja {% form_theme form.child 'AcmeDemoBundle:Form:fields.html.twig' %} -This is useful when you want to have a custom theme for a nested form different -than the one of your main form. Just specify both your themes: +This is useful when you want to have a custom theme for a nested form that's +different than the one of your main form. Just specify both your themes: .. code-block:: html+jinja From 79cc8df69ba5e51066efc599220db56138b7822e Mon Sep 17 00:00:00 2001 From: Uri Goldshtein Date: Thu, 19 Sep 2013 15:18:19 +0200 Subject: [PATCH 0610/2078] Change order of annotations to be the same as the gengerator | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | doctrine | Fixed tickets | --- book/doctrine.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/doctrine.rst b/book/doctrine.rst index a97d783864b..e7aa196d2d5 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -272,8 +272,8 @@ in a number of different formats including YAML, XML or directly inside the class Product { /** - * @ORM\Id * @ORM\Column(type="integer") + * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; From 5fa5d39fc1f0ac81ffb80b26691093c92766a4b6 Mon Sep 17 00:00:00 2001 From: Ulrich Date: Fri, 20 Sep 2013 20:11:42 +0200 Subject: [PATCH 0611/2078] Update unit_testing.rst Forget line addExtensions() in example. This line is in FormIntegrationTestCase class. If you don't add this you'll not be able to load additionnal FormType. --- cookbook/form/unit_testing.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/cookbook/form/unit_testing.rst b/cookbook/form/unit_testing.rst index c7e4d8993ca..68e4ee3bcea 100644 --- a/cookbook/form/unit_testing.rst +++ b/cookbook/form/unit_testing.rst @@ -176,6 +176,7 @@ on other extensions. You need add those extensions to the factory object:: parent::setUp(); $this->factory = Forms::createFormFactoryBuilder() + ->addExtensions($this->getExtensions()) ->addTypeExtension( new FormTypeValidatorExtension( $this->getMock('Symfony\Component\Validator\ValidatorInterface') From ccd1dd48b17b34c60f1eba713891b781a30ea309 Mon Sep 17 00:00:00 2001 From: Maximilian Reichel Date: Tue, 24 Sep 2013 11:42:27 +0200 Subject: [PATCH 0612/2078] Update varnish.rst fixed missing semicolon --- cookbook/cache/varnish.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index d21631c6150..30a9306e05a 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -196,7 +196,7 @@ absolute URLs: if (req.http.X-Forwarded-Proto == "https" ) { set req.http.X-Forwarded-Port = "443"; } else { - set req.http.X-Forwarded-Port = "80" + set req.http.X-Forwarded-Port = "80"; } } From 6fc08e686427a8339751cb6929d4d9cf98750f0d Mon Sep 17 00:00:00 2001 From: David ALLIX Date: Tue, 24 Sep 2013 14:06:45 +0200 Subject: [PATCH 0613/2078] Create block_name.rst.inc --- reference/forms/types/options/block_name.rst.inc | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 reference/forms/types/options/block_name.rst.inc diff --git a/reference/forms/types/options/block_name.rst.inc b/reference/forms/types/options/block_name.rst.inc new file mode 100644 index 00000000000..79ce7620b7b --- /dev/null +++ b/reference/forms/types/options/block_name.rst.inc @@ -0,0 +1,7 @@ +block_name +~~~~~~~~~~~ + +**type**: ``string`` **default**: the form's name + +Allows you to override the block name used to render display. +Useful by example if have multiple instances of the same form with differents names and that you need to personalize its render. From be4d0e09a417fb934adce0473878c61822225318 Mon Sep 17 00:00:00 2001 From: David ALLIX Date: Tue, 24 Sep 2013 14:08:02 +0200 Subject: [PATCH 0614/2078] Add block_name entry to the list of form options --- reference/forms/types/form.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index 82282cae5e9..3cf320e8c4a 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -31,6 +31,8 @@ on all fields. .. include:: /reference/forms/types/options/translation_domain.rst.inc +.. include:: /reference/forms/types/options/block_name.rst.inc + virtual ------- From 237102b183a25510bf91c1650aaac204daca7f3c Mon Sep 17 00:00:00 2001 From: David ALLIX Date: Tue, 24 Sep 2013 15:07:39 +0200 Subject: [PATCH 0615/2078] Update block_name.rst.inc --- reference/forms/types/options/block_name.rst.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/options/block_name.rst.inc b/reference/forms/types/options/block_name.rst.inc index 79ce7620b7b..d43c9a6fb91 100644 --- a/reference/forms/types/options/block_name.rst.inc +++ b/reference/forms/types/options/block_name.rst.inc @@ -3,5 +3,6 @@ block_name **type**: ``string`` **default**: the form's name -Allows you to override the block name used to render display. -Useful by example if have multiple instances of the same form with differents names and that you need to personalize its render. +Allows you to override the block name used to render the form type. +Useful by example if you have multiple instances of the same form with +different names so that you need to personalize its rendering. From 23a89bb27b29d81dd87a8f522d373047ab726edf Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 7 Oct 2013 07:51:34 -0400 Subject: [PATCH 0616/2078] [#3008] Minor tweaks to block_name docs --- reference/forms/types/options/block_name.rst.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reference/forms/types/options/block_name.rst.inc b/reference/forms/types/options/block_name.rst.inc index d43c9a6fb91..4f11ba54f52 100644 --- a/reference/forms/types/options/block_name.rst.inc +++ b/reference/forms/types/options/block_name.rst.inc @@ -1,8 +1,8 @@ block_name ~~~~~~~~~~~ -**type**: ``string`` **default**: the form's name +**type**: ``string`` **default**: the form's name (see :ref:`Knowing which block to customize `) Allows you to override the block name used to render the form type. -Useful by example if you have multiple instances of the same form with -different names so that you need to personalize its rendering. +Useful for example if you have multiple instances of the same form and you +need to personalize the rendering of the forms individually. From e2a274fe1cc0117eea6a6f4e26b8042ce5f91281 Mon Sep 17 00:00:00 2001 From: Gilles Doge Date: Wed, 25 Sep 2013 11:50:25 +0200 Subject: [PATCH 0617/2078] Update hidden.rst typo in label link for inherited options type. --- reference/forms/types/hidden.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/forms/types/hidden.rst b/reference/forms/types/hidden.rst index ab27d4b8351..76c62f6cfaf 100644 --- a/reference/forms/types/hidden.rst +++ b/reference/forms/types/hidden.rst @@ -42,7 +42,7 @@ Pass errors to the root form, otherwise they will not be visible. Inherited Options ----------------- -These options inherit from the :doc:`date ` type: +These options inherit from the :doc:`field ` type: .. include:: /reference/forms/types/options/data.rst.inc From 4848f40b7de1463e40911bc2871d8990757d0097 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 7 Oct 2013 08:02:02 -0400 Subject: [PATCH 0618/2078] [#3010] Fixing more instances of using the wrong label in some links in form reference section --- reference/forms/types/birthday.rst | 2 +- reference/forms/types/checkbox.rst | 4 ++-- reference/forms/types/choice.rst | 4 ++-- reference/forms/types/collection.rst | 2 +- reference/forms/types/country.rst | 2 +- reference/forms/types/date.rst | 2 +- reference/forms/types/datetime.rst | 2 +- reference/forms/types/email.rst | 4 ++-- reference/forms/types/entity.rst | 2 +- reference/forms/types/file.rst | 2 +- reference/forms/types/hidden.rst | 4 ++-- reference/forms/types/integer.rst | 4 ++-- reference/forms/types/language.rst | 2 +- reference/forms/types/locale.rst | 2 +- reference/forms/types/money.rst | 4 ++-- reference/forms/types/number.rst | 4 ++-- reference/forms/types/password.rst | 2 +- reference/forms/types/percent.rst | 4 ++-- reference/forms/types/radio.rst | 4 ++-- reference/forms/types/repeated.rst | 4 ++-- reference/forms/types/search.rst | 2 +- reference/forms/types/text.rst | 4 ++-- reference/forms/types/textarea.rst | 4 ++-- reference/forms/types/time.rst | 2 +- reference/forms/types/timezone.rst | 2 +- reference/forms/types/url.rst | 2 +- 26 files changed, 38 insertions(+), 38 deletions(-) diff --git a/reference/forms/types/birthday.rst b/reference/forms/types/birthday.rst index 39f3beb6da0..ea5c9278719 100644 --- a/reference/forms/types/birthday.rst +++ b/reference/forms/types/birthday.rst @@ -74,7 +74,7 @@ These options inherit from the :doc:`date ` type: .. include:: /reference/forms/types/options/user_timezone.rst.inc -These options inherit from the :doc:`date ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/invalid_message.rst.inc diff --git a/reference/forms/types/checkbox.rst b/reference/forms/types/checkbox.rst index fa56992f3fd..08ee9e5f013 100644 --- a/reference/forms/types/checkbox.rst +++ b/reference/forms/types/checkbox.rst @@ -21,7 +21,7 @@ if the box is unchecked, the value will be set to false. | | - `error_mapping`_ | | | - `mapped`_ | +-------------+------------------------------------------------------------------------+ -| Parent type | :doc:`field ` | +| Parent type | :doc:`form ` | +-------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType` | +-------------+------------------------------------------------------------------------+ @@ -50,7 +50,7 @@ not affect the value that's set on your object. Inherited options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index 7e4a17bbbee..22c4342a028 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -31,7 +31,7 @@ option. | | - `by_reference`_ | | | - `empty_data`_ | +-------------+------------------------------------------------------------------------------+ -| Parent type | :doc:`form ` (if expanded), ``field`` otherwise | +| Parent type | :doc:`form ` | +-------------+------------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType` | +-------------+------------------------------------------------------------------------------+ @@ -110,7 +110,7 @@ can be created to supply the choices. Inherited options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/collection.rst b/reference/forms/types/collection.rst index 484e68dd2a4..c84ae478daf 100644 --- a/reference/forms/types/collection.rst +++ b/reference/forms/types/collection.rst @@ -339,7 +339,7 @@ replaced with the same value. Inherited options ----------------- -These options inherit from the :doc:`field ` type. +These options inherit from the :doc:`form ` type. Not all options are listed here - only the most applicable to this type: .. include:: /reference/forms/types/options/label.rst.inc diff --git a/reference/forms/types/country.rst b/reference/forms/types/country.rst index cbb83a3f6e4..3606aa12abe 100644 --- a/reference/forms/types/country.rst +++ b/reference/forms/types/country.rst @@ -71,7 +71,7 @@ These options inherit from the :doc:`choice ` typ .. include:: /reference/forms/types/options/error_mapping.rst.inc -These options inherit from the :doc:`date ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index 10f5d5467e8..fdc2f6dff10 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -136,7 +136,7 @@ error_bubbling Inherited options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/invalid_message.rst.inc diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst index 1f33c147b58..8db1145623a 100644 --- a/reference/forms/types/datetime.rst +++ b/reference/forms/types/datetime.rst @@ -109,7 +109,7 @@ for more details. Inherited options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/invalid_message.rst.inc diff --git a/reference/forms/types/email.rst b/reference/forms/types/email.rst index 24c67681d5f..fb6ca9a2868 100644 --- a/reference/forms/types/email.rst +++ b/reference/forms/types/email.rst @@ -20,7 +20,7 @@ The ``email`` field is a text field that is rendered using the HTML5 | | - `error_mapping`_ | | | - `mapped`_ | +-------------+---------------------------------------------------------------------+ -| Parent type | :doc:`field ` | +| Parent type | :doc:`form ` | +-------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\EmailType` | +-------------+---------------------------------------------------------------------+ @@ -28,7 +28,7 @@ The ``email`` field is a text field that is rendered using the HTML5 Inherited Options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/max_length.rst.inc diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index f52e92aa4b6..f74f736e61b 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -162,7 +162,7 @@ These options inherit from the :doc:`choice ` typ .. include:: /reference/forms/types/options/empty_value.rst.inc -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/file.rst b/reference/forms/types/file.rst index 7179ccdbd12..512befc9914 100644 --- a/reference/forms/types/file.rst +++ b/reference/forms/types/file.rst @@ -84,7 +84,7 @@ how to manage a file upload associated with a Doctrine entity. Inherited options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/hidden.rst b/reference/forms/types/hidden.rst index 76c62f6cfaf..8d3edc13e3d 100644 --- a/reference/forms/types/hidden.rst +++ b/reference/forms/types/hidden.rst @@ -17,7 +17,7 @@ The hidden type represents a hidden input field. | | - `mapped`_ | | | - `error_mapping`_ | +-------------+----------------------------------------------------------------------+ -| Parent type | :doc:`field ` | +| Parent type | :doc:`form ` | +-------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\HiddenType` | +-------------+----------------------------------------------------------------------+ @@ -42,7 +42,7 @@ Pass errors to the root form, otherwise they will not be visible. Inherited Options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/data.rst.inc diff --git a/reference/forms/types/integer.rst b/reference/forms/types/integer.rst index 109072e50d7..96aeb2cb755 100644 --- a/reference/forms/types/integer.rst +++ b/reference/forms/types/integer.rst @@ -29,7 +29,7 @@ integers. By default, all non-integer values (e.g. 6.78) will round down (e.g. 6 | | - `invalid_message_parameters`_ | | | - `mapped`_ | +-------------+-----------------------------------------------------------------------+ -| Parent type | :doc:`field ` | +| Parent type | :doc:`form ` | +-------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\IntegerType` | +-------------+-----------------------------------------------------------------------+ @@ -65,7 +65,7 @@ on the :class:`Symfony\\Component\\Form\\Extension\\Core\\DataTransformer\\Integ Inherited options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/language.rst b/reference/forms/types/language.rst index 4bce0a35ab3..aff96321266 100644 --- a/reference/forms/types/language.rst +++ b/reference/forms/types/language.rst @@ -72,7 +72,7 @@ These options inherit from the :doc:`choice ` typ .. include:: /reference/forms/types/options/error_mapping.rst.inc -These options inherit from the :doc:`date ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/locale.rst b/reference/forms/types/locale.rst index d8bb69d6d20..818515da8c4 100644 --- a/reference/forms/types/locale.rst +++ b/reference/forms/types/locale.rst @@ -74,7 +74,7 @@ These options inherit from the :doc:`choice ` typ .. include:: /reference/forms/types/options/error_mapping.rst.inc -These options inherit from the :doc:`date ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/money.rst b/reference/forms/types/money.rst index f7bac78ce2b..06dfdb7c2c1 100644 --- a/reference/forms/types/money.rst +++ b/reference/forms/types/money.rst @@ -29,7 +29,7 @@ how the input and output of the data is handled. | | - `invalid_message_parameters`_ | | | - `mapped`_ | +-------------+---------------------------------------------------------------------+ -| Parent type | :doc:`field ` | +| Parent type | :doc:`form ` | +-------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\MoneyType` | +-------------+---------------------------------------------------------------------+ @@ -83,7 +83,7 @@ to ``0``). Inherited Options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/number.rst b/reference/forms/types/number.rst index 15918d31993..29f793cd866 100644 --- a/reference/forms/types/number.rst +++ b/reference/forms/types/number.rst @@ -25,7 +25,7 @@ you want to use for your number. | | - `invalid_message_parameters`_ | | | - `mapped`_ | +-------------+----------------------------------------------------------------------+ -| Parent type | :doc:`field ` | +| Parent type | :doc:`form ` | +-------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\NumberType` | +-------------+----------------------------------------------------------------------+ @@ -73,7 +73,7 @@ option is a constant on the :class:`Symfony\\Component\\Form\\Extension\\Core\\D Inherited Options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/password.rst b/reference/forms/types/password.rst index 7c0243d2956..9a98554ed67 100644 --- a/reference/forms/types/password.rst +++ b/reference/forms/types/password.rst @@ -44,7 +44,7 @@ Put simply, if for some reason you want to render your password field Inherited Options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/max_length.rst.inc diff --git a/reference/forms/types/percent.rst b/reference/forms/types/percent.rst index 9ac7a2c4cfa..4073602351d 100644 --- a/reference/forms/types/percent.rst +++ b/reference/forms/types/percent.rst @@ -28,7 +28,7 @@ This field adds a percentage sign "``%``" after the input box. | | - `invalid_message_parameters`_ | | | - `mapped`_ | +-------------+-----------------------------------------------------------------------+ -| Parent type | :doc:`field ` | +| Parent type | :doc:`form ` | +-------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\PercentType` | +-------------+-----------------------------------------------------------------------+ @@ -67,7 +67,7 @@ places, use this option. Inherited Options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/radio.rst b/reference/forms/types/radio.rst index 634548ee76a..03ce555c018 100644 --- a/reference/forms/types/radio.rst +++ b/reference/forms/types/radio.rst @@ -25,7 +25,7 @@ If you want to have a Boolean field, use :doc:`checkbox ` | +| Parent type | :doc:`form ` | +-------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RadioType` | +-------------+---------------------------------------------------------------------+ @@ -44,7 +44,7 @@ not affect the value that's set on your object. Inherited Options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/repeated.rst b/reference/forms/types/repeated.rst index 75707b6f110..077dfff1890 100644 --- a/reference/forms/types/repeated.rst +++ b/reference/forms/types/repeated.rst @@ -27,7 +27,7 @@ accuracy. | | - `mapped`_ | | | - `error_mapping`_ | +-------------+------------------------------------------------------------------------+ -| Parent type | :doc:`field ` | +| Parent type | :doc:`form ` | +-------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RepeatedType` | +-------------+------------------------------------------------------------------------+ @@ -186,7 +186,7 @@ error_bubbling Inherited options ----------------- -These options inherit from the :doc:`date ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/invalid_message.rst.inc diff --git a/reference/forms/types/search.rst b/reference/forms/types/search.rst index 8bd0d53ad8d..38fadb4abb2 100644 --- a/reference/forms/types/search.rst +++ b/reference/forms/types/search.rst @@ -30,7 +30,7 @@ Read about the input search field at `DiveIntoHTML5.info`_ Inherited Options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/max_length.rst.inc diff --git a/reference/forms/types/text.rst b/reference/forms/types/text.rst index fb7a0466a6d..bd7465a6ac7 100644 --- a/reference/forms/types/text.rst +++ b/reference/forms/types/text.rst @@ -19,7 +19,7 @@ The text field represents the most basic input text field. | | - `error_mapping`_ | | | - `mapped`_ | +-------------+--------------------------------------------------------------------+ -| Parent type | :doc:`field ` | +| Parent type | :doc:`form ` | +-------------+--------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType` | +-------------+--------------------------------------------------------------------+ @@ -28,7 +28,7 @@ The text field represents the most basic input text field. Inherited Options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/max_length.rst.inc diff --git a/reference/forms/types/textarea.rst b/reference/forms/types/textarea.rst index 2e38c72f0f0..0b64c9205b5 100644 --- a/reference/forms/types/textarea.rst +++ b/reference/forms/types/textarea.rst @@ -19,7 +19,7 @@ Renders a ``textarea`` HTML element. | | - `error_mapping`_ | | | - `mapped`_ | +-------------+------------------------------------------------------------------------+ -| Parent type | :doc:`field ` | +| Parent type | :doc:`form ` | +-------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TextareaType` | +-------------+------------------------------------------------------------------------+ @@ -27,7 +27,7 @@ Renders a ``textarea`` HTML element. Inherited Options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/max_length.rst.inc diff --git a/reference/forms/types/time.rst b/reference/forms/types/time.rst index 3174197f9d2..594c5f51271 100644 --- a/reference/forms/types/time.rst +++ b/reference/forms/types/time.rst @@ -137,7 +137,7 @@ error_bubbling Inherited options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/invalid_message.rst.inc diff --git a/reference/forms/types/timezone.rst b/reference/forms/types/timezone.rst index 3806b3dc43d..d77baecdb3b 100644 --- a/reference/forms/types/timezone.rst +++ b/reference/forms/types/timezone.rst @@ -62,7 +62,7 @@ These options inherit from the :doc:`choice ` typ .. include:: /reference/forms/types/options/empty_value.rst.inc -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/required.rst.inc diff --git a/reference/forms/types/url.rst b/reference/forms/types/url.rst index 2802b715d1b..7f110ced035 100644 --- a/reference/forms/types/url.rst +++ b/reference/forms/types/url.rst @@ -43,7 +43,7 @@ the data is bound to the form. Inherited Options ----------------- -These options inherit from the :doc:`field ` type: +These options inherit from the :doc:`form ` type: .. include:: /reference/forms/types/options/max_length.rst.inc From 2176eb56e0a30de72a8ca5e6a4696cac10b6a914 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Mon, 7 Oct 2013 08:38:47 -0400 Subject: [PATCH 0619/2078] [#2989] Fix typo thanks to @xabbuh --- cookbook/security/acl.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/security/acl.rst b/cookbook/security/acl.rst index 3d889bd6d74..d6c473f6e0b 100644 --- a/cookbook/security/acl.rst +++ b/cookbook/security/acl.rst @@ -9,7 +9,7 @@ cannot only be based on the person (``Token``) who is requesting access, but also involve a domain object that access is being requested for. This is where the ACL system comes in. -.. sidebar:: Alternatives to ACLS +.. sidebar:: Alternatives to ACLs Using ACL's isn't trivial, and for simpler use cases, it may be overkill. If your permission logic could be described by just writing some code (e.g. From 5376c8ff02d05e2816214435cd6c3223c24d2087 Mon Sep 17 00:00:00 2001 From: dfyz-it Date: Tue, 8 Oct 2013 21:53:25 +0300 Subject: [PATCH 0620/2078] Update typo in use_empty_data.rst --- cookbook/form/use_empty_data.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/use_empty_data.rst b/cookbook/form/use_empty_data.rst index 2824d7a0e9b..1788160f117 100644 --- a/cookbook/form/use_empty_data.rst +++ b/cookbook/form/use_empty_data.rst @@ -7,7 +7,7 @@ How to configure Empty Data for a Form Class The ``empty_data`` option allows you to specify an empty data set for your form class. This empty data set would be used if you bind your form, but haven't called ``setData()`` on your form or passed in data when you created -you form. For example:: +your form. For example:: public function indexAction() { From a9f2613700048675f700620ef60d6cb372dbfff1 Mon Sep 17 00:00:00 2001 From: dfyz-it Date: Tue, 8 Oct 2013 22:17:27 +0300 Subject: [PATCH 0621/2078] Fixed typo in direct_submit.rst --- cookbook/form/direct_submit.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/form/direct_submit.rst b/cookbook/form/direct_submit.rst index f2472f0b7d1..e33d4e8b6bf 100644 --- a/cookbook/form/direct_submit.rst +++ b/cookbook/form/direct_submit.rst @@ -86,7 +86,7 @@ method, pass the submitted data directly to Passing a Request to Form::submit() (deprecated) ------------------------------------------------ -.. versionadded:: +.. versionadded:: 2.3 Before Symfony 2.3, the ``submit`` method was known as ``bind``. Before Symfony 2.3, the :method:`Symfony\Component\Form\FormInterface::submit` From adb5c750338667df326e7fc16912f401fd7413ef Mon Sep 17 00:00:00 2001 From: Jacob Dreesen Date: Thu, 26 Sep 2013 14:15:55 +0200 Subject: [PATCH 0622/2078] Update page_creation.rst small fix --- book/page_creation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/page_creation.rst b/book/page_creation.rst index 415ee3fba94..deb72e1cfb7 100644 --- a/book/page_creation.rst +++ b/book/page_creation.rst @@ -52,7 +52,7 @@ front controller that can be used with any environment.) When the front controller initializes the kernel, it provides two parameters: the environment, and also whether the kernel should run in debug mode. To make your application respond faster, Symfony2 maintains a cache under the -``app/cache/`` directory. When in debug mode is enabled (such as ``app_dev.php`` +``app/cache/`` directory. When debug mode is enabled (such as ``app_dev.php`` does by default), this cache is flushed automatically whenever you make changes to any code or configuration. When running in debug mode, Symfony2 runs slower, but your changes are reflected without having to manually clear the From d53e58f0d3211fe1bb8a46d5226d5aceadf33947 Mon Sep 17 00:00:00 2001 From: hanneskaeufler Date: Thu, 10 Oct 2013 13:29:35 +0200 Subject: [PATCH 0623/2078] Fix typo --- components/dependency_injection/parameters.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dependency_injection/parameters.rst b/components/dependency_injection/parameters.rst index a63b3ebd2aa..7f2259beb4d 100644 --- a/components/dependency_injection/parameters.rst +++ b/components/dependency_injection/parameters.rst @@ -275,7 +275,7 @@ key, and define the type as ``constant``. .. note:: - This does not works for Yaml configuration. If you're using Yaml, you can + This does not work for Yaml configuration. If you're using Yaml, you can import an XML file to take advantage of this functionality: .. configuration-block:: From 63133ef11469e3f6c98f7b9e4f98007e8c5da968 Mon Sep 17 00:00:00 2001 From: Andreia Bohner Date: Sun, 29 Sep 2013 23:44:45 -0300 Subject: [PATCH 0624/2078] Fix table name --- cookbook/security/entity_provider.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index 61b27ea4310..29768e8f541 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -670,7 +670,7 @@ this: .. code-block:: text - $ mysql> select * from acme_users; + $ mysql> select * from acme_role; +----+-------+------------+ | id | name | role | +----+-------+------------+ From 533330fa3d1361bc3c7ddb50d31db6a1f65a7a43 Mon Sep 17 00:00:00 2001 From: "Issei.M" Date: Wed, 2 Oct 2013 13:59:42 +0900 Subject: [PATCH 0625/2078] fix missing snippet, latest components version --- components/form/introduction.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/form/introduction.rst b/components/form/introduction.rst index c47bd3d0f01..2706897bfc8 100644 --- a/components/form/introduction.rst +++ b/components/form/introduction.rst @@ -146,14 +146,14 @@ component offers a rich integration. To use the integration, you'll need the ``TwigBridge``, which provides integration between Twig and several Symfony2 components. If you're using Composer, you -could install the latest 2.1 version by adding the following ``require`` +could install the latest 2.3 version by adding the following ``require`` line to your ``composer.json`` file: .. code-block:: json { "require": { - "symfony/twig-bridge": "2.1.*" + "symfony/twig-bridge": "2.3.*" } } @@ -222,15 +222,15 @@ via your own Twig extension. To use the built-in integration, be sure that your project has Symfony's ``Translation`` and :doc:`Config ` components -installed. If you're using Composer, you could get the latest 2.1 version +installed. If you're using Composer, you could get the latest 2.3 version of each of these by adding the following to your ``composer.json`` file: .. code-block:: json { "require": { - "symfony/translation": "2.1.*", - "symfony/config": "2.1.*" + "symfony/translation": "2.3.*", + "symfony/config": "2.3.*" } } @@ -274,13 +274,13 @@ array or object) and pass it through your own validation system. To use the integration with Symfony's Validator component, first make sure it's installed in your application. If you're using Composer and want to -install the latest 2.1 version, add this to your ``composer.json``: +install the latest 2.3 version, add this to your ``composer.json``: .. code-block:: json { "require": { - "symfony/validator": "2.1.*" + "symfony/validator": "2.3.*" } } From 36626bce41405ed9952bec792501e544a4a725b0 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 10 Oct 2013 07:49:43 -0400 Subject: [PATCH 0626/2078] [#3024] Backporting syntax fix thanks to @issei-m --- components/form/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/form/introduction.rst b/components/form/introduction.rst index c47bd3d0f01..813f70d93f9 100644 --- a/components/form/introduction.rst +++ b/components/form/introduction.rst @@ -557,7 +557,7 @@ If the request is a POST, process the submitted data (via ``bind``). Then: to ``bind``:: if (isset($_POST[$form->getName()])) { - $form->bind($_POST[$form->getName()) + $form->bind($_POST[$form->getName()]); // ... } From 51710110bcaf3d213aad1b2491bc59d745d6cd5d Mon Sep 17 00:00:00 2001 From: Mohsen Date: Wed, 2 Oct 2013 17:15:52 +0330 Subject: [PATCH 0627/2078] Update the_controller.rst "get" was intended not "set". --- quick_tour/the_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quick_tour/the_controller.rst b/quick_tour/the_controller.rst index 51a160204be..89c917e5ee8 100755 --- a/quick_tour/the_controller.rst +++ b/quick_tour/the_controller.rst @@ -131,7 +131,7 @@ from any controller:: $foo = $session->get('foo'); // use a default value if the key doesn't exist - $filters = $session->set('filters', array()); + $filters = $session->get('filters', array()); You can also store small messages that will only be available for the very next request:: From 40884b1e2ea3423c27ff8a6592d65d70c45aebd7 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 2 Oct 2013 17:31:56 +0200 Subject: [PATCH 0628/2078] remove wrong notice on locales in the session, add reference to the relevant cookbook article instead --- book/translation.rst | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/book/translation.rst b/book/translation.rst index f4faf08289f..bd0df9c77c7 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -520,15 +520,13 @@ via the ``request`` object:: $request->setLocale('en_US'); -.. index:: - single: Translations; Fallback and default locale - -It is also possible to store the locale in the session instead of on a per -request basis. If you do this, each subsequent request will have this locale. +.. tip:: -.. code-block:: php + Read :doc:`/cookbook/session/locale_sticky_session` to learn, how to store + the user's locale in the session. - $this->get('session')->set('_locale', 'en_US'); +.. index:: + single: Translations; Fallback and default locale See the :ref:`book-translation-locale-url` section below about setting the locale via routing. From 921a63b75fbe4144b28e811951e1d471075f472c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 4 Oct 2013 18:21:02 +0200 Subject: [PATCH 0629/2078] put back the command argument when executing a command in the CommandTester --- cookbook/console/console_command.rst | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cookbook/console/console_command.rst b/cookbook/console/console_command.rst index 83033761feb..fcd33d42419 100644 --- a/cookbook/console/console_command.rst +++ b/cookbook/console/console_command.rst @@ -105,10 +105,11 @@ instead of $command = $application->find('demo:greet'); $commandTester = new CommandTester($command); $commandTester->execute( - array( - 'name' => 'Fabien', - '--yell' => true, - ) + array( + 'command' => $command->getName(), + 'name' => 'Fabien', + '--yell' => true, + ) ); $this->assertRegExp('/.../', $commandTester->getDisplay()); @@ -145,10 +146,11 @@ you can extend your test from $command = $application->find('demo:greet'); $commandTester = new CommandTester($command); $commandTester->execute( - array( - 'name' => 'Fabien', - '--yell' => true, - ) + array( + 'command' => $command->getName(), + 'name' => 'Fabien', + '--yell' => true, + ) ); $this->assertRegExp('/.../', $commandTester->getDisplay()); From 8d08b1531ffe40f23ce1f72a0515e885249a46e4 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 7 Oct 2013 09:53:14 +0200 Subject: [PATCH 0630/2078] fixed missing syntax highlight on a table name. --- book/propel.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/propel.rst b/book/propel.rst index 4206a468a8a..3330b6216b2 100644 --- a/book/propel.rst +++ b/book/propel.rst @@ -397,7 +397,7 @@ Now, try the code in action. Imagine you're inside a controller:: } } -Now, a single row is added to both the ``category`` and product tables. The +Now, a single row is added to both the ``category`` and ``product`` tables. The ``product.category_id`` column for the new product is set to whatever the id is of the new category. Propel manages the persistence of this relationship for you. From 3de772b30a720200b2c97c1bbbe8f9a137c79818 Mon Sep 17 00:00:00 2001 From: Ivan Zugec Date: Tue, 8 Oct 2013 20:56:32 +0200 Subject: [PATCH 0631/2078] Changed slash to backslash in use statement. --- book/controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/controller.rst b/book/controller.rst index ff9206158c1..19fe515c5af 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -497,7 +497,7 @@ value to each variable. :ref:`sub request ` is executed via the ``http_kernel`` service the ``HttpKernel`` returns a ``Response`` object:: - use Symfony\Component\HttpKernel/HttpKernelInterface; + use Symfony\Component\HttpKernel\HttpKernelInterface; $path = array( '_controller' => 'AcmeHelloBundle:Hello:fancy', From 931aef231a53fe41483e8625b6c9f18b472ec810 Mon Sep 17 00:00:00 2001 From: Dirk Luijk Date: Wed, 16 Oct 2013 22:40:25 +0200 Subject: [PATCH 0632/2078] Improved code example about memory spooling --- cookbook/console/sending_emails.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cookbook/console/sending_emails.rst b/cookbook/console/sending_emails.rst index 60194fe5904..5b0a4af9a6f 100644 --- a/cookbook/console/sending_emails.rst +++ b/cookbook/console/sending_emails.rst @@ -100,8 +100,16 @@ commands, emails are not sent automatically. You must take care of flushing the queue yourself. Use the following code to send emails inside your console command:: + $message = new \Swift_Message(); + + // prepare the message... + $container = $this->getContainer(); $mailer = $container->get('mailer'); + + $mailer->send($message); + + // now manually flush the queue $spool = $mailer->getTransport()->getSpool(); $transport = $container->get('swiftmailer.transport.real'); From 5af7977acfb29c2abb4245d5e7a4c7cffa8a2bb7 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Thu, 17 Oct 2013 05:27:32 +0200 Subject: [PATCH 0633/2078] widget anchor fixed --- reference/forms/types/date.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index fdc2f6dff10..960da39ada4 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -12,7 +12,7 @@ a string, a timestamp or an array. As long as the `input`_ option is set correctly, the field will take care of all of the details. The field can be rendered as a single text box, three text boxes (month, -day, and year) or three select boxes (see the `widget_` option). +day, and year) or three select boxes (see the `widget`_ option). +----------------------+-----------------------------------------------------------------------------+ | Underlying Data Type | can be ``DateTime``, string, timestamp, or array (see the ``input`` option) | From 19a54b1d2a1ad19ba6f9ef6fbfcd6cd2772a7dc6 Mon Sep 17 00:00:00 2001 From: Janne Vuori Date: Thu, 17 Oct 2013 16:22:35 +0300 Subject: [PATCH 0634/2078] minor typo fix --- book/templating.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/templating.rst b/book/templating.rst index fc16b8c1c39..d255361caf0 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -688,8 +688,8 @@ tags: .. code-block:: jinja - {{ render_hinclude(controller('...')) %} - {{ render_hinclude(url('...')) %} + {{ render_hinclude(controller('...')) }} + {{ render_hinclude(url('...')) }} .. code-block:: php From 7c592472227b246235a923496dcbefc289fd3d23 Mon Sep 17 00:00:00 2001 From: Wouter J Date: Fri, 18 Oct 2013 11:56:29 +0200 Subject: [PATCH 0635/2078] Tries to clearify redirecting article --- cookbook/routing/redirect_in_config.rst | 179 ++++++++++++++++++++---- 1 file changed, 151 insertions(+), 28 deletions(-) diff --git a/cookbook/routing/redirect_in_config.rst b/cookbook/routing/redirect_in_config.rst index 4d6b7004e6e..cb37de745c9 100644 --- a/cookbook/routing/redirect_in_config.rst +++ b/cookbook/routing/redirect_in_config.rst @@ -1,40 +1,163 @@ .. index:: - single: Routing; Configure redirect to another route without a custom controller + single: Routing; Redirect using Framework:RedirectController -How to configure a redirect to another route without a custom controller -======================================================================== +How to Configure a Redirect Without a Custom Controller +======================================================= -This guide explains how to configure a redirect from one route to another -without using a custom controller. +Sometimes, a URL needs to redirect to another URL. You can do that by creating +a new controller action which only task is to redirect, but using the +:class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController` of +the FrameworkBundle, it's a lot easier. -Assume that there is no useful default controller for the ``/`` path of -your application and you want to redirect these requests to ``/app``. +You can redirect to a specific path (e.g. ``/about``) or to a specific route +using it's name (e.g. ``homepage``). -Your configuration will look like this: +Redirecting Using a Path +------------------------ -.. code-block:: yaml +Assume there is no default controller for the ``/`` path of your application +and you want to redirect these requests to ``/app``. You will need to use the +:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::urlRedirect` +action to redirect to this new url: - AppBundle: - resource: "@App/Controller/" - type: annotation - prefix: /app +.. configuration-block:: - root: - path: / - defaults: - _controller: FrameworkBundle:Redirect:urlRedirect - path: /app - permanent: true + .. code-block:: yaml -In this example, you configure a route for the ``/`` path and let :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController` -handle it. This controller comes standard with Symfony and offers two actions -for redirecting request: + # app/config/routing.yml -* ``urlRedirect`` redirects to another *path*. You must provide the ``path`` - parameter containing the path of the resource you want to redirect to. + # loading the App controllers + AppBundle: + resource: "@AcmeAppBundle/Controller/" + type: annotation + prefix: /app -* ``redirect`` (not shown here) redirects to another *route*. You must provide the ``route`` - parameter with the *name* of the route you want to redirect to. + # redirecting the root + root: + path: / + defaults: + _controller: FrameworkBundle:Redirect:urlRedirect + path: /app + permanent: true -The ``permanent`` switch tells both methods to issue a 301 HTTP status code -instead of the default ``302`` status code. + .. code-block:: xml + + + + + + + + + + + FrameworkBundle:Redirect:urlRedirect + /app + true + + + + .. code-block:: php + + // app/config/routing.php + use Symfony\Component\Routing\RouteCollection; + use Symfony\Component\Routing\Route; + + $collection = new RouteCollection(); + + // loading the App controllers + $acmeApp = $loader->import( + "@AcmeAppBundle/Controller/", + "annotation" + ); + $acmeApp->setPrefix('/app'); + + $collection->addCollection($acmeApp); + + // redirecting the root + $collection->add('root', new Route('/', array( + '_controller' => 'FrameworkBundle:Redirect:urlRedirect', + 'path' => '/app', + 'permanent' => true, + ))); + + return $collection; + +In this example, you configured a route for the ``/`` path and let the +``RedirectController`` handle it to redirect it to ``/app``. The ``permanent`` +switch tells the action to issue a ``301`` HTTP status code instead of the +default ``302`` HTTP status code. + +Redirecting Using a Route +------------------------- + +Assume you are migrating your website from WordPress to Symfony, you want to +redirect ``/wp-admin`` to the route ``sonata_admin_dashboard``. You don't know +the path, only the route name. This can be achieved using the +:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::redirect` +action: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/routing.yml + + # ... + + # redirecting the admin home + root: + path: /wp-admin + defaults: + _controller: FrameworkBundle:Redirect:redirect + route: sonata_admin_dashboard + permanent: true + + .. code-block:: xml + + + + + + + + + + FrameworkBundle:Redirect:redirect + sonata_admin_dashboard + true + + + + .. code-block:: php + + // app/config/routing.php + use Symfony\Component\Routing\RouteCollection; + use Symfony\Component\Routing\Route; + + $collection = new RouteCollection(); + // ... + + // redirecting the root + $collection->add('root', new Route('/wp-admin', array( + '_controller' => 'FrameworkBundle:Redirect:redirect', + 'route' => 'sonata_admin_dashboard', + 'permanent' => true, + ))); + + return $collection; + +.. caution:: + + Because you are redirecting to a route instead of a path, the required + option is called ``route`` in the ``redirect`` action, instead of ``path`` + in the ``urlRedirect`` action. From 1fc891892c63b77e16a944e6cf7307a15ff73bd5 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sat, 19 Oct 2013 15:34:34 +0700 Subject: [PATCH 0636/2078] fix wording : instantiate class, not instantiate object --- book/service_container.rst | 2 +- components/dependency_injection/factories.rst | 2 +- cookbook/form/use_empty_data.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/book/service_container.rst b/book/service_container.rst index 24526c7319b..f2ea4238053 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -670,7 +670,7 @@ Using references is a very powerful tool that allows you to create independent s classes with well-defined dependencies. In this example, the ``newsletter_manager`` service needs the ``my_mailer`` service in order to function. When you define this dependency in the service container, the container takes care of all -the work of instantiating the objects. +the work of instantiating the classes. Optional Dependencies: Setter Injection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/components/dependency_injection/factories.rst b/components/dependency_injection/factories.rst index 4f939b04527..70fcbd0142f 100644 --- a/components/dependency_injection/factories.rst +++ b/components/dependency_injection/factories.rst @@ -10,7 +10,7 @@ as well as calling methods and setting parameters. Sometimes, however, this will not provide you with everything you need to construct your objects. For this situation, you can use a factory to create the object and tell the service container to call a method on the factory rather than directly instantiating -the object. +the class. Suppose you have a factory that configures and returns a new NewsletterManager object:: diff --git a/cookbook/form/use_empty_data.rst b/cookbook/form/use_empty_data.rst index 2824d7a0e9b..5b28d7bb1cd 100644 --- a/cookbook/form/use_empty_data.rst +++ b/cookbook/form/use_empty_data.rst @@ -61,7 +61,7 @@ that constructor with no arguments:: You can instantiate your class however you want. In this example, we pass some dependency into the ``BlogType`` when we instantiate it, then use that -to instantiate the ``Blog`` object. The point is, you can set ``empty_data`` +to instantiate the ``Blog`` class. The point is, you can set ``empty_data`` to the exact "new" object that you want to use. Option 2: Provide a Closure From 21a1f60f1fe4843b50d31a466a52333b3c2bdbde Mon Sep 17 00:00:00 2001 From: Pascal Borreli Date: Sun, 20 Oct 2013 11:19:50 +0000 Subject: [PATCH 0637/2078] Fixed typo --- components/class_loader/cache_class_loader.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/class_loader/cache_class_loader.rst b/components/class_loader/cache_class_loader.rst index dbce3ce1929..eba12e844c7 100644 --- a/components/class_loader/cache_class_loader.rst +++ b/components/class_loader/cache_class_loader.rst @@ -13,7 +13,7 @@ Introduction Finding the file for a particular class can be an expensive task. Luckily, the Class Loader Component comes with two classes to cache the mapping -from a class to its containing file. Both the :class:`Symfonfy\\Component\\ClassLoader\\ApcClassLoader` +from a class to its containing file. Both the :class:`Symfony\\Component\\ClassLoader\\ApcClassLoader` and the :class:`Symfony\\Component\\ClassLoader\\XcacheClassLoader` wrap around an object which implements a ``findFile()`` method to find the file for a class. From 671c86ddd6ef21ee8a6bd0b8b60a00971fa3f48b Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Mon, 21 Oct 2013 07:45:19 +0200 Subject: [PATCH 0638/2078] javascript case sensitive typos --- book/forms.rst | 2 +- book/page_creation.rst | 2 +- book/templating.rst | 20 ++++++++++---------- components/css_selector.rst | 4 ++-- cookbook/assetic/apply_to_option.rst | 2 +- cookbook/assetic/uglifyjs.rst | 4 ++-- cookbook/assetic/yuicompressor.rst | 2 +- cookbook/controller/error_pages.rst | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/book/forms.rst b/book/forms.rst index f15d9fac1bd..77fdbfb6e80 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -1691,7 +1691,7 @@ There's still much more to learn about the powerful world of forms, such as how to handle :doc:`file uploads with Doctrine ` or how to create a form where a dynamic number of sub-forms can be added (e.g. a -todo list where you can keep adding more fields via Javascript before submitting). +todo list where you can keep adding more fields via JavaScript before submitting). See the cookbook for these topics. Also, be sure to lean on the :doc:`field type reference documentation `, which includes examples of how to use each field type and its options. diff --git a/book/page_creation.rst b/book/page_creation.rst index deb72e1cfb7..75867ee6645 100644 --- a/book/page_creation.rst +++ b/book/page_creation.rst @@ -95,7 +95,7 @@ inside a bundle. A bundle is nothing more than a directory that houses everything related to a specific feature, including PHP classes, configuration, and even stylesheets -and Javascript files (see :ref:`page-creation-bundles`). +and JavaScript files (see :ref:`page-creation-bundles`). To create a bundle called ``AcmeHelloBundle`` (a play bundle that you'll build in this chapter), run the following command and follow the on-screen diff --git a/book/templating.rst b/book/templating.rst index fc16b8c1c39..c1140c43c54 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -679,7 +679,7 @@ Asynchronous Content with hinclude.js .. versionadded:: 2.1 hinclude.js support was added in Symfony 2.1 -Controllers can be embedded asynchronously using the hinclude.js_ javascript library. +Controllers can be embedded asynchronously using the hinclude.js_ JavaScript library. As the embedded content comes from another page (or controller for that matter), Symfony2 uses a version of the standard ``render`` function to configure ``hinclude`` tags: @@ -744,7 +744,7 @@ tags: 'fragments' => array('path' => '/_fragment'), )); -Default content (while loading or if javascript is disabled) can be set globally +Default content (while loading or if JavaScript is disabled) can be set globally in your application configuration: .. configuration-block:: @@ -974,7 +974,7 @@ correctly: Linking to Assets ~~~~~~~~~~~~~~~~~ -Templates also commonly refer to images, Javascript, stylesheets and other +Templates also commonly refer to images, JavaScript, stylesheets and other assets. Of course you could hard-code the path to these assets (e.g. ``/images/logo.png``), but Symfony2 provides a more dynamic option via the ``asset`` Twig function: @@ -1007,21 +1007,21 @@ look like ``/images/logo.png?v2``. For more information, see the :ref:`ref-frame configuration option. .. index:: - single: Templating; Including stylesheets and Javascripts + single: Templating; Including stylesheets and JavaScripts single: Stylesheets; Including stylesheets - single: Javascript; Including Javascripts + single: JavaScript; Including JavaScripts -Including Stylesheets and Javascripts in Twig +Including Stylesheets and JavaScripts in Twig --------------------------------------------- -No site would be complete without including Javascript files and stylesheets. +No site would be complete without including JavaScript files and stylesheets. In Symfony, the inclusion of these assets is handled elegantly by taking advantage of Symfony's template inheritance. .. tip:: This section will teach you the philosophy behind including stylesheet - and Javascript assets in Symfony. Symfony also packages another library, + and JavaScript assets in Symfony. Symfony also packages another library, called Assetic, which follows this philosophy but allows you to do much more interesting things with those assets. For more information on using Assetic see :doc:`/cookbook/assetic/asset_management`. @@ -1029,7 +1029,7 @@ advantage of Symfony's template inheritance. Start by adding two blocks to your base template that will hold your assets: one called ``stylesheets`` inside the ``head`` tag and another called ``javascripts`` just above the closing ``body`` tag. These blocks will contain all of the -stylesheets and Javascripts that you'll need throughout your site: +stylesheets and JavaScripts that you'll need throughout your site: .. code-block:: html+jinja @@ -1052,7 +1052,7 @@ stylesheets and Javascripts that you'll need throughout your site: That's easy enough! But what if you need to include an extra stylesheet or -Javascript from a child template? For example, suppose you have a contact +JavaScript from a child template? For example, suppose you have a contact page and you need to include a ``contact.css`` stylesheet *just* on that page. From inside that contact page's template, do the following: diff --git a/components/css_selector.rst b/components/css_selector.rst index 2367b0fde7c..61590113217 100644 --- a/components/css_selector.rst +++ b/components/css_selector.rst @@ -32,8 +32,8 @@ long and unwieldy expressions. Many developers -- particularly web developers -- are more comfortable using CSS selectors to find elements. As well as working in stylesheets, -CSS selectors are used in Javascript with the ``querySelectorAll`` function -and in popular Javascript libraries such as jQuery, Prototype and MooTools. +CSS selectors are used in JavaScript with the ``querySelectorAll`` function +and in popular JavaScript libraries such as jQuery, Prototype and MooTools. CSS selectors are less powerful than XPath, but far easier to write, read and understand. Since they are less powerful, almost all CSS selectors can diff --git a/cookbook/assetic/apply_to_option.rst b/cookbook/assetic/apply_to_option.rst index 60d9829b3a6..0488df48385 100644 --- a/cookbook/assetic/apply_to_option.rst +++ b/cookbook/assetic/apply_to_option.rst @@ -7,7 +7,7 @@ How to Apply an Assetic Filter to a Specific File Extension Assetic filters can be applied to individual files, groups of files or even, as you'll see here, files that have a specific extension. To show you how to handle each option, let's suppose that you want to use Assetic's CoffeeScript -filter, which compiles CoffeeScript files into Javascript. +filter, which compiles CoffeeScript files into JavaScript. The main configuration is just the paths to coffee, node and node_modules. An example configuration might look like this: diff --git a/cookbook/assetic/uglifyjs.rst b/cookbook/assetic/uglifyjs.rst index 3dfa3a05a3b..efb7967f22b 100644 --- a/cookbook/assetic/uglifyjs.rst +++ b/cookbook/assetic/uglifyjs.rst @@ -4,8 +4,8 @@ How to Minify CSS/JS Files (using UglifyJs and UglifyCss) ========================================================= -`UglifyJs`_ is a javascript parser/compressor/beautifier toolkit. It can be used -to combine and minify javascript assets so that they require less HTTP requests +`UglifyJs`_ is a JavaScript parser/compressor/beautifier toolkit. It can be used +to combine and minify JavaScript assets so that they require less HTTP requests and make your site load faster. `UglifyCss`_ is a css compressor/beautifier that is very similar to UglifyJs. diff --git a/cookbook/assetic/yuicompressor.rst b/cookbook/assetic/yuicompressor.rst index b5122be8e8c..e24268a5f4b 100644 --- a/cookbook/assetic/yuicompressor.rst +++ b/cookbook/assetic/yuicompressor.rst @@ -103,7 +103,7 @@ the view layer, this work is done in your templates: The above example assumes that you have a bundle called ``AcmeFooBundle`` and your JavaScript files are in the ``Resources/public/js`` directory under - your bundle. This isn't important however - you can include your Javascript + your bundle. This isn't important however - you can include your JavaScript files no matter where they are. With the addition of the ``yui_js`` filter to the asset tags above, you should diff --git a/cookbook/controller/error_pages.rst b/cookbook/controller/error_pages.rst index a61292f8434..6168fe7a9f3 100644 --- a/cookbook/controller/error_pages.rst +++ b/cookbook/controller/error_pages.rst @@ -68,7 +68,7 @@ end-user, create a new template located at In addition to the standard HTML error page, Symfony provides a default error page for many of the most common response formats, including JSON -(``error.json.twig``), XML (``error.xml.twig``) and even Javascript +(``error.json.twig``), XML (``error.xml.twig``) and even JavaScript (``error.js.twig``), to name a few. To override any of these templates, just create a new file with the same name in the ``app/Resources/TwigBundle/views/Exception`` directory. This is the standard From 5c1d29c20ca7321b6efcb260515d68638a71c8b5 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Mon, 21 Oct 2013 10:20:09 +0200 Subject: [PATCH 0639/2078] Update NotEqualTo.rst The last sentence was wrong --- reference/constraints/NotEqualTo.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/NotEqualTo.rst b/reference/constraints/NotEqualTo.rst index bea2bf6eb38..5f2d61350ef 100644 --- a/reference/constraints/NotEqualTo.rst +++ b/reference/constraints/NotEqualTo.rst @@ -98,4 +98,4 @@ message **type**: ``string`` **default**: ``This value should not be equal to {{ compared_value }}`` -This is the message that will be shown if the value is not equal. +This is the message that will be shown if the value is equal. From 3df1f480d4bf171af231706383d57c5e209cede2 Mon Sep 17 00:00:00 2001 From: Vladimir Khramtsov Date: Mon, 21 Oct 2013 09:04:14 +0000 Subject: [PATCH 0640/2078] Remove extra whitespace --- book/http_fundamentals.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index 902a5065b9e..0313a26b5df 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -479,7 +479,7 @@ specific PHP method ``contactAction`` inside a class called ``MainController``:: In this very simple example, the controller simply creates a :class:`Symfony\\Component\\HttpFoundation\\Response` object with the HTML -``

Contact us!

``. In the :doc:`controller chapter `, +``

Contact us!

``. In the :doc:`controller chapter `, you'll learn how a controller can render templates, allowing your "presentation" code (i.e. anything that actually writes out HTML) to live in a separate template file. This frees up the controller to worry only about the hard From 41945d8c3d855c2272f53fa490cdd8c6270a767e Mon Sep 17 00:00:00 2001 From: Vladimir Khramtsov Date: Mon, 21 Oct 2013 09:06:20 +0000 Subject: [PATCH 0641/2078] Format list in a single way --- book/http_fundamentals.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/http_fundamentals.rst b/book/http_fundamentals.rst index 0313a26b5df..b3d13904f16 100644 --- a/book/http_fundamentals.rst +++ b/book/http_fundamentals.rst @@ -524,14 +524,14 @@ regardless of how your project is developed. To name a few: * `Form`_ - A full-featured and flexible framework for creating forms and handling form submissions; -* `Validator`_ A system for creating rules about data and then validating +* `Validator`_ - A system for creating rules about data and then validating whether or not user-submitted data follows those rules; -* :doc:`ClassLoader ` An autoloading library that allows +* :doc:`ClassLoader ` - An autoloading library that allows PHP classes to be used without needing to manually ``require`` the files containing those classes; -* :doc:`Templating ` A toolkit for rendering +* :doc:`Templating ` - A toolkit for rendering templates, handling template inheritance (i.e. a template is decorated with a layout) and performing other common template tasks; From cd3ecf8508df0a537da413e7f5cab2229f7ef3d0 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Mon, 21 Oct 2013 17:46:32 +0200 Subject: [PATCH 0642/2078] [Validation] Fix order of code block: annotations <=> yaml --- book/validation.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/book/validation.rst b/book/validation.rst index 158e7cc3c6e..0dc055d7647 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -973,6 +973,18 @@ entity and a new constraint group called ``Premium``: .. configuration-block:: + .. code-block:: yaml + + # src/Acme/DemoBundle/Resources/config/validation.yml + Acme\DemoBundle\Entity\User: + properties: + name: + - NotBlank + creditCard: + - CardScheme + schemes: [VISA] + groups: [Premium] + .. code-block:: php-annotations // src/Acme/DemoBundle/Entity/User.php @@ -998,18 +1010,6 @@ entity and a new constraint group called ``Premium``: private $creditCard; } - .. code-block:: yaml - - # src/Acme/DemoBundle/Resources/config/validation.yml - Acme\DemoBundle\Entity\User: - properties: - name: - - NotBlank - creditCard: - - CardScheme - schemes: [VISA] - groups: [Premium] - .. code-block:: xml From 609ead9e51a07f5b49337a527090af94bf3ea895 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Tue, 22 Oct 2013 07:42:32 +0200 Subject: [PATCH 0643/2078] [Forms] Fix submit button usage in template --- book/forms.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/book/forms.rst b/book/forms.rst index d35046af758..07956f0f0f1 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -806,7 +806,9 @@ used the ``form_row`` helper: {{ form_widget(form.dueDate) }} - +
+ {{ form_widget(form.save) }} +
{{ form_end(form) }} @@ -828,7 +830,9 @@ used the ``form_row`` helper: widget($form['dueDate']) ?> - +
+ widget($form['save']) ?> +
end($form) ?> From 1494c08c86d65408dee51c5be01d753937708646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 22 Oct 2013 15:25:21 +0200 Subject: [PATCH 0644/2078] Revert "Removed warning about using swiftmailer handler with memory spool" This reverts commit 1262487380d02ac3239b452ff4a5ef4f1d683342. --- cookbook/logging/monolog_email.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cookbook/logging/monolog_email.rst b/cookbook/logging/monolog_email.rst index b429bc8c588..69e723f6fc6 100644 --- a/cookbook/logging/monolog_email.rst +++ b/cookbook/logging/monolog_email.rst @@ -107,6 +107,14 @@ to and from addresses and the subject. You can combine these handlers with other handlers so that the errors still get logged on the server as well as the emails being sent: +.. caution:: + + The default spool setting for swiftmailer is set to ``memory``, which + means that emails are sent at the very end of the request. However, this + does not work with buffered logs at the moment. In order to enable emailing + logs per the example below, you are must comment out the ``spool: { type: memory }`` + line in the ``config.yml`` file. + .. configuration-block:: .. code-block:: yaml From bbf53b46b3311e73b37c5ba847bc48e507e49527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Tue, 22 Oct 2013 16:13:38 +0200 Subject: [PATCH 0645/2078] remove extra word --- cookbook/logging/monolog_email.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/logging/monolog_email.rst b/cookbook/logging/monolog_email.rst index 69e723f6fc6..e6adcc1553b 100644 --- a/cookbook/logging/monolog_email.rst +++ b/cookbook/logging/monolog_email.rst @@ -112,7 +112,7 @@ get logged on the server as well as the emails being sent: The default spool setting for swiftmailer is set to ``memory``, which means that emails are sent at the very end of the request. However, this does not work with buffered logs at the moment. In order to enable emailing - logs per the example below, you are must comment out the ``spool: { type: memory }`` + logs per the example below, you must comment out the ``spool: { type: memory }`` line in the ``config.yml`` file. .. configuration-block:: From a42b0ca2d3281bb57d4ffe858653710abb72f135 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 23 Oct 2013 07:23:13 +0200 Subject: [PATCH 0646/2078] [Security] Fix typo --- book/security.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/security.rst b/book/security.rst index 7335d3e784a..ba69cd07b44 100644 --- a/book/security.rst +++ b/book/security.rst @@ -416,7 +416,7 @@ submission (i.e. ``/login_check``): .. versionadded:: 2.1 As of Symfony 2.1, you *must* have routes configured for your ``login_path``, - ``check_path`` ``logout`` keys. These keys can be route names (as shown + ``check_path`` and ``logout`` keys. These keys can be route names (as shown in this example) or URLs that have routes configured for them. Notice that the name of the ``login`` route matches the ``login_path`` config From e333b0ef15d48bc1f9356bfda8c293a5d1111428 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 23 Oct 2013 07:45:04 +0200 Subject: [PATCH 0647/2078] [Security] Update routing from "pattern" to "path" parameter --- book/security.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/security.rst b/book/security.rst index 7335d3e784a..7bed549216e 100644 --- a/book/security.rst +++ b/book/security.rst @@ -373,10 +373,10 @@ submission (i.e. ``/login_check``): # app/config/routing.yml login: - pattern: /login + path: /login defaults: { _controller: AcmeSecurityBundle:Security:login } login_check: - pattern: /login_check + path: /login_check .. code-block:: xml @@ -387,11 +387,11 @@ submission (i.e. ``/login_check``): xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AcmeSecurityBundle:Security:login - +
.. code-block:: php From 81752c72bfd8ddbf1de4216bd20dc23115761b85 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Tue, 22 Oct 2013 08:32:22 +0200 Subject: [PATCH 0648/2078] some unneded spaces fixed --- cookbook/console/logging.rst | 2 +- reference/constraints/CardScheme.rst | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cookbook/console/logging.rst b/cookbook/console/logging.rst index 50c21d5ebce..66bbc2f403c 100644 --- a/cookbook/console/logging.rst +++ b/cookbook/console/logging.rst @@ -23,7 +23,7 @@ Manually logging from a console Command This one is really simple. When you create a console command within the full framework as described in ":doc:`/cookbook/console/console_command`", your command extends :class:`Symfony\\Bundle\\FrameworkBundle\\Command\\ContainerAwareCommand`. -This means that you can simply access the standard logger service through the +This means that you can simply access the standard logger service through the container and use it to do the logging:: // src/Acme/DemoBundle/Command/GreetCommand.php diff --git a/reference/constraints/CardScheme.rst b/reference/constraints/CardScheme.rst index 172ddbfdf70..135755bc756 100644 --- a/reference/constraints/CardScheme.rst +++ b/reference/constraints/CardScheme.rst @@ -5,7 +5,7 @@ CardScheme The CardScheme validation is new in Symfony 2.2. This constraint ensures that a credit card number is valid for a given credit card -company. It can be used to validate the number before trying to initiate a payment +company. It can be used to validate the number before trying to initiate a payment through a payment gateway. +----------------+--------------------------------------------------------------------------+ @@ -23,7 +23,7 @@ Basic Usage ----------- To use the ``CardScheme`` validator, simply apply it to a property or method -on an object that will contain a credit card number. +on an object that will contain a credit card number. .. configuration-block:: @@ -103,7 +103,7 @@ schemes **type**: ``mixed`` [:ref:`default option `] -This option is required and represents the name of the number scheme used to +This option is required and represents the name of the number scheme used to validate the credit card number, it can either be a string or an array. Valid values are: From 26cc65bdda7aacead3dd11c5ac3e437252d20940 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 23 Oct 2013 20:18:59 +0200 Subject: [PATCH 0649/2078] [Internals] Fix "seealso" position for "kernel.exception" --- book/internals.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/book/internals.rst b/book/internals.rst index 399f0d87daf..b46ae109b0f 100644 --- a/book/internals.rst +++ b/book/internals.rst @@ -424,6 +424,10 @@ and set a new ``Exception`` object, or do nothing:: array('X-Status-Code' => 200) ); +.. seealso:: + + Read more on the :ref:`kernel.exception event `. + .. index:: single: Event Dispatcher @@ -434,10 +438,6 @@ The event dispatcher is a standalone component that is responsible for much of the underlying logic and flow behind a Symfony request. For more information, see the :doc:`Event Dispatcher Component Documentation `. -.. seealso:: - - Read more on the :ref:`kernel.exception event `. - .. index:: single: Profiler From cac861fbf3957afe258ab150723b19f431a97759 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 23 Oct 2013 20:50:22 +0200 Subject: [PATCH 0650/2078] [Internals] Fix parameter names: hyphen/underscore --- book/internals.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/book/internals.rst b/book/internals.rst index 399f0d87daf..960d87183ce 100644 --- a/book/internals.rst +++ b/book/internals.rst @@ -592,20 +592,20 @@ the configuration for the development environment: // load the profiler $container->loadFromExtension('framework', array( - 'profiler' => array('only-exceptions' => false), + 'profiler' => array('only_exceptions' => false), )); // enable the web profiler $container->loadFromExtension('web_profiler', array( 'toolbar' => true, - 'intercept-redirects' => true, + 'intercept_redirects' => true, 'verbose' => true, )); -When ``only-exceptions`` is set to ``true``, the profiler only collects data +When ``only_exceptions`` is set to ``true``, the profiler only collects data when an exception is thrown by the application. -When ``intercept-redirects`` is set to ``true``, the web profiler intercepts +When ``intercept_redirects`` is set to ``true``, the web profiler intercepts the redirects and gives you the opportunity to look at the collected data before following the redirect. @@ -643,7 +643,7 @@ If you enable the web profiler, you also need to mount the profiler routes: ); As the profiler adds some overhead, you might want to enable it only under -certain circumstances in the production environment. The ``only-exceptions`` +certain circumstances in the production environment. The ``only_exceptions`` settings limits profiling to 500 pages, but what if you want to get information when the client IP comes from a specific address, or for a limited portion of the website? You can use a Profiler Matcher, learn more about that From a6ba462de124e4fcbec68088d0a65e5e436991d3 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 23 Oct 2013 20:58:25 +0200 Subject: [PATCH 0651/2078] [Cache] Fix typo --- book/http_cache.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/http_cache.rst b/book/http_cache.rst index c1c0b737bea..0900142d9c5 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -535,7 +535,7 @@ example). The 304 status code means "Not Modified". It's important because with this status code the response does *not* contain the actual content being requested. Instead, the response is simply a light-weight set of directions that - tell cache that it should use its stored version. + tell the cache that it should use its stored version. Like with expiration, there are two different HTTP headers that can be used to implement the validation model: ``ETag`` and ``Last-Modified``. From 178fb714c9869d6a3288d139e3eeeb50f21c0f54 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Thu, 24 Oct 2013 06:04:11 +0200 Subject: [PATCH 0652/2078] [Cache] Fix typo --- book/http_cache.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/http_cache.rst b/book/http_cache.rst index 0900142d9c5..580155fcf2c 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -535,7 +535,7 @@ example). The 304 status code means "Not Modified". It's important because with this status code the response does *not* contain the actual content being requested. Instead, the response is simply a light-weight set of directions that - tell the cache that it should use its stored version. + tells the cache that it should use its stored version. Like with expiration, there are two different HTTP headers that can be used to implement the validation model: ``ETag`` and ``Last-Modified``. From 48a804ae379c71f4c5b464abc60bbd9badf9f666 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Thu, 24 Oct 2013 06:39:59 +0200 Subject: [PATCH 0653/2078] [Coding Standards] Fix sample code logic --- contributing/code/standards.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contributing/code/standards.rst b/contributing/code/standards.rst index 16808472f53..96d9421e9ec 100644 --- a/contributing/code/standards.rst +++ b/contributing/code/standards.rst @@ -58,11 +58,11 @@ example containing most features described below: private function transformText($dummy, array $options = array()) { $mergedOptions = array_merge( - $options, array( 'some_default' => 'values', 'another_default' => 'more values', - ) + ), + $options ); if (true === $dummy) { From 04262cd77621951de6146976f6e957fe07a6c61d Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Thu, 24 Oct 2013 15:59:25 +0200 Subject: [PATCH 0654/2078] [Translation] Fix fallback parameter name in the framework config --- book/translation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/translation.rst b/book/translation.rst index f4faf08289f..ef37d7c60e8 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -536,7 +536,7 @@ locale via routing. Fallback and Default Locale ~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If the locale hasn't been set explicitly in the session, the ``fallback_locale`` +If the locale hasn't been set explicitly in the session, the ``fallback`` configuration parameter will be used by the ``Translator``. The parameter defaults to ``en`` (see `Configuration`_). From 4bd7d2b10ec5310c11e6eaf45e4d597e1d473806 Mon Sep 17 00:00:00 2001 From: Matthieu Auger Date: Fri, 25 Oct 2013 10:29:34 +0200 Subject: [PATCH 0655/2078] [Validation] Set missing default configuration in yml examples --- reference/constraints/Ip.rst | 2 +- reference/constraints/Language.rst | 2 +- reference/constraints/Locale.rst | 2 +- reference/constraints/Url.rst | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/reference/constraints/Ip.rst b/reference/constraints/Ip.rst index 2a92e978f1e..583591f685e 100644 --- a/reference/constraints/Ip.rst +++ b/reference/constraints/Ip.rst @@ -27,7 +27,7 @@ Basic Usage Acme\BlogBundle\Entity\Author: properties: ipAddress: - - Ip: + - Ip: ~ .. code-block:: php-annotations diff --git a/reference/constraints/Language.rst b/reference/constraints/Language.rst index 582ce3380aa..1a6bc08af4f 100644 --- a/reference/constraints/Language.rst +++ b/reference/constraints/Language.rst @@ -24,7 +24,7 @@ Basic Usage Acme\UserBundle\Entity\User: properties: preferredLanguage: - - Language: + - Language: ~ .. code-block:: php-annotations diff --git a/reference/constraints/Locale.rst b/reference/constraints/Locale.rst index a39d1493b79..42eedaec6d4 100644 --- a/reference/constraints/Locale.rst +++ b/reference/constraints/Locale.rst @@ -28,7 +28,7 @@ Basic Usage Acme\UserBundle\Entity\User: properties: locale: - - Locale: + - Locale: ~ .. code-block:: php-annotations diff --git a/reference/constraints/Url.rst b/reference/constraints/Url.rst index 818156e3d73..e3308c68c42 100644 --- a/reference/constraints/Url.rst +++ b/reference/constraints/Url.rst @@ -25,7 +25,7 @@ Basic Usage Acme\BlogBundle\Entity\Author: properties: bioUrl: - - Url: + - Url: ~ .. code-block:: php-annotations From 489a77f021d8f21950788bb1d966a2b52eba8914 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sat, 26 Oct 2013 07:13:02 +0200 Subject: [PATCH 0656/2078] Fix coding standards in Config Component example code --- components/config/definition.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index 4ca0f790b69..c087613688d 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -568,8 +568,8 @@ Otherwise the result is a clean array of configuration values:: $configs = array($config1, $config2); $processor = new Processor(); - $configuration = new DatabaseConfiguration; + $configuration = new DatabaseConfiguration(); $processedConfiguration = $processor->processConfiguration( $configuration, - $configs) - ; + $configs + ); From ed24e1476ffb8c428e915e300d37191b88fb9371 Mon Sep 17 00:00:00 2001 From: Christopher Moll Date: Wed, 9 Oct 2013 21:20:09 -0400 Subject: [PATCH 0657/2078] Removed typo --- cookbook/logging/monolog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/logging/monolog.rst b/cookbook/logging/monolog.rst index 11cb46e41fd..147ef9383af 100644 --- a/cookbook/logging/monolog.rst +++ b/cookbook/logging/monolog.rst @@ -22,7 +22,7 @@ your controller:: // ... } -The ``logger`` service has different methods for different the logging levels. +The ``logger`` service has different methods for different logging levels. See :class:`Symfony\\Component\\HttpKernel\\Log\\LoggerInterface` for details on which methods are available. From 5d8b789d49b01420d304faa66139624ac2c5fcab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slaven=20Ba=C4=8Deli=C4=87?= Date: Thu, 10 Oct 2013 09:10:24 +0200 Subject: [PATCH 0658/2078] Fix annotation example in Regex validation constraint --- reference/constraints/Regex.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/constraints/Regex.rst b/reference/constraints/Regex.rst index 1595ff4c042..603191fb10b 100644 --- a/reference/constraints/Regex.rst +++ b/reference/constraints/Regex.rst @@ -214,10 +214,10 @@ specify the html5 compatible pattern in the ``htmlPattern`` option: class Author { /** - * @Assert\Regex({ + * @Assert\Regex( * pattern = "/^[a-z]+$/i", * htmlPattern = "^[a-zA-Z]+$" - * }) + * ) */ protected $name; } From d98e50d9e6a050a8ee9d626adb3b8f537f509886 Mon Sep 17 00:00:00 2001 From: Maks Rafalko Date: Fri, 11 Oct 2013 18:42:16 +0300 Subject: [PATCH 0659/2078] Use PSR-3 compatible method Changed `$logger->err('An error occurred');` to `$logger->error('An error occurred');` because it's deprecated and not PSR-3 compatible --- cookbook/logging/monolog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/logging/monolog.rst b/cookbook/logging/monolog.rst index 147ef9383af..b36ee23df9b 100644 --- a/cookbook/logging/monolog.rst +++ b/cookbook/logging/monolog.rst @@ -17,7 +17,7 @@ your controller:: { $logger = $this->get('logger'); $logger->info('I just got the logger'); - $logger->err('An error occurred'); + $logger->error('An error occurred'); // ... } From 934a540f314902c9b5eba47ab86e760f66fd987c Mon Sep 17 00:00:00 2001 From: Douglas Greenshields Date: Mon, 14 Oct 2013 12:37:19 +0100 Subject: [PATCH 0660/2078] add clarification clause for how event listener priority affects trigger order --- components/event_dispatcher/introduction.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/event_dispatcher/introduction.rst b/components/event_dispatcher/introduction.rst index d03ee05364e..522e9a89aab 100644 --- a/components/event_dispatcher/introduction.rst +++ b/components/event_dispatcher/introduction.rst @@ -143,10 +143,11 @@ The ``addListener()`` method takes up to three arguments: * A PHP callable that will be notified when an event is thrown that it listens to; -* An optional priority integer (higher equals more important) that determines - when a listener is triggered versus other listeners (defaults to ``0``). If - two listeners have the same priority, they are executed in the order that - they were added to the dispatcher. +* An optional priority integer (higher equals more important, and therefore + that the listener will be triggered earlier) that determines when a listener + is triggered versus other listeners (defaults to ``0``). If two listeners + have the same priority, they are executed in the order that they were added + to the dispatcher. .. note:: From 9a07b057e16371bddcd51c9f9643e9808dcd7e70 Mon Sep 17 00:00:00 2001 From: Michael van Hirsch Date: Mon, 14 Oct 2013 20:41:10 +0200 Subject: [PATCH 0661/2078] Added missing use statements --- cookbook/form/unit_testing.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cookbook/form/unit_testing.rst b/cookbook/form/unit_testing.rst index 68e4ee3bcea..abeed20a691 100644 --- a/cookbook/form/unit_testing.rst +++ b/cookbook/form/unit_testing.rst @@ -168,6 +168,9 @@ on other extensions. You need add those extensions to the factory object:: use Acme\TestBundle\Form\Type\TestedType; use Acme\TestBundle\Model\TestObject; use Symfony\Component\Form\Tests\Extension\Core\Type\TypeTestCase; + use Symfony\Component\Form\Forms; + use Symfony\Component\Form\FormBuilder; + use Symfony\Component\Form\Extension\Validator\Type\FormTypeValidatorExtension; class TestedTypeTest extends TypeTestCase { From 2eda57bfe0bf01fd8c342574123d064ea45483d5 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sat, 26 Oct 2013 19:07:25 +0200 Subject: [PATCH 0662/2078] [Components] Reorder installation instructions --- components/class_loader/introduction.rst | 2 +- components/config/introduction.rst | 2 +- components/console/introduction.rst | 2 +- components/css_selector.rst | 2 +- components/dependency_injection/introduction.rst | 2 +- components/dom_crawler.rst | 2 +- components/event_dispatcher/introduction.rst | 2 +- components/filesystem.rst | 2 +- components/finder.rst | 2 +- components/form/introduction.rst | 2 +- components/http_foundation/introduction.rst | 2 +- components/http_kernel/introduction.rst | 2 +- components/locale.rst | 2 +- components/options_resolver.rst | 2 +- components/process.rst | 2 +- components/property_access/introduction.rst | 2 +- components/routing/introduction.rst | 2 +- components/security/introduction.rst | 2 +- components/serializer.rst | 2 +- components/stopwatch.rst | 2 +- components/templating/introduction.rst | 2 +- components/yaml/introduction.rst | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/components/class_loader/introduction.rst b/components/class_loader/introduction.rst index c115d05b709..a2804e2e656 100644 --- a/components/class_loader/introduction.rst +++ b/components/class_loader/introduction.rst @@ -32,9 +32,9 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/ClassLoader); * :doc:`Install it via Composer ` (``symfony/class-loader`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/ClassLoader); .. _`autoloading mechanism`: http://php.net/manual/en/language.oop5.autoload.php .. _Packagist: https://packagist.org/packages/symfony/class-loader diff --git a/components/config/introduction.rst b/components/config/introduction.rst index 8535a9a75aa..c6be05fbc2d 100644 --- a/components/config/introduction.rst +++ b/components/config/introduction.rst @@ -17,8 +17,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/Config); * :doc:`Install it via Composer ` (``symfony/config`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/Config); Sections -------- diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 8133d071fef..68a9849e22c 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -17,8 +17,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/Console); * :doc:`Install it via Composer ` (``symfony/console`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/Console); .. note:: diff --git a/components/css_selector.rst b/components/css_selector.rst index 2367b0fde7c..70614f7cf28 100644 --- a/components/css_selector.rst +++ b/components/css_selector.rst @@ -12,8 +12,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/CssSelector); * :doc:`Install it via Composer ` (``symfony/css-selector`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/CssSelector); Usage ----- diff --git a/components/dependency_injection/introduction.rst b/components/dependency_injection/introduction.rst index c52fe256310..1c8efe9178f 100644 --- a/components/dependency_injection/introduction.rst +++ b/components/dependency_injection/introduction.rst @@ -16,8 +16,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/DependencyInjection); * :doc:`Install it via Composer ` (``symfony/dependency-injection`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/DependencyInjection); Basic Usage ----------- diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index bb45d6c2beb..bd48d64474f 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -17,8 +17,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/DomCrawler); * :doc:`Install it via Composer ` (``symfony/dom-crawler`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/DomCrawler); Usage ----- diff --git a/components/event_dispatcher/introduction.rst b/components/event_dispatcher/introduction.rst index 522e9a89aab..cc09c2fd294 100644 --- a/components/event_dispatcher/introduction.rst +++ b/components/event_dispatcher/introduction.rst @@ -49,8 +49,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/EventDispatcher); * :doc:`Install it via Composer ` (``symfony/event-dispatcher`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/EventDispatcher); Usage ----- diff --git a/components/filesystem.rst b/components/filesystem.rst index 44e010b88d1..79a724e842f 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -15,8 +15,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/Filesystem); * :doc:`Install it via Composer ` (``symfony/filesystem`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/Filesystem); Usage ----- diff --git a/components/finder.rst b/components/finder.rst index f9473e077f1..3f7cfbc7971 100644 --- a/components/finder.rst +++ b/components/finder.rst @@ -13,8 +13,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/Finder); * :doc:`Install it via Composer ` (``symfony/finder`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/Finder); Usage ----- diff --git a/components/form/introduction.rst b/components/form/introduction.rst index 813f70d93f9..013cc0880fe 100644 --- a/components/form/introduction.rst +++ b/components/form/introduction.rst @@ -19,8 +19,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/Form); * :doc:`Install it via Composer ` (``symfony/form`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/Form); Configuration ------------- diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 604e12972ea..09b0bc267e8 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -21,8 +21,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/HttpFoundation); * :doc:`Install it via Composer ` (``symfony/http-foundation`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/HttpFoundation); .. _component-http-foundation-request: diff --git a/components/http_kernel/introduction.rst b/components/http_kernel/introduction.rst index f8cea723364..f7a30e0fb28 100644 --- a/components/http_kernel/introduction.rst +++ b/components/http_kernel/introduction.rst @@ -16,8 +16,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/HttpKernel); * :doc:`Install it via Composer ` (``symfony/http-kernel`` on Packagist_). +* Use the official Git repository (https://github.com/symfony/HttpKernel); The Workflow of a Request ------------------------- diff --git a/components/locale.rst b/components/locale.rst index 8c52cb9e490..3a38a5a8746 100644 --- a/components/locale.rst +++ b/components/locale.rst @@ -27,8 +27,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/Locale); * :doc:`Install it via Composer ` (``symfony/locale`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/Locale); Usage ----- diff --git a/components/options_resolver.rst b/components/options_resolver.rst index ad83d73ab3f..d4c7aa2183c 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -13,8 +13,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/OptionsResolver * :doc:`Install it via Composer ` (``symfony/options-resolver`` on `Packagist`_) +* Use the official Git repository (https://github.com/symfony/OptionsResolver Usage ----- diff --git a/components/process.rst b/components/process.rst index 868673cfa55..2192636709e 100644 --- a/components/process.rst +++ b/components/process.rst @@ -12,8 +12,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/Process); * :doc:`Install it via Composer ` (``symfony/process`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/Process); Usage ----- diff --git a/components/property_access/introduction.rst b/components/property_access/introduction.rst index 26991f046e9..03f89de62fb 100644 --- a/components/property_access/introduction.rst +++ b/components/property_access/introduction.rst @@ -17,8 +17,8 @@ Installation You can install the component in two different ways: -* Use the official Git repository (https://github.com/symfony/PropertyAccess); * :doc:`Install it via Composer` (``symfony/property-access`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/PropertyAccess); Usage ----- diff --git a/components/routing/introduction.rst b/components/routing/introduction.rst index 12a032eb9d4..30a20694781 100644 --- a/components/routing/introduction.rst +++ b/components/routing/introduction.rst @@ -13,8 +13,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/Routing); * :doc:`Install it via Composer ` (``symfony/routing`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/Routing); Usage ----- diff --git a/components/security/introduction.rst b/components/security/introduction.rst index 21778184457..1259299a716 100644 --- a/components/security/introduction.rst +++ b/components/security/introduction.rst @@ -19,8 +19,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/Security); * :doc:`Install it via Composer ` (``symfony/security`` on Packagist_). +* Use the official Git repository (https://github.com/symfony/Security); Sections -------- diff --git a/components/serializer.rst b/components/serializer.rst index c6740878841..a5813dd7bc7 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -27,8 +27,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/Serializer); * :doc:`Install it via Composer ` (``symfony/serializer`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/Serializer); Usage ----- diff --git a/components/stopwatch.rst b/components/stopwatch.rst index 261f47b1d6a..7e06303ecad 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -16,8 +16,8 @@ Installation You can install the component in two different ways: -* Use the official Git repository (https://github.com/symfony/Stopwatch); * :doc:`Install it via Composer` (``symfony/stopwatch`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/Stopwatch); Usage ----- diff --git a/components/templating/introduction.rst b/components/templating/introduction.rst index eedb52df985..20c83b85504 100644 --- a/components/templating/introduction.rst +++ b/components/templating/introduction.rst @@ -18,8 +18,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/Templating); * :doc:`Install it via Composer ` (``symfony/templating`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/Templating); Usage ----- diff --git a/components/yaml/introduction.rst b/components/yaml/introduction.rst index 1652316dcdd..777a6f54055 100644 --- a/components/yaml/introduction.rst +++ b/components/yaml/introduction.rst @@ -31,8 +31,8 @@ Installation You can install the component in 2 different ways: -* Use the official Git repository (https://github.com/symfony/Yaml); * :doc:`Install it via Composer ` (``symfony/yaml`` on `Packagist`_). +* Use the official Git repository (https://github.com/symfony/Yaml); Why? ---- From e3180280de2368ea1185753636394d2792f186c8 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sun, 27 Oct 2013 07:01:52 +0100 Subject: [PATCH 0663/2078] [Console Dialog Helper] Fix logic of code example --- components/console/helpers/dialoghelper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index 1c910d4106d..4896769663a 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -141,7 +141,7 @@ You can also ask and validate a hidden response:: $password = $dialog->askHiddenResponseAndValidate( $output, - 'Please enter the name of the widget', + 'Please enter your password', $validator, 20, false From 289d3018255cb04f8e69a8ab9790b707e0ab6dd8 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sun, 27 Oct 2013 08:25:21 +0100 Subject: [PATCH 0664/2078] [DomCrawler] Add missing "2.3" version number to versionadded box --- components/dom_crawler.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index b8c3d06c825..940568ff08e 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -157,7 +157,7 @@ Call an anonymous function on each node of the list:: return $node->text(); }); -.. versionadded:: +.. versionadded:: 2.3 As seen here, in Symfony 2.3, the ``each`` and ``reduce`` Closure functions are passed a ``Crawler`` as the first argument. Previously, that argument was a :phpclass:`DOMNode`. From e396f52a06226dbd767c2c2c3617e10380fe62b4 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sun, 27 Oct 2013 08:32:59 +0100 Subject: [PATCH 0665/2078] [DomCrawler] Fix description of closure arguments order --- components/dom_crawler.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index bb45d6c2beb..487affdfcdc 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -151,7 +151,7 @@ Call an anonymous function on each node of the list:: return $node->text(); }); -The anonymous function receives the position and the node as arguments. +The anonymous function receives the node and the position as arguments. The result is an array of values returned by the anonymous function calls. Adding the Content From 74b047ba76a3d89255a4ee97f956799c5a5eb2aa Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sun, 27 Oct 2013 08:48:54 +0100 Subject: [PATCH 0666/2078] [Components] Fix punctuation in installation instruction lists --- components/class_loader/introduction.rst | 4 ++-- components/config/introduction.rst | 4 ++-- components/console/introduction.rst | 4 ++-- components/css_selector.rst | 4 ++-- components/dependency_injection/introduction.rst | 4 ++-- components/dom_crawler.rst | 4 ++-- components/event_dispatcher/introduction.rst | 4 ++-- components/filesystem.rst | 4 ++-- components/finder.rst | 4 ++-- components/form/introduction.rst | 4 ++-- components/http_foundation/introduction.rst | 4 ++-- components/http_kernel/introduction.rst | 4 ++-- components/locale.rst | 4 ++-- components/options_resolver.rst | 4 ++-- components/process.rst | 4 ++-- components/property_access/introduction.rst | 4 ++-- components/routing/introduction.rst | 4 ++-- components/security/introduction.rst | 4 ++-- components/serializer.rst | 4 ++-- components/stopwatch.rst | 4 ++-- components/templating/introduction.rst | 4 ++-- components/yaml/introduction.rst | 4 ++-- 22 files changed, 44 insertions(+), 44 deletions(-) diff --git a/components/class_loader/introduction.rst b/components/class_loader/introduction.rst index a2804e2e656..ca377418d69 100644 --- a/components/class_loader/introduction.rst +++ b/components/class_loader/introduction.rst @@ -33,8 +33,8 @@ Installation You can install the component in 2 different ways: * :doc:`Install it via Composer ` (``symfony/class-loader`` - on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/ClassLoader); + on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/ClassLoader). .. _`autoloading mechanism`: http://php.net/manual/en/language.oop5.autoload.php .. _Packagist: https://packagist.org/packages/symfony/class-loader diff --git a/components/config/introduction.rst b/components/config/introduction.rst index c6be05fbc2d..c3c906536df 100644 --- a/components/config/introduction.rst +++ b/components/config/introduction.rst @@ -17,8 +17,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/config`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/Config); +* :doc:`Install it via Composer ` (``symfony/config`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/Config). Sections -------- diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 68a9849e22c..16edcab5f79 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -17,8 +17,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/console`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/Console); +* :doc:`Install it via Composer ` (``symfony/console`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/Console). .. note:: diff --git a/components/css_selector.rst b/components/css_selector.rst index 70614f7cf28..cce97950569 100644 --- a/components/css_selector.rst +++ b/components/css_selector.rst @@ -12,8 +12,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/css-selector`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/CssSelector); +* :doc:`Install it via Composer ` (``symfony/css-selector`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/CssSelector). Usage ----- diff --git a/components/dependency_injection/introduction.rst b/components/dependency_injection/introduction.rst index 1c8efe9178f..a9eeb47b379 100644 --- a/components/dependency_injection/introduction.rst +++ b/components/dependency_injection/introduction.rst @@ -16,8 +16,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/dependency-injection`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/DependencyInjection); +* :doc:`Install it via Composer ` (``symfony/dependency-injection`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/DependencyInjection). Basic Usage ----------- diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index bd48d64474f..dafba75e368 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -17,8 +17,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/dom-crawler`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/DomCrawler); +* :doc:`Install it via Composer ` (``symfony/dom-crawler`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/DomCrawler). Usage ----- diff --git a/components/event_dispatcher/introduction.rst b/components/event_dispatcher/introduction.rst index cc09c2fd294..7c52e46d00d 100644 --- a/components/event_dispatcher/introduction.rst +++ b/components/event_dispatcher/introduction.rst @@ -49,8 +49,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/event-dispatcher`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/EventDispatcher); +* :doc:`Install it via Composer ` (``symfony/event-dispatcher`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/EventDispatcher). Usage ----- diff --git a/components/filesystem.rst b/components/filesystem.rst index 79a724e842f..304cdf6f40e 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -15,8 +15,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/filesystem`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/Filesystem); +* :doc:`Install it via Composer ` (``symfony/filesystem`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/Filesystem). Usage ----- diff --git a/components/finder.rst b/components/finder.rst index 3f7cfbc7971..3384f9fd41f 100644 --- a/components/finder.rst +++ b/components/finder.rst @@ -13,8 +13,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/finder`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/Finder); +* :doc:`Install it via Composer ` (``symfony/finder`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/Finder). Usage ----- diff --git a/components/form/introduction.rst b/components/form/introduction.rst index 013cc0880fe..e57faeb83e1 100644 --- a/components/form/introduction.rst +++ b/components/form/introduction.rst @@ -19,8 +19,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/form`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/Form); +* :doc:`Install it via Composer ` (``symfony/form`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/Form). Configuration ------------- diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index 09b0bc267e8..bf2c4ac0fd4 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -21,8 +21,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/http-foundation`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/HttpFoundation); +* :doc:`Install it via Composer ` (``symfony/http-foundation`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/HttpFoundation). .. _component-http-foundation-request: diff --git a/components/http_kernel/introduction.rst b/components/http_kernel/introduction.rst index f7a30e0fb28..6332c884d3f 100644 --- a/components/http_kernel/introduction.rst +++ b/components/http_kernel/introduction.rst @@ -16,8 +16,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/http-kernel`` on Packagist_). -* Use the official Git repository (https://github.com/symfony/HttpKernel); +* :doc:`Install it via Composer ` (``symfony/http-kernel`` on Packagist_); +* Use the official Git repository (https://github.com/symfony/HttpKernel). The Workflow of a Request ------------------------- diff --git a/components/locale.rst b/components/locale.rst index 3a38a5a8746..32e29fd7bd9 100644 --- a/components/locale.rst +++ b/components/locale.rst @@ -27,8 +27,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/locale`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/Locale); +* :doc:`Install it via Composer ` (``symfony/locale`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/Locale). Usage ----- diff --git a/components/options_resolver.rst b/components/options_resolver.rst index d4c7aa2183c..e06e1f389c6 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -13,8 +13,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/options-resolver`` on `Packagist`_) -* Use the official Git repository (https://github.com/symfony/OptionsResolver +* :doc:`Install it via Composer ` (``symfony/options-resolver`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/OptionsResolver). Usage ----- diff --git a/components/process.rst b/components/process.rst index 2192636709e..b20e49ca132 100644 --- a/components/process.rst +++ b/components/process.rst @@ -12,8 +12,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/process`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/Process); +* :doc:`Install it via Composer ` (``symfony/process`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/Process). Usage ----- diff --git a/components/property_access/introduction.rst b/components/property_access/introduction.rst index 03f89de62fb..7000423473d 100644 --- a/components/property_access/introduction.rst +++ b/components/property_access/introduction.rst @@ -17,8 +17,8 @@ Installation You can install the component in two different ways: -* :doc:`Install it via Composer` (``symfony/property-access`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/PropertyAccess); +* :doc:`Install it via Composer` (``symfony/property-access`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/PropertyAccess). Usage ----- diff --git a/components/routing/introduction.rst b/components/routing/introduction.rst index 30a20694781..37912a2b224 100644 --- a/components/routing/introduction.rst +++ b/components/routing/introduction.rst @@ -13,8 +13,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/routing`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/Routing); +* :doc:`Install it via Composer ` (``symfony/routing`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/Routing). Usage ----- diff --git a/components/security/introduction.rst b/components/security/introduction.rst index 1259299a716..ab8699b68b7 100644 --- a/components/security/introduction.rst +++ b/components/security/introduction.rst @@ -19,8 +19,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/security`` on Packagist_). -* Use the official Git repository (https://github.com/symfony/Security); +* :doc:`Install it via Composer ` (``symfony/security`` on Packagist_); +* Use the official Git repository (https://github.com/symfony/Security). Sections -------- diff --git a/components/serializer.rst b/components/serializer.rst index a5813dd7bc7..6b0809fe33c 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -27,8 +27,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/serializer`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/Serializer); +* :doc:`Install it via Composer ` (``symfony/serializer`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/Serializer). Usage ----- diff --git a/components/stopwatch.rst b/components/stopwatch.rst index 7e06303ecad..4741823cc4a 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -16,8 +16,8 @@ Installation You can install the component in two different ways: -* :doc:`Install it via Composer` (``symfony/stopwatch`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/Stopwatch); +* :doc:`Install it via Composer` (``symfony/stopwatch`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/Stopwatch). Usage ----- diff --git a/components/templating/introduction.rst b/components/templating/introduction.rst index 20c83b85504..2b75cb1169d 100644 --- a/components/templating/introduction.rst +++ b/components/templating/introduction.rst @@ -18,8 +18,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/templating`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/Templating); +* :doc:`Install it via Composer ` (``symfony/templating`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/Templating). Usage ----- diff --git a/components/yaml/introduction.rst b/components/yaml/introduction.rst index 777a6f54055..c069a0da920 100644 --- a/components/yaml/introduction.rst +++ b/components/yaml/introduction.rst @@ -31,8 +31,8 @@ Installation You can install the component in 2 different ways: -* :doc:`Install it via Composer ` (``symfony/yaml`` on `Packagist`_). -* Use the official Git repository (https://github.com/symfony/Yaml); +* :doc:`Install it via Composer ` (``symfony/yaml`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/Yaml). Why? ---- From fe1e97fabf792d6a189fc7aeb2737718add45e0c Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sun, 27 Oct 2013 09:03:24 +0100 Subject: [PATCH 0667/2078] [Console] Add missing question mark --- components/console/helpers/dialoghelper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index 1c910d4106d..aa9887f6056 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -31,7 +31,7 @@ the following to your command:: return; } -In this case, the user will be asked "Continue with this action", and will return +In this case, the user will be asked "Continue with this action?", and will return ``true`` if the user answers with ``y`` or false in any other case. The third argument to ``askConfirmation`` is the default value to return if the user doesn't enter any input. From d3d1ff155627d598d6865553d3310042fa115243 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 28 Oct 2013 08:53:51 +0100 Subject: [PATCH 0668/2078] change order to fix the rendering of 'previous' and 'next' links --- components/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/index.rst b/components/index.rst index 302aa30f5a1..01d348e8d69 100644 --- a/components/index.rst +++ b/components/index.rst @@ -9,8 +9,8 @@ The Components config/index console/index css_selector - dom_crawler dependency_injection/index + dom_crawler event_dispatcher/index filesystem finder From ff7cc1fcfe46368062634312ac256761d555d371 Mon Sep 17 00:00:00 2001 From: thewilkybarkid Date: Mon, 28 Oct 2013 10:29:44 +0000 Subject: [PATCH 0669/2078] Use log in/out verbs --- book/security.rst | 8 ++++---- cookbook/testing/http_authentication.rst | 2 +- reference/configuration/security.rst | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/book/security.rst b/book/security.rst index 7335d3e784a..7814ec2000a 100644 --- a/book/security.rst +++ b/book/security.rst @@ -146,7 +146,7 @@ that looks like the following: * Any URL matching ``/admin/*`` is secured, and only the ``admin`` user can access it; * All URLs *not* matching ``/admin/*`` are accessible by all users (and the - user is never prompted to login). + user is never prompted to log in). Let's look briefly at how security works and how each part of the configuration comes into play. @@ -1635,9 +1635,9 @@ the first provider is always used: ), )); -In this example, if a user tries to login via HTTP authentication, the authentication +In this example, if a user tries to log in via HTTP authentication, the authentication system will use the ``in_memory`` user provider. But if the user tries to -login via the form login, the ``user_db`` provider will be used (since it's +log in via the form login, the ``user_db`` provider will be used (since it's the default for the firewall as a whole). For more information about user provider and firewall configuration, see @@ -1869,7 +1869,7 @@ Impersonating a User -------------------- Sometimes, it's useful to be able to switch from one user to another without -having to logout and login again (for instance when you are debugging or trying +having to log out and log in again (for instance when you are debugging or trying to understand a bug a user sees that you can't reproduce). This can be easily done by activating the ``switch_user`` firewall listener: diff --git a/cookbook/testing/http_authentication.rst b/cookbook/testing/http_authentication.rst index 0b00422e912..cbb9c86a9fb 100644 --- a/cookbook/testing/http_authentication.rst +++ b/cookbook/testing/http_authentication.rst @@ -22,7 +22,7 @@ You can also override it on a per request basis:: When your application is using a ``form_login``, you can simplify your tests by allowing your test configuration to make use of HTTP authentication. This way you can use the above to authenticate in tests, but still have your users -login via the normal ``form_login``. The trick is to include the ``http_basic`` +log in via the normal ``form_login``. The trick is to include the ``http_basic`` key in your firewall, along with the ``form_login`` key: .. configuration-block:: diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index dc41ad19f6a..31a20e888d5 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -117,7 +117,7 @@ Each part will be explained in the next section. # submit the login form here check_path: /login_check - # the user is redirected here when he/she needs to login + # the user is redirected here when he/she needs to log in login_path: /login # if true, forward the user to the login form instead of redirecting From 32cdca7c2e039693e425069983371b72174d6500 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 28 Oct 2013 08:48:17 +0100 Subject: [PATCH 0670/2078] fix HTML so that the syntax highlighting is not broken --- book/forms.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/forms.rst b/book/forms.rst index f15d9fac1bd..bffcac0834d 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -1234,7 +1234,7 @@ renders the form: {% form_theme form 'AcmeTaskBundle:Form:fields.html.twig' 'AcmeTaskBundle:Form:fields2.html.twig' %} -
+ .. code-block:: html+php @@ -1243,7 +1243,7 @@ renders the form: setTheme($form, array('AcmeTaskBundle:Form', 'AcmeTaskBundle:Form')) ?> - + The ``form_theme`` tag (in Twig) "imports" the fragments defined in the given template and uses them when rendering the form. In other words, when the From a1a856b466598c3533fac481e6ca5f8da393550f Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Mon, 28 Oct 2013 19:46:01 +0100 Subject: [PATCH 0671/2078] [Components] Fix alphabetic order of Components TOC --- components/map.rst.inc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/map.rst.inc b/components/map.rst.inc index a3a21843fb2..c363c469f05 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -96,6 +96,13 @@ * :doc:`/components/routing/introduction` * :doc:`/components/routing/hostname_pattern` +* :doc:`/components/security/index` + + * :doc:`/components/security/introduction` + * :doc:`/components/security/firewall` + * :doc:`/components/security/authentication` + * :doc:`/components/security/authorization` + * **Serializer** * :doc:`/components/serializer` @@ -104,13 +111,6 @@ * :doc:`/components/stopwatch` -* :doc:`/components/security/index` - - * :doc:`/components/security/introduction` - * :doc:`/components/security/firewall` - * :doc:`/components/security/authentication` - * :doc:`/components/security/authorization` - * :doc:`/components/templating/index` * :doc:`/components/templating/introduction` From d7bd39ab9ed156a8089a86d759772dad04b8fda8 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Tue, 29 Oct 2013 07:32:28 +0100 Subject: [PATCH 0672/2078] [PropertyAccess] Fix typos --- components/property_access/introduction.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/property_access/introduction.rst b/components/property_access/introduction.rst index 26991f046e9..91cfb2c3e3d 100644 --- a/components/property_access/introduction.rst +++ b/components/property_access/introduction.rst @@ -162,7 +162,7 @@ At last, ``getValue`` can use the magic ``__get`` method too:: class Person { private $children = array( - 'wouter' => array(...), + 'Wouter' => array(...), ); public function __get($id) @@ -196,7 +196,7 @@ Writing to Objects ------------------ The ``setValue`` method has the same features as the ``getValue`` method. You -can use setters, the magic ``__set`` or properties to set values:: +can use setters, the magic ``__set`` method or properties to set values:: // ... class Person From bbca1790204f4f749e1eb66aa2bf08928d54feb8 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Tue, 29 Oct 2013 07:34:30 +0100 Subject: [PATCH 0673/2078] [PropertyAccess] Fix typo --- components/property_access/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/property_access/introduction.rst b/components/property_access/introduction.rst index 767097f8dfd..a474a6c6ab7 100644 --- a/components/property_access/introduction.rst +++ b/components/property_access/introduction.rst @@ -372,7 +372,7 @@ configured to enable extra features. To do that you could use the Or you can pass parameters directly to the constructor (not the recommended way):: // ... - $accessor = new PropertyAccessor(true) // this enable handling of magic __call + $accessor = new PropertyAccessor(true) // this enables handling of magic __call .. _Packagist: https://packagist.org/packages/symfony/property-access From e0c9f061071405d7e8fbc5106a9390108961c723 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Tue, 29 Oct 2013 07:44:32 +0100 Subject: [PATCH 0674/2078] [Serializer] Fix typo and formatting --- components/serializer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/serializer.rst b/components/serializer.rst index c6740878841..b13270f74ea 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -104,7 +104,7 @@ Deserializing an Object ~~~~~~~~~~~~~~~~~~~~~~~ Let's see now how to do the exactly the opposite. This time, the information -of the `People` class would be encoded in XML format:: +of the ``Person`` class would be encoded in XML format:: $data = << From ed26f7802cf2bfe61a750c2a6f46352d85baf0cd Mon Sep 17 00:00:00 2001 From: Wouter J Date: Tue, 29 Oct 2013 15:05:25 +0100 Subject: [PATCH 0675/2078] Fix hostname article --- book/routing.rst | 8 ++++---- components/routing/hostname_pattern.rst | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/book/routing.rst b/book/routing.rst index 905bc4be85e..960c9ed7e99 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -707,8 +707,8 @@ form via the same URL, while using distinct controllers for the two actions. If no ``methods`` are specified, the route will match on *all* methods. -Adding a Host -~~~~~~~~~~~~~ +Adding a Host Requirement +~~~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 2.2 Host matching support was added in Symfony 2.2 @@ -1067,8 +1067,8 @@ from the new routing resource. :doc:`FrameworkExtraBundle documentation ` to see how. -Adding a Host regex to Imported Routes -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Adding a Host requirement to Imported Routes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 2.2 Host matching support was added in Symfony 2.2 diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst index dfe5df8a445..7fc34dad4e0 100644 --- a/components/routing/hostname_pattern.rst +++ b/components/routing/hostname_pattern.rst @@ -81,7 +81,7 @@ dependency injection container parameter. host: m.{domain} defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } requirements: - domain: %domain% + domain: "%domain%" homepage: path: / @@ -90,7 +90,6 @@ dependency injection container parameter. .. code-block:: xml - @@ -125,10 +124,10 @@ dependency injection container parameter. .. _component-routing-host-imported: -Adding a Host Regex to Imported Routes --------------------------------------------- +Using Host Matching of Imported Routes +-------------------------------------- -You can set a host regex on imported routes: +You can also set the host option on imported routes: .. configuration-block:: From b9d04a63bf7a1b393cd0bd19a0a3033a0c898605 Mon Sep 17 00:00:00 2001 From: Wouter J Date: Tue, 29 Oct 2013 15:22:39 +0100 Subject: [PATCH 0676/2078] Tweaked article even more --- components/routing/hostname_pattern.rst | 152 +++++++++++++++++++++--- 1 file changed, 134 insertions(+), 18 deletions(-) diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst index 7fc34dad4e0..f4f205b50f2 100644 --- a/components/routing/hostname_pattern.rst +++ b/components/routing/hostname_pattern.rst @@ -60,17 +60,63 @@ You can also match on the HTTP *host* of the incoming request. Both routes match the same path ``/``, however the first one will match only if the host is ``m.example.com``. -Placeholders and Requirements in Hostname Patterns --------------------------------------------------- +Using Placeholders +------------------ -If you're using the :doc:`DependencyInjection Component ` -(or the full Symfony2 Framework), then you can use -:ref:`service container parameters ` as -variables anywhere in your routes. +The host option uses the same syntax as the path matching system. This means +you can use placeholders in your hostname: -You can avoid hardcoding the domain name by using a placeholder and a requirement. -The ``%domain%`` in requirements is replaced by the value of the ``domain`` -dependency injection container parameter. +.. configuration-block:: + + .. code-block:: yaml + + projects_homepage: + path: / + host: {project_name}.example.com + defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } + + homepage: + path: / + defaults: { _controller: AcmeDemoBundle:Main:homepage } + + .. code-block:: xml + + + + + + + AcmeDemoBundle:Main:mobileHomepage + + + + AcmeDemoBundle:Main:homepage + + + + .. code-block:: php + + use Symfony\Component\Routing\RouteCollection; + use Symfony\Component\Routing\Route; + + $collection = new RouteCollection(); + $collection->add('project_homepage', new Route('/', array( + '_controller' => 'AcmeDemoBundle:Main:mobileHomepage', + ), array(), array(), '{project_name}.example.com')); + + $collection->add('homepage', new Route('/', array( + '_controller' => 'AcmeDemoBundle:Main:homepage', + ))); + + return $collection; + +You can also set requirements and default options for these placeholders. For +instance, if you want to match both ``m.example.com`` and +``mobile.example.com``, you use this: .. configuration-block:: @@ -78,25 +124,32 @@ dependency injection container parameter. mobile_homepage: path: / - host: m.{domain} - defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } + host: {subdomain}.example.com + defaults: + _controller: AcmeDemoBundle:Main:mobileHomepage + subdomain: m requirements: - domain: "%domain%" + subdomain: m|mobile homepage: - path: / + path: / defaults: { _controller: AcmeDemoBundle:Main:homepage } .. code-block:: xml + + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd" + > - + AcmeDemoBundle:Main:mobileHomepage - %domain% + m + + m|mobile @@ -112,9 +165,10 @@ dependency injection container parameter. $collection = new RouteCollection(); $collection->add('mobile_homepage', new Route('/', array( '_controller' => 'AcmeDemoBundle:Main:mobileHomepage', + 'subdomain' => 'm', ), array( - 'domain' => '%domain%', - ), array(), 'm.{domain}')); + 'subdomain' => 'm|mobile', + ), array(), '{subdomain}.example.com')); $collection->add('homepage', new Route('/', array( '_controller' => 'AcmeDemoBundle:Main:homepage', @@ -122,6 +176,68 @@ dependency injection container parameter. return $collection; +.. tip:: + + Make sure you also include a default option for the ``subdomain`` + placeholder, otherwise you need to include the subdomains value each time + you generate the route. + +.. sidebar:: Using Service Parameters + + You can also use service parameters if you do not want to hardcode the + hostname: + + .. configuration-block:: + + .. code-block:: yaml + + mobile_homepage: + path: / + host: m.{domain} + defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } + requirements: + domain: "%domain%" + + homepage: + path: / + defaults: { _controller: AcmeDemoBundle:Main:homepage } + + .. code-block:: xml + + + + + + + AcmeDemoBundle:Main:mobileHomepage + %domain% + + + + AcmeDemoBundle:Main:homepage + + + + .. code-block:: php + + use Symfony\Component\Routing\RouteCollection; + use Symfony\Component\Routing\Route; + + $collection = new RouteCollection(); + $collection->add('mobile_homepage', new Route('/', array( + '_controller' => 'AcmeDemoBundle:Main:mobileHomepage', + ), array( + 'domain' => '%domain%', + ), array(), 'm.{domain}')); + + $collection->add('homepage', new Route('/', array( + '_controller' => 'AcmeDemoBundle:Main:homepage', + ))); + + return $collection; + .. _component-routing-host-imported: Using Host Matching of Imported Routes From cd30516d068a1604191bc1f6dbe20255fc56a8b3 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 30 Oct 2013 06:39:35 +0100 Subject: [PATCH 0677/2078] [Components][Templating] Fix typo --- components/templating/helpers/assetshelper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/templating/helpers/assetshelper.rst b/components/templating/helpers/assetshelper.rst index 52b014bbc9d..3ac127e987b 100644 --- a/components/templating/helpers/assetshelper.rst +++ b/components/templating/helpers/assetshelper.rst @@ -14,7 +14,7 @@ generating asset paths: The assets helper can then be configured to render paths to a CDN or modify -the paths in case your assets live in a sub-directory if your host (e.g. ``http://example.com/app``). +the paths in case your assets live in a sub-directory of your host (e.g. ``http://example.com/app``). Configure Paths --------------- From bfd456158486f4fd644ce0e2207c7207a9c32214 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 30 Oct 2013 06:50:19 +0100 Subject: [PATCH 0678/2078] [Components][Event Dispatcher] Fix event name --- components/event_dispatcher/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/event_dispatcher/introduction.rst b/components/event_dispatcher/introduction.rst index 522e9a89aab..5eb9769ef1b 100644 --- a/components/event_dispatcher/introduction.rst +++ b/components/event_dispatcher/introduction.rst @@ -188,7 +188,7 @@ In many cases, a special ``Event`` subclass that's specific to the given event is passed to the listener. This gives the listener access to special information about the event. Check the documentation or implementation of each event to determine the exact ``Symfony\Component\EventDispatcher\Event`` -instance that's being passed. For example, the ``kernel.event`` event passes an +instance that's being passed. For example, the ``kernel.response`` event passes an instance of ``Symfony\Component\HttpKernel\Event\FilterResponseEvent``:: use Symfony\Component\HttpKernel\Event\FilterResponseEvent; From bfbacea0b73d82f7339dc7546fc6761e8b302d74 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 30 Oct 2013 06:54:54 +0100 Subject: [PATCH 0679/2078] [Components][Event Dispatcher] Fix "store.order" event name in code example comment --- components/event_dispatcher/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/event_dispatcher/introduction.rst b/components/event_dispatcher/introduction.rst index 522e9a89aab..dc988606eb3 100644 --- a/components/event_dispatcher/introduction.rst +++ b/components/event_dispatcher/introduction.rst @@ -306,7 +306,7 @@ the ``dispatch`` method. Now, any listener to the ``store.order`` event will receive the ``FilterOrderEvent`` and have access to the ``Order`` object via the ``getOrder`` method:: - // some listener class that's been registered for "STORE_ORDER" event + // some listener class that's been registered for "store.order" event use Acme\StoreBundle\Event\FilterOrderEvent; public function onStoreOrder(FilterOrderEvent $event) From 2de97125ddf47f1554012398efa0383170b4d633 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 30 Oct 2013 07:37:34 +0100 Subject: [PATCH 0680/2078] [Components][Event Dispatcher] Fix formatting and typo --- components/event_dispatcher/generic_event.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/event_dispatcher/generic_event.rst b/components/event_dispatcher/generic_event.rst index 654c2e51236..612a3d5bd58 100644 --- a/components/event_dispatcher/generic_event.rst +++ b/components/event_dispatcher/generic_event.rst @@ -8,8 +8,8 @@ The Generic Event Object The ``GenericEvent`` event class was added in Symfony 2.1 The base :class:`Symfony\\Component\\EventDispatcher\\Event` class provided by the -``Event Dispatcher`` component is deliberately sparse to allow the creation of -API specific event objects by inheritance using OOP. This allow for elegant and +Event Dispatcher component is deliberately sparse to allow the creation of +API specific event objects by inheritance using OOP. This allows for elegant and readable code in complex applications. The :class:`Symfony\\Component\\EventDispatcher\\GenericEvent` is available From 77d71b54de2a38ff24d2aec5a3f8f803993eb308 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 30 Oct 2013 07:50:30 +0100 Subject: [PATCH 0681/2078] [Components][Console] Replace ambiguous heading to generate unique anchor name --- components/console/helpers/dialoghelper.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index 1c910d4106d..039c2afcfa0 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -123,8 +123,8 @@ in the last argument. Using ``false`` means the amount of attempts is infinite. The user will be asked as long as he provides an invalid answer and will only be able to proceed if her input is valid. -Hiding the User's Response -~~~~~~~~~~~~~~~~~~~~~~~~~~ +Validating a hidden Response +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 2.2 The ``askHiddenResponseAndValidate`` method was added in Symfony 2.2. From be7ee70ad17100dfc2e906864275ffb5020384dc Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 30 Oct 2013 08:15:16 +0100 Subject: [PATCH 0682/2078] [Components][Filesystem] Move version hint for dumpFile method --- components/filesystem.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/filesystem.rst b/components/filesystem.rst index fe8c93439d6..f7b11cacce8 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -229,12 +229,12 @@ isAbsolutePath // return false $fs->isAbsolutePath('../dir'); -.. versionadded:: 2.3 - ``dumpFile`` is new in Symfony 2.3 - dumpFile ~~~~~~~~ +.. versionadded:: 2.3 +``dumpFile`` is new in Symfony 2.3 + :method:`Symfony\\Component\\Filesystem\\Filesystem::dumpFile` allows you to dump contents to a file. It does this in an atomic manner: it writes a temporary file first and then moves it to the new file location when it's finished. From dda6dde68143d3ca970a7c1cbd63a402eefec370 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 30 Oct 2013 08:43:47 +0100 Subject: [PATCH 0683/2078] [Components][Filesystem] Fix versionadded box indentation --- components/filesystem.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/filesystem.rst b/components/filesystem.rst index f7b11cacce8..c6ec42de2fa 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -233,7 +233,7 @@ dumpFile ~~~~~~~~ .. versionadded:: 2.3 -``dumpFile`` is new in Symfony 2.3 + ``dumpFile`` is new in Symfony 2.3 :method:`Symfony\\Component\\Filesystem\\Filesystem::dumpFile` allows you to dump contents to a file. It does this in an atomic manner: it writes a temporary From 6c8763da54f85719184e41e28ce19b22e6ba5bc6 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 30 Oct 2013 09:26:16 +0100 Subject: [PATCH 0684/2078] [Components][Filesystem] Fix typo --- components/filesystem.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/filesystem.rst b/components/filesystem.rst index 44e010b88d1..9ce05fd007c 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -50,7 +50,7 @@ endpoint for filesystem operations:: Mkdir ~~~~~ -:method:`Symfony\\Component\\Filesystem\\Filesystem::mkdir` creates directory. +:method:`Symfony\\Component\\Filesystem\\Filesystem::mkdir` creates a directory. On posix filesystems, directories are created with a default mode value `0777`. You can use the second argument to set your own mode:: From d43395ba8b37e47fa8085d7310510b81f5e70bae Mon Sep 17 00:00:00 2001 From: Carlton Date: Wed, 30 Oct 2013 15:30:15 +0000 Subject: [PATCH 0685/2078] Update tablehelper.rst Some typos --- components/console/helpers/tablehelper.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/console/helpers/tablehelper.rst b/components/console/helpers/tablehelper.rst index 04301af5048..1145dd7b603 100644 --- a/components/console/helpers/tablehelper.rst +++ b/components/console/helpers/tablehelper.rst @@ -48,8 +48,8 @@ You can also control table rendering by setting custom rendering option values: * :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setPaddingChar` * :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setHorizontalBorderChar` * :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setVerticalBorderChar` -* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setVrossingChar` -* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setVellHeaderFormat` -* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setVellRowFormat` +* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setCrossingChar` +* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setCellHeaderFormat` +* :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setCellRowFormat` * :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setBorderFormat` * :method:`Symfony\\Component\\Console\\Helper\\TableHelper::setPadType` From d662134024091b66f9009831f665684d3efefbfa Mon Sep 17 00:00:00 2001 From: Pablo Godel Date: Thu, 31 Oct 2013 17:07:56 -0400 Subject: [PATCH 0686/2078] Added link to tablehelper --- components/console/introduction.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/components/console/introduction.rst b/components/console/introduction.rst index 451b6f18722..ad2d9027091 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -370,6 +370,7 @@ tools capable of helping you with different tasks: * :doc:`/components/console/helpers/dialoghelper`: interactively ask the user for information * :doc:`/components/console/helpers/formatterhelper`: customize the output colorization * :doc:`/components/console/helpers/progresshelper`: shows a progress bar +* :doc:`/components/console/helpers/tablehelper`: displays tabular data as a table Testing Commands ---------------- From a903d397452897f4259ae4ca48adac4d50c5843b Mon Sep 17 00:00:00 2001 From: danjamin Date: Thu, 31 Oct 2013 15:39:56 -0700 Subject: [PATCH 0687/2078] [deployment] Included "no-dev" flag in composer install --- cookbook/deployment-tools.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cookbook/deployment-tools.rst b/cookbook/deployment-tools.rst index b016905cd98..3d271159678 100644 --- a/cookbook/deployment-tools.rst +++ b/cookbook/deployment-tools.rst @@ -88,12 +88,14 @@ as your normally do: .. code-block:: bash - $ php composer.phar install --optimize-autoloader + $ php composer.phar install --no-dev --optimize-autoloader .. tip:: The ``--optimize-autoloader`` flag makes Composer's autoloader more - performant by building a "class map". + performant by building a "class map". The ``--no-dev`` flag + ensures that development packages are not installed in the production + environment. C) Clear your Symfony cache ~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 70b22ba2d24e753bde8ed5e18620a00ae1fba944 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 1 Nov 2013 10:59:54 -0500 Subject: [PATCH 0688/2078] [#3066] Minor tweak thanks to @WouterJ --- cookbook/console/sending_emails.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/console/sending_emails.rst b/cookbook/console/sending_emails.rst index 5b0a4af9a6f..6cc892e57f8 100644 --- a/cookbook/console/sending_emails.rst +++ b/cookbook/console/sending_emails.rst @@ -102,7 +102,7 @@ console command:: $message = new \Swift_Message(); - // prepare the message... + // ... prepare the message $container = $this->getContainer(); $mailer = $container->get('mailer'); From 5753411bf2dd192cad2555207ff3ab70c71b8874 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Fri, 1 Nov 2013 20:57:39 +0100 Subject: [PATCH 0689/2078] Update references to current branch E.g. changed "2.2" to "2.3" and so on --- contributing/documentation/overview.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/contributing/documentation/overview.rst b/contributing/documentation/overview.rst index 60f93d72178..c47b9162060 100644 --- a/contributing/documentation/overview.rst +++ b/contributing/documentation/overview.rst @@ -13,7 +13,7 @@ Before contributing, you need to become familiar with the :doc:`markup language ` used by the documentation. The Symfony2 documentation is hosted on GitHub: - +2 .. code-block:: text https://github.com/symfony/symfony-docs @@ -29,17 +29,17 @@ Consistent with Symfony's source code, the documentation repository is split int multiple branches, corresponding to the different versions of Symfony itself. The ``master`` branch holds the documentation for the development branch of the code. -Unless you're documenting a feature that was introduced *after* Symfony 2.2 -(e.g. in Symfony 2.3), your changes should always be based on the 2.2 branch. -To do this checkout the 2.2 branch before the next step: +Unless you're documenting a feature that was introduced *after* Symfony 2.3 +(e.g. in Symfony 2.4), your changes should always be based on the 2.3 branch. +To do this checkout the 2.3 branch before the next step: .. code-block:: bash - $ git checkout 2.2 + $ git checkout 2.3 .. tip:: - Your base branch (e.g. 2.2) will become the "Applies to" in the :ref:`doc-contributing-pr-format` + Your base branch (e.g. 2.3) will become the "Applies to" in the :ref:`doc-contributing-pr-format` that you'll use later. Next, create a dedicated branch for your changes (for organization): @@ -57,8 +57,8 @@ Creating a Pull Request Following the example, the pull request will default to be between your ``improving_foo_and_bar`` branch and the ``symfony-docs`` ``master`` branch. -If you have made your changes based on the 2.2 branch then you need to change -the base branch to be 2.2 on the preview page by clicking the ``edit`` button +If you have made your changes based on the 2.3 branch then you need to change +the base branch to be 2.3 on the preview page by clicking the ``edit`` button on the top left: .. image:: /images/docs-pull-request-change-base.png @@ -66,8 +66,8 @@ on the top left: .. note:: - All changes made to a branch (e.g. 2.2) will be merged up to each "newer" - branch (e.g. 2.3, master, etc) for the next release on a weekly basis. + All changes made to a branch (e.g. 2.3) will be merged up to each "newer" + branch (e.g. 2.4, master, etc) for the next release on a weekly basis. GitHub covers the topic of `pull requests`_ in detail. From 36baee179e4ded6be2d86cabc03e06f8559ec3fc Mon Sep 17 00:00:00 2001 From: Adrien Brault Date: Fri, 18 Oct 2013 14:55:12 -0700 Subject: [PATCH 0690/2078] Add warning about synchronized service with private services --- cookbook/service_container/scopes.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cookbook/service_container/scopes.rst b/cookbook/service_container/scopes.rst index 8f5e8af0cfe..a899a9196cc 100644 --- a/cookbook/service_container/scopes.rst +++ b/cookbook/service_container/scopes.rst @@ -209,6 +209,11 @@ your code. This should also be taken into account when declaring your service: ->setSynthetic(true) ->setSynchronized(true); +.. caution:: + + The service using the synchronized service will need to be public in order have its + setter called when the scope changes. + .. _changing-service-scope: Changing the Scope of your Service From dd2857ce49d8655e7ceac0b3e347d6433c06875f Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 1 Nov 2013 22:03:59 -0500 Subject: [PATCH 0691/2078] [#3072] Syntax tweaks thanks to @xabbuh --- cookbook/service_container/scopes.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cookbook/service_container/scopes.rst b/cookbook/service_container/scopes.rst index a899a9196cc..d30afe23f3d 100644 --- a/cookbook/service_container/scopes.rst +++ b/cookbook/service_container/scopes.rst @@ -210,9 +210,9 @@ your code. This should also be taken into account when declaring your service: ->setSynchronized(true); .. caution:: - - The service using the synchronized service will need to be public in order have its - setter called when the scope changes. + + The service using the synchronized service will need to be public in order + have its setter called when the scope changes. .. _changing-service-scope: From 859dc0852f5775c2e7a98ff977da1ad7a8d8c29c Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 1 Nov 2013 22:11:45 -0500 Subject: [PATCH 0692/2078] [#3075] Removing one nesting level from chapter - I'm going to use it in a second to nest something under forms --- components/dom_crawler.rst | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index bb45d6c2beb..bc57e2b15a8 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -212,13 +212,8 @@ and :phpclass:`DOMNode` objects: $html .= $domElement->ownerDocument->saveHTML($domElement); } -Form and Link support -~~~~~~~~~~~~~~~~~~~~~ - -Special treatment is given to links and forms inside the DOM tree. - Links -..... +~~~~~ To find a link by name (or a clickable image by its ``alt`` attribute), use the ``selectLink`` method on an existing crawler. This returns a Crawler @@ -246,7 +241,7 @@ methods to get more information about the selected link itself:: URI that you can act on. Forms -..... +~~~~~ Special treatment is also given to forms. A ``selectButton()`` method is available on the Crawler which returns another Crawler that matches a button From c3b32231736326051b0bfb95ff5ab0333b9b77d2 Mon Sep 17 00:00:00 2001 From: Pascal Borreli Date: Sun, 20 Oct 2013 11:38:56 +0000 Subject: [PATCH 0693/2078] Fixed typos --- contributing/documentation/standards.rst | 4 ++-- reference/constraints/Url.rst | 2 +- reference/forms/types/entity.rst | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contributing/documentation/standards.rst b/contributing/documentation/standards.rst index 385e0999e4e..fca5515fb89 100644 --- a/contributing/documentation/standards.rst +++ b/contributing/documentation/standards.rst @@ -7,14 +7,14 @@ look and feel familiar, you should follow these standards. Sphinx ------ -* The following characters are choosen for different heading levels: level 1 +* The following characters are chosen for different heading levels: level 1 is ``=``, level 2 ``-``, level 3 ``~``, level 4 ``.`` and level 5 ``"``; * Each line should break approximately after the first word that crosses the 72nd character (so most lines end up being 72-78 characters); * The ``::`` shorthand is *preferred* over ``.. code-block:: php`` to begin a PHP code block (read `the Sphinx documentation`_ to see when you should use the shorthand); -* Inline hyperlinks are **not** used. Seperate the link and their target +* Inline hyperlinks are **not** used. Separate the link and their target definition, which you add on the bottom of the page; * You should use a form of *you* instead of *we*. diff --git a/reference/constraints/Url.rst b/reference/constraints/Url.rst index 818156e3d73..0548c2f527d 100644 --- a/reference/constraints/Url.rst +++ b/reference/constraints/Url.rst @@ -62,7 +62,7 @@ Basic Usage // src/Acme/BlogBundle/Entity/Author.php namespace Acme\BlogBundle\Entity; - use Symfomy\Component\Validator\Mapping\ClassMetadata; + use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Constraints as Assert; class Author diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index f74f736e61b..dc4095c52d3 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -152,7 +152,7 @@ These options inherit from the :doc:`choice ` typ .. note:: If you are working with a collection of Doctrine entities, it will be helpful - to read the documention for the :doc:`/reference/forms/types/collection` + to read the documentation for the :doc:`/reference/forms/types/collection` as well. In addition, there is a complete example in the cookbook article :doc:`/cookbook/form/form_collections`. From fee90e9c27e79bf4b1b54c75ac94b4d17ec3e3af Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 1 Nov 2013 22:21:17 -0500 Subject: [PATCH 0694/2078] [#3076] Changes for 2.3 only thanks to @pborreli --- reference/constraints/GreaterThan.rst | 2 +- reference/constraints/Isbn.rst | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/reference/constraints/GreaterThan.rst b/reference/constraints/GreaterThan.rst index b3f4f42df79..1c1b19055d1 100644 --- a/reference/constraints/GreaterThan.rst +++ b/reference/constraints/GreaterThan.rst @@ -93,5 +93,5 @@ message **type**: ``string`` **default**: ``This value should be greater than {{ compared_value }}`` -This is the message that will be shown if the value is not greather than the +This is the message that will be shown if the value is not greater than the comparison value. diff --git a/reference/constraints/Isbn.rst b/reference/constraints/Isbn.rst index 48aa7ab9744..9b1b6c7e0e0 100644 --- a/reference/constraints/Isbn.rst +++ b/reference/constraints/Isbn.rst @@ -31,8 +31,8 @@ on an object that will contain a ISBN number. .. code-block:: yaml - # src/Acme/BookcaseBunlde/Resources/config/validation.yml - Acme\BookcaseBunlde\Entity\Book: + # src/Acme/BookcaseBundle/Resources/config/validation.yml + Acme\BookcaseBundle\Entity\Book: properties: isbn: - Isbn: @@ -42,7 +42,7 @@ on an object that will contain a ISBN number. .. code-block:: php-annotations - // src/Acme/BookcaseBunlde/Entity/Book.php + // src/Acme/BookcaseBundle/Entity/Book.php use Symfony\Component\Validator\Constraints as Assert; class Book @@ -59,8 +59,8 @@ on an object that will contain a ISBN number. .. code-block:: xml - - + + @@ -72,8 +72,8 @@ on an object that will contain a ISBN number. .. code-block:: php - // src/Acme/BookcaseBunlde/Entity/Book.php - namespace Acme\BookcaseBunlde\Entity; + // src/Acme/BookcaseBundle/Entity/Book.php + namespace Acme\BookcaseBundle\Entity; use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Constraints as Assert; From 0d9b720471cb832ad7cc5e4dc288bdca5af71f29 Mon Sep 17 00:00:00 2001 From: Prathap Date: Sun, 20 Oct 2013 19:48:56 +0100 Subject: [PATCH 0695/2078] Update minimum directory permissions to reflect apache 2.4 changes --- .../configuration/web_server_configuration.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cookbook/configuration/web_server_configuration.rst b/cookbook/configuration/web_server_configuration.rst index 21a7bbc4818..a1582de0997 100644 --- a/cookbook/configuration/web_server_configuration.rst +++ b/cookbook/configuration/web_server_configuration.rst @@ -49,6 +49,22 @@ following configuration snippet: .. code-block:: apache RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + + +Note: +----- + +In Apache 2.4, ``Order allow,deny`` has been replaced by ``Require all granted``, and hence +you need to modify your Directory permission settings as follows: + +.. code-block:: apache + + + # enable the .htaccess rewrites + AllowOverride All + Require all granted + + Nginx ----- From 3c853e8608864c076f1d9a67664eb0351ee4b934 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Fri, 1 Nov 2013 22:26:03 -0500 Subject: [PATCH 0696/2078] [#3077] Tweaking formatting on Apache 2.4 warning --- .../web_server_configuration.rst | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/cookbook/configuration/web_server_configuration.rst b/cookbook/configuration/web_server_configuration.rst index a1582de0997..f8dc7527d84 100644 --- a/cookbook/configuration/web_server_configuration.rst +++ b/cookbook/configuration/web_server_configuration.rst @@ -48,23 +48,20 @@ following configuration snippet: .. code-block:: apache - RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] - - -Note: ------ + RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] -In Apache 2.4, ``Order allow,deny`` has been replaced by ``Require all granted``, and hence -you need to modify your Directory permission settings as follows: +.. caution:: -.. code-block:: apache - - - # enable the .htaccess rewrites - AllowOverride All - Require all granted - + In Apache 2.4, ``Order allow,deny`` has been replaced by ``Require all granted``, + and hence you need to modify your Directory permission settings as follows: + + .. code-block:: apache + + # enable the .htaccess rewrites + AllowOverride All + Require all granted + Nginx ----- From d03715067910cf5446fc85677c7bd1c4029ba53f Mon Sep 17 00:00:00 2001 From: Wouter J Date: Sat, 2 Nov 2013 11:25:08 +0100 Subject: [PATCH 0697/2078] Fixed comments --- components/routing/hostname_pattern.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/routing/hostname_pattern.rst b/components/routing/hostname_pattern.rst index f4f205b50f2..38499a918d8 100644 --- a/components/routing/hostname_pattern.rst +++ b/components/routing/hostname_pattern.rst @@ -72,7 +72,7 @@ you can use placeholders in your hostname: projects_homepage: path: / - host: {project_name}.example.com + host: "{project_name}.example.com" defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } homepage: @@ -124,7 +124,7 @@ instance, if you want to match both ``m.example.com`` and mobile_homepage: path: / - host: {subdomain}.example.com + host: "{subdomain}.example.com" defaults: _controller: AcmeDemoBundle:Main:mobileHomepage subdomain: m @@ -193,7 +193,7 @@ instance, if you want to match both ``m.example.com`` and mobile_homepage: path: / - host: m.{domain} + host: "m.{domain}" defaults: { _controller: AcmeDemoBundle:Main:mobileHomepage } requirements: domain: "%domain%" From ef5c36859d8b5999e3363ef045a2a2bcf3b7e903 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Sat, 2 Nov 2013 18:53:22 +0100 Subject: [PATCH 0698/2078] Update overview.rst --- contributing/documentation/overview.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing/documentation/overview.rst b/contributing/documentation/overview.rst index c47b9162060..f264887670b 100644 --- a/contributing/documentation/overview.rst +++ b/contributing/documentation/overview.rst @@ -13,7 +13,7 @@ Before contributing, you need to become familiar with the :doc:`markup language ` used by the documentation. The Symfony2 documentation is hosted on GitHub: -2 + .. code-block:: text https://github.com/symfony/symfony-docs From 737029dce17c483c77b978a4acca2bab6467fe62 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sat, 2 Nov 2013 21:29:50 +0100 Subject: [PATCH 0699/2078] typos fixed --- book/testing.rst | 2 +- reference/constraints/Choice.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/book/testing.rst b/book/testing.rst index bb102586c06..c460c031d1c 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -245,7 +245,7 @@ document:: The ``server`` array is the raw values that you'd expect to normally find in the PHP `$_SERVER`_ superglobal. For example, to set the `Content-Type`, - `Referer` and `X-Requested-With' HTTP headers, you'd pass the following (mind + `Referer` and `X-Requested-With` HTTP headers, you'd pass the following (mind the `HTTP_` prefix for non standard headers):: $client->request( diff --git a/reference/constraints/Choice.rst b/reference/constraints/Choice.rst index 1dadf269eed..b3ce009bc4b 100644 --- a/reference/constraints/Choice.rst +++ b/reference/constraints/Choice.rst @@ -124,7 +124,7 @@ form element. } } -You can pass the name of this method to the `callback_` option of the ``Choice`` +You can pass the name of this method to the `callback`_ option of the ``Choice`` constraint. .. configuration-block:: From 6dd5cb4398cf538eba1fe98545b94da21eb5da09 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 3 Nov 2013 10:47:07 +0100 Subject: [PATCH 0700/2078] add missing version number to versionadded directive --- components/dom_crawler.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index d1ae7a66e3f..e2ad3f5e09b 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -157,7 +157,7 @@ Call an anonymous function on each node of the list:: return $node->text(); }); -.. versionadded:: +.. versionadded:: 2.3 As seen here, in Symfony 2.3, the ``each`` and ``reduce`` Closure functions are passed a ``Crawler`` as the first argument. Previously, that argument was a :phpclass:`DOMNode`. From 97c72fcc11d4711d7670bac69e99b2b26fc66eb9 Mon Sep 17 00:00:00 2001 From: silver-dima Date: Tue, 22 Oct 2013 17:04:18 +0300 Subject: [PATCH 0701/2078] Update class_extension.rst Remove illegal parameter --- cookbook/event_dispatcher/class_extension.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/event_dispatcher/class_extension.rst b/cookbook/event_dispatcher/class_extension.rst index 43d1f01793c..e85cca22421 100644 --- a/cookbook/event_dispatcher/class_extension.rst +++ b/cookbook/event_dispatcher/class_extension.rst @@ -77,7 +77,7 @@ use this pattern of class extension: $this->stopPropagation(); } - public function getReturnValue($val) + public function getReturnValue() { return $this->returnValue; } From a0b617ad8257b3488cbbd2eb02f8a1788392f6f1 Mon Sep 17 00:00:00 2001 From: Eike Send Date: Fri, 25 Oct 2013 17:35:47 +0200 Subject: [PATCH 0702/2078] Improve choice option documentation for entity form field type --- reference/forms/types/entity.rst | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index dc4095c52d3..60dab6e9229 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -55,6 +55,17 @@ as either a ``select`` tag, a set or radio buttons or a series of checkboxes If the entity object does not have a ``__toString()`` method the ``property`` option is needed. +Using Choices +~~~~~~~~~~~~~ + +If you want to limit the entities which are available as choices you can provide +them by calling the getter function of an entity: + + $builder->add('users', 'entity', array( + 'class' => 'AcmeHelloBundle:User', + 'choices' => $group->getUsers(), + )); + Using a Custom Query for the Entities ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -132,15 +143,17 @@ Overridden Options choices ~~~~~~~ -**default**: ``null`` +**type**: array || ``\Traversable`` **default**: all entities + +If the choices are provided only these will be available. The choices need to +be a traversable collection such as the +``Doctrine\Common\Collections\ArrayCollection`` containing only entities of the +specified class. choice_list ~~~~~~~~~~~ -**default**: all entities selected - -The choices will default to all entities selected with one of the options that -are documented above. +**default**: ``null`` Inherited options ----------------- From f0617588c52ca72d9d6be6e8c1c92bf8f78a9cae Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 3 Nov 2013 11:54:05 -0600 Subject: [PATCH 0703/2078] [#3098] Removing whitespace --- reference/forms/types/entity.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index 60dab6e9229..fd9629b082b 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -58,7 +58,7 @@ is needed. Using Choices ~~~~~~~~~~~~~ -If you want to limit the entities which are available as choices you can provide +If you want to limit the entities which are available as choices you can provide them by calling the getter function of an entity: $builder->add('users', 'entity', array( @@ -145,9 +145,9 @@ choices **type**: array || ``\Traversable`` **default**: all entities -If the choices are provided only these will be available. The choices need to -be a traversable collection such as the -``Doctrine\Common\Collections\ArrayCollection`` containing only entities of the +If the choices are provided only these will be available. The choices need to +be a traversable collection such as the +``Doctrine\Common\Collections\ArrayCollection`` containing only entities of the specified class. choice_list From e2307a93adb0f21593c054d34381d81b11e68da3 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 3 Nov 2013 12:07:13 -0600 Subject: [PATCH 0704/2078] [#3098] Tweaks to entity "choices" options Biggest thing was to make it clear that choices is a valid thing to set when using the entity type, but it's not the most common way of providing options. --- reference/forms/types/entity.rst | 47 +++++++++++++++++++------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst index fd9629b082b..29b73c2b4af 100644 --- a/reference/forms/types/entity.rst +++ b/reference/forms/types/entity.rst @@ -18,8 +18,8 @@ objects from the database. | | - `query_builder`_ | | | - `em`_ | +-------------+------------------------------------------------------------------+ -| Overridden | - `choices` | -| Options | - `choice_list` | +| Overridden | - `choices`_ | +| Options | - `choice_list`_ | +-------------+------------------------------------------------------------------+ | Inherited | - `required`_ | | options | - `label`_ | @@ -55,17 +55,6 @@ as either a ``select`` tag, a set or radio buttons or a series of checkboxes If the entity object does not have a ``__toString()`` method the ``property`` option is needed. -Using Choices -~~~~~~~~~~~~~ - -If you want to limit the entities which are available as choices you can provide -them by calling the getter function of an entity: - - $builder->add('users', 'entity', array( - 'class' => 'AcmeHelloBundle:User', - 'choices' => $group->getUsers(), - )); - Using a Custom Query for the Entities ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -84,6 +73,22 @@ option. The easiest way to use the option is as follows:: }, )); +.. _reference-forms-entity-choices: + +Using Choices +~~~~~~~~~~~~~ + +If you already have the exact collection of entities that you want included +in the choice element, you can simply pass them via the ``choices`` key. +For example, if you have a ``$group`` variable (passed into your form perhaps +as a form option) and ``getUsers`` returns a collection of ``User`` entities, +then you can supply the ``choices`` option directly:: + + $builder->add('users', 'entity', array( + 'class' => 'AcmeHelloBundle:User', + 'choices' => $group->getUsers(), + )); + .. include:: /reference/forms/types/options/select_how_rendered.rst.inc Field Options @@ -143,17 +148,21 @@ Overridden Options choices ~~~~~~~ -**type**: array || ``\Traversable`` **default**: all entities +**type**: array || ``\Traversable`` **default**: ``null`` -If the choices are provided only these will be available. The choices need to -be a traversable collection such as the -``Doctrine\Common\Collections\ArrayCollection`` containing only entities of the -specified class. +Instead of allowing the `class`_ and `query_builder`_ options to fetch the +entities to include for you, you can pass the ``choices`` option directly. +See :ref:`reference-forms-entity-choices`. choice_list ~~~~~~~~~~~ -**default**: ``null`` +**default**: :class:`Symfony\\Bridge\\Doctrine\\Form\\ChoiceList\\EntityChoiceList` + +The purpose of the ``entity`` type is to create and configure this ``EntityChoiceList`` +for you, by using all of the above options. If you need to override this +option, you may just consider using the :doc:`/reference/forms/types/choice` +directly. Inherited options ----------------- From 702c5a1778df91e3c5b54baf236b9489cba81113 Mon Sep 17 00:00:00 2001 From: Antonio Spinelli Date: Mon, 28 Oct 2013 15:26:02 -0200 Subject: [PATCH 0705/2078] fix url of Propel Documentation --- book/propel.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/propel.rst b/book/propel.rst index 3330b6216b2..ae189e7fb59 100644 --- a/book/propel.rst +++ b/book/propel.rst @@ -476,8 +476,8 @@ Commands You should read the dedicated section for `Propel commands in Symfony2`_. -.. _`Working With Symfony2`: http://propelorm.org/cookbook/symfony2/working-with-symfony2.html#installation -.. _`PropelBundle configuration section`: http://propelorm.org/cookbook/symfony2/working-with-symfony2.html#configuration +.. _`Working With Symfony2`: http://propelorm.org/Propel/cookbook/symfony2/working-with-symfony2.html#installation +.. _`PropelBundle configuration section`: http://propelorm.org/Propel/cookbook/symfony2/working-with-symfony2.html#configuration .. _`Relationships`: http://propelorm.org/documentation/04-relationships.html .. _`Behaviors reference section`: http://propelorm.org/documentation/#behaviors-reference -.. _`Propel commands in Symfony2`: http://propelorm.org/cookbook/symfony2/working-with-symfony2#the-commands +.. _`Propel commands in Symfony2`: http://propelorm.org/Propel/cookbook/symfony2/working-with-symfony2#the-commands From 292d7c0d59b75402bd8294446d9c1dc003e12557 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Mon, 28 Oct 2013 22:53:54 +0000 Subject: [PATCH 0706/2078] added missing crosslink from http://symfony.com/doc/current/components/security/authorization.html#access-decision-manager to http://symfony.com/doc/current/cookbook/security/voters.html#changing-the-access-decision-strategy added missing crosslink adding missing crosslink from http://symfony.com/doc/current/cookbook/security/voters.html#changing-the-access-decision-strategy to http://symfony.com/doc/current/components/security/authorization.html#access-decision-manager changed note:: to seealso:: changed note:: to seealso:: added full stop changed to labeled link changed link changed link added pointer added pointer --- components/security/authorization.rst | 7 +++++++ cookbook/security/voters.rst | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/components/security/authorization.rst b/components/security/authorization.rst index 7dc0433fd8e..0adc61cfb2c 100644 --- a/components/security/authorization.rst +++ b/components/security/authorization.rst @@ -29,6 +29,8 @@ An authorization decision will always be based on a few things: Any object on which for which access control needs to be checked, like an article or a comment object. +.. components-security-access-decision-manager: + Access Decision Manager ----------------------- @@ -69,6 +71,11 @@ recognizes several strategies: $allowIfAllAbstainDecisions, $allowIfEqualGrantedDeniedDecisions ); + +.. seealso:: + + You can change the default strategy in the + :ref:`configuration `. Voters ------ diff --git a/cookbook/security/voters.rst b/cookbook/security/voters.rst index 1db4a93d264..acd0f84d1e2 100644 --- a/cookbook/security/voters.rst +++ b/cookbook/security/voters.rst @@ -167,6 +167,8 @@ and tag it as a "security.voter": see :ref:`service-container-imports-directive`. To read more about defining services in general, see the :doc:`/book/service_container` chapter. +.. security-voters-change-strategy: + Changing the Access Decision Strategy ------------------------------------- @@ -212,3 +214,8 @@ application configuration file with the following code. That's it! Now, when deciding whether or not a user should have access, the new voter will deny access to any user in the list of blacklisted IPs. + +.. seealso:: + + For a more advanced usage see + :ref:`components-security-access-decision-manager`. From 62c9aade86e38f435280a9704588b1761dd6b265 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 3 Nov 2013 13:14:41 -0600 Subject: [PATCH 0707/2078] Adding a period --- components/filesystem.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/filesystem.rst b/components/filesystem.rst index 0ad9d9f76bb..f428999a217 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -233,7 +233,7 @@ dumpFile ~~~~~~~~ .. versionadded:: 2.3 - ``dumpFile`` is new in Symfony 2.3 + ``dumpFile`` is new in Symfony 2.3. :method:`Symfony\\Component\\Filesystem\\Filesystem::dumpFile` allows you to dump contents to a file. It does this in an atomic manner: it writes a temporary From 3e0515e83c3c5940b1228b793fcdd38c31598d9f Mon Sep 17 00:00:00 2001 From: manindersingh Date: Fri, 1 Nov 2013 16:38:10 +0530 Subject: [PATCH 0708/2078] When using pbkdf2 or bcrypt length 40 is not enough I used this entity to apply bcrypt encoded password but I was not able to login. It took me 2 days to debug that the password is being truncated because column length is less than the password which is being generated by bcrypt or pbkdf2. --- cookbook/security/entity_provider.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index 29768e8f541..2b27612cabe 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -83,7 +83,7 @@ focus on the most important methods that come from the private $salt; /** - * @ORM\Column(type="string", length=40) + * @ORM\Column(type="string", length=64) */ private $password; From fb312db784701485f886eddffa71b754c38db4ba Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 3 Nov 2013 14:36:30 -0600 Subject: [PATCH 0709/2078] Fixing some single ticks (e.g. `foo` -> ``foo``) --- book/testing.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/testing.rst b/book/testing.rst index c460c031d1c..7a53cbbeac0 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -244,9 +244,9 @@ document:: ) The ``server`` array is the raw values that you'd expect to normally - find in the PHP `$_SERVER`_ superglobal. For example, to set the `Content-Type`, - `Referer` and `X-Requested-With` HTTP headers, you'd pass the following (mind - the `HTTP_` prefix for non standard headers):: + find in the PHP `$_SERVER`_ superglobal. For example, to set the ``Content-Type``, + ``Referer`` and ``X-Requested-With`` HTTP headers, you'd pass the following (mind + the ``HTTP_`` prefix for non standard headers):: $client->request( 'GET', From d4198fca9c8d11d0fb12bc876e7ca2d4ccc9e5b6 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 3 Nov 2013 10:29:52 +0100 Subject: [PATCH 0710/2078] append 'to' to 'in order' --- cookbook/service_container/scopes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/service_container/scopes.rst b/cookbook/service_container/scopes.rst index d30afe23f3d..01f328aca24 100644 --- a/cookbook/service_container/scopes.rst +++ b/cookbook/service_container/scopes.rst @@ -212,7 +212,7 @@ your code. This should also be taken into account when declaring your service: .. caution:: The service using the synchronized service will need to be public in order - have its setter called when the scope changes. + to have its setter called when the scope changes. .. _changing-service-scope: From a92e39edde199f0dcafcde51e39684b42f0c9376 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 4 Nov 2013 18:14:52 +0100 Subject: [PATCH 0711/2078] fix labels introduced in #3120 --- components/security/authorization.rst | 6 +++--- cookbook/security/voters.rst | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/security/authorization.rst b/components/security/authorization.rst index 0adc61cfb2c..9cf532d59f2 100644 --- a/components/security/authorization.rst +++ b/components/security/authorization.rst @@ -29,7 +29,7 @@ An authorization decision will always be based on a few things: Any object on which for which access control needs to be checked, like an article or a comment object. -.. components-security-access-decision-manager: +.. _components-security-access-decision-manager: Access Decision Manager ----------------------- @@ -71,10 +71,10 @@ recognizes several strategies: $allowIfAllAbstainDecisions, $allowIfEqualGrantedDeniedDecisions ); - + .. seealso:: - You can change the default strategy in the + You can change the default strategy in the :ref:`configuration `. Voters diff --git a/cookbook/security/voters.rst b/cookbook/security/voters.rst index acd0f84d1e2..38e43cd5e0f 100644 --- a/cookbook/security/voters.rst +++ b/cookbook/security/voters.rst @@ -167,7 +167,7 @@ and tag it as a "security.voter": see :ref:`service-container-imports-directive`. To read more about defining services in general, see the :doc:`/book/service_container` chapter. -.. security-voters-change-strategy: +.. _security-voters-change-strategy: Changing the Access Decision Strategy ------------------------------------- @@ -217,5 +217,5 @@ the new voter will deny access to any user in the list of blacklisted IPs. .. seealso:: - For a more advanced usage see + For a more advanced usage see :ref:`components-security-access-decision-manager`. From a5c4a4fe159f75fd17fee42eacaec77b1b4d7e35 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 13 Sep 2013 11:00:44 +0200 Subject: [PATCH 0712/2078] use handleRequest() instead of bind() --- components/form/introduction.rst | 70 ++++++++++++-------------------- 1 file changed, 27 insertions(+), 43 deletions(-) diff --git a/components/form/introduction.rst b/components/form/introduction.rst index 90c93ce4dc0..a7f86a86e09 100644 --- a/components/form/introduction.rst +++ b/components/form/introduction.rst @@ -66,13 +66,13 @@ factory. Request Handling ~~~~~~~~~~~~~~~~ -To process form data, you'll need to grab information off of the request (typically -``$_POST`` data) and pass the array of submitted data to -:method:`Symfony\\Component\\Form\\Form::bind`. The Form component optionally -integrates with Symfony's :doc:`HttpFoundation ` -component to make this even easier. +.. versionadded:: 2.3 + The ``handleRequest()`` method was added in Symfony 2.3. -To integrate the HttpFoundation component, add the +To process form data, you'll need to call the :method:`Symfony\\Component\\Form\\Form::handleRequest` +method. + +To optionally integrate the HttpFoundation component, add the :class:`Symfony\\Component\\Form\\Extension\\HttpFoundation\\HttpFoundationExtension` to your form factory:: @@ -84,8 +84,7 @@ to your form factory:: ->getFormFactory(); Now, when you process a form, you can pass the :class:`Symfony\\Component\\HttpFoundation\\Request` -object to :method:`Symfony\\Component\\Form\\Form::bind` instead of the raw -array of submitted values. +object to :method:`Symfony\\Component\\Form\\Form::handleRequest`. .. note:: @@ -480,7 +479,7 @@ to do that in the ":ref:`form-rendering-template`" section. Handling Form Submissions ~~~~~~~~~~~~~~~~~~~~~~~~~ -To handle form submissions, use the :method:`Symfony\\Component\\Form\\Form::bind` +To handle form submissions, use the :method:`Symfony\\Component\\Form\\Form::handleRequest` method: .. configuration-block:: @@ -497,19 +496,17 @@ method: $request = Request::createFromGlobals(); - if ($request->isMethod('POST')) { - $form->bind($request); + $form->handleRequest($request); - if ($form->isValid()) { - $data = $form->getData(); + if ($form->isValid()) { + $data = $form->getData(); - // ... perform some action, such as saving the data to the database + // ... perform some action, such as saving the data to the database - $response = new RedirectResponse('/task/success'); - $response->prepare($request); + $response = new RedirectResponse('/task/success'); + $response->prepare($request); - return $response->send(); - } + return $response->send(); } // ... @@ -525,17 +522,14 @@ method: ->add('dueDate', 'date') ->getForm(); - // only process the form if the request is a POST request - if ($request->isMethod('POST')) { - $form->bind($request); + $form->handleRequest($request); - if ($form->isValid()) { - $data = $form->getData(); + if ($form->isValid()) { + $data = $form->getData(); - // ... perform some action, such as saving the data to the database + // ... perform some action, such as saving the data to the database - return $this->redirect($this->generateUrl('task_success')); - } + return $this->redirect($this->generateUrl('task_success')); } // ... @@ -546,25 +540,15 @@ This defines a common form "workflow", which contains 3 different possibilities: 1) On the initial GET request (i.e. when the user "surfs" to your page), build your form and render it; -If the request is a POST, process the submitted data (via ``bind``). Then: +If the request is a POST, process the submitted data (via ``handleRequest()``). +Then: -2) if the form is invalid, re-render the form (which will now contain errors) -3) if the form is valid, perform some action and redirect; - -.. note:: - - If you're not using HttpFoundation, just pass the POST'ed data directly - to ``bind``:: - - if (isset($_POST[$form->getName()])) { - $form->bind($_POST[$form->getName()]); - - // ... - } +2) if the form is invalid, re-render the form (which will now contain errors); +3) if the form is valid, perform some action and redirect. - If you're uploading files, you'll need to do a little bit more work by - merging the ``$_POST`` array with the ``$_FILES`` array before passing - it into ``bind``. +Luckily, you don't need to decide whether or not a form has been submitted. +Just pass the current request to the ``handleRequest()`` method. Then, the Form +component will do all the necessary work for you. .. _component-form-intro-validation: From 3785c68232049d25d7a8b9d604ee8d5b55315075 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Tue, 5 Nov 2013 06:55:53 +0100 Subject: [PATCH 0713/2078] [Components][Console] Fix lowercase to uppercase --- components/console/helpers/dialoghelper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index 039c2afcfa0..ffad2181dd8 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -123,7 +123,7 @@ in the last argument. Using ``false`` means the amount of attempts is infinite. The user will be asked as long as he provides an invalid answer and will only be able to proceed if her input is valid. -Validating a hidden Response +Validating a Hidden Response ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 2.2 From 5638aef2c6e17d11c6fd918aff31e206062768a6 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Tue, 5 Nov 2013 08:06:54 +0100 Subject: [PATCH 0714/2078] [Reference][Contraints] Fix internal "fields" link --- reference/constraints/Collection.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/Collection.rst b/reference/constraints/Collection.rst index ae25d16bb87..c1cd4501a40 100644 --- a/reference/constraints/Collection.rst +++ b/reference/constraints/Collection.rst @@ -316,7 +316,7 @@ allowMissingFields If this option is set to ``false`` and one or more fields from the `fields`_ option are not present in the underlying collection, a validation error will -be returned. If set to ``true``, it's ok if some fields in the `fields_` +be returned. If set to ``true``, it's ok if some fields in the `fields`_ option are not present in the underlying collection. missingFieldsMessage From 4a8d14e339f7121a361066da5fad8092172e05b0 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Tue, 5 Nov 2013 08:14:43 +0100 Subject: [PATCH 0715/2078] [Reference][DI Tags] Fix typos and formatting --- reference/dic_tags.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index 1fb0e452c25..026e2b39ed3 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -108,7 +108,7 @@ In order to add a new worker, first create a class:: } -And then add register it as a tagged service: +And then register it as a tagged service: .. configuration-block:: @@ -299,7 +299,7 @@ the interface directly:: } In order for Symfony to know about your form extension and use it, give it -the `form.type_extension` tag: +the ``form.type_extension`` tag: .. configuration-block:: @@ -370,7 +370,7 @@ service class:: } -Then register this class and tag it with ``kernel.cache:clearer``: +Then register this class and tag it with ``kernel.cache_clearer``: .. configuration-block:: @@ -431,7 +431,7 @@ The ``isOptional`` method should return true if it's possible to use the application without calling this cache warmer. In Symfony 2.0, optional warmers are always executed anyways, so this function has no real effect. -To register your warmer with Symfony, give it the kernel.cache_warmer tag: +To register your warmer with Symfony, give it the ``kernel.cache_warmer`` tag: .. configuration-block:: @@ -486,7 +486,7 @@ core Symfony listeners and their priorities. All listeners listed here may not be listening depending on your environment, settings and bundles. Additionally, third-party bundles will bring in - additional listener not listed here. + additional listeners not listed here. kernel.request .............. @@ -606,7 +606,7 @@ configuration, and tag it with ``kernel.event_subscriber``: kernel.fragment_renderer ------------------------ -**Purpose**: Add a new HTTP content rendering strategy. +**Purpose**: Add a new HTTP content rendering strategy To add a new rendering strategy - in addition to the core strategies like ``EsiFragmentRenderer`` - create a class that implements @@ -1091,7 +1091,7 @@ configuration, and tag it with ``twig.extension``: For information on how to create the actual Twig Extension class, see `Twig's documentation`_ on the topic or read the cookbook article: -:doc:`/cookbook/templating/twig_extension` +:doc:`/cookbook/templating/twig_extension`. Before writing your own extensions, have a look at the `Twig official extension repository`_ which already includes several From 87a15df786256a087bc590d4f4efd381afe6adbb Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Tue, 5 Nov 2013 08:17:38 +0100 Subject: [PATCH 0716/2078] [Reference][Requirements] Fix missing literal formatting --- reference/requirements.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/requirements.rst b/reference/requirements.rst index fbcb316f790..447b4f1d6e4 100644 --- a/reference/requirements.rst +++ b/reference/requirements.rst @@ -22,7 +22,7 @@ Required * PHP needs to be a minimum version of PHP 5.3.3 * JSON needs to be enabled * ctype needs to be enabled -* Your PHP.ini needs to have the date.timezone setting +* Your PHP.ini needs to have the ``date.timezone`` setting Optional -------- From 865b87870cbb92241d26055f960f92cdac125482 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Tue, 5 Nov 2013 08:30:55 +0100 Subject: [PATCH 0717/2078] Fix spelling for "object-oriented" --- book/internals.rst | 2 +- components/http_foundation/introduction.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/book/internals.rst b/book/internals.rst index e7bd94369b1..ba221e085b1 100644 --- a/book/internals.rst +++ b/book/internals.rst @@ -30,7 +30,7 @@ on top of the previous one. The deepest level is the :namespace:`Symfony\\Component\\HttpFoundation` component. HttpFoundation provides the main objects needed to deal with HTTP. -It is an Object-Oriented abstraction of some native PHP functions and +It is an object-oriented abstraction of some native PHP functions and variables: * The :class:`Symfony\\Component\\HttpFoundation\\Request` class abstracts diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index bf2c4ac0fd4..605775fd08a 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -14,7 +14,7 @@ In PHP, the request is represented by some global variables (``$_GET``, generated by some functions (``echo``, ``header``, ``setcookie``, ...). The Symfony2 HttpFoundation component replaces these default PHP global -variables and functions by an Object-Oriented layer. +variables and functions by an object-oriented layer. Installation ------------ From edf7961a459770bfd395ed7b107474f8340e8c57 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Tue, 5 Nov 2013 10:34:29 +0100 Subject: [PATCH 0718/2078] Normalize notation of php.ini --- components/http_foundation/session_configuration.rst | 6 +++--- components/http_foundation/sessions.rst | 2 +- cookbook/form/form_collections.rst | 2 +- reference/configuration/framework.rst | 2 +- reference/constraints/File.rst | 2 +- reference/requirements.rst | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index 7af9a0e947a..d6084fbc3b9 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -26,7 +26,7 @@ So-called 'native' handlers, are save handlers which are either compiled into PHP or provided by PHP extensions, such as PHP-Sqlite, PHP-Memcached and so on. All native save handlers are internal to PHP and as such, have no public facing API. -They must be configured by PHP ini directives, usually ``session.save_path`` and +They must be configured by php.ini directives, usually ``session.save_path`` and potentially other driver specific directives. Specific details can be found in docblock of the ``setOptions()`` method of each class. @@ -87,7 +87,7 @@ Configuring PHP Sessions ~~~~~~~~~~~~~~~~~~~~~~~~ The :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage` -can configure most of the PHP ini configuration directives which are documented +can configure most of the php.ini configuration directives which are documented at `php.net/session.configuration`_. To configure these settings, pass the keys (omitting the initial ``session.`` part @@ -131,7 +131,7 @@ example if these were set to ``5/100`` respectively, it would mean a probability of 5%. Similarly, ``3/4`` would mean a 3 in 4 chance of being called, i.e. 75%. If the garbage collection handler is invoked, PHP will pass the value stored in -the PHP ini directive ``session.gc_maxlifetime``. The meaning in this context is +the php.ini directive ``session.gc_maxlifetime``. The meaning in this context is that any stored session that was saved more than ``maxlifetime`` ago should be deleted. This allows one to expire records based on idle time. diff --git a/components/http_foundation/sessions.rst b/components/http_foundation/sessions.rst index c8efc9f3af7..24d2b2b76c6 100644 --- a/components/http_foundation/sessions.rst +++ b/components/http_foundation/sessions.rst @@ -50,7 +50,7 @@ Quick example:: .. caution:: - Symfony sessions are incompatible with PHP ini directive ``session.auto_start = 1`` + Symfony sessions are incompatible with php.ini directive ``session.auto_start = 1`` This directive should be turned off in ``php.ini``, in the webserver directives or in ``.htaccess``. diff --git a/cookbook/form/form_collections.rst b/cookbook/form/form_collections.rst index 2210c9f5b16..f6a19e2de80 100755 --- a/cookbook/form/form_collections.rst +++ b/cookbook/form/form_collections.rst @@ -258,7 +258,7 @@ great, your user can't actually add any new tags yet. This directive limits recursion to 100 calls which may not be enough for rendering the form in the template if you render the whole form at once (e.g ``form_widget(form)``). To fix this you can set this directive - to a higher value (either via a PHP ini file or via :phpfunction:`ini_set`, + to a higher value (either via a php.ini file or via :phpfunction:`ini_set`, for example in ``app/autoload.php``) or render each form field by hand using ``form_row``. diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index b9187691f2f..5996615cbaf 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -79,7 +79,7 @@ full TextMate string would look like this: Of course, since every developer uses a different IDE, it's better to set this on a system level. This can be done by setting the ``xdebug.file_link_format`` -PHP.ini value to the file link string. If this configuration value is set, then +php.ini value to the file link string. If this configuration value is set, then the ``ide`` option does not need to be specified. .. _reference-framework-test: diff --git a/reference/constraints/File.rst b/reference/constraints/File.rst index 8ece814cd7a..b082a8caf5d 100644 --- a/reference/constraints/File.rst +++ b/reference/constraints/File.rst @@ -217,7 +217,7 @@ uploadIniSizeErrorMessage **type**: ``string`` **default**: ``The file is too large. Allowed maximum size is {{ limit }}`` The message that is displayed if the uploaded file is larger than the ``upload_max_filesize`` -PHP.ini setting. +php.ini setting. uploadFormSizeErrorMessage ~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/reference/requirements.rst b/reference/requirements.rst index 447b4f1d6e4..59be11f6245 100644 --- a/reference/requirements.rst +++ b/reference/requirements.rst @@ -22,7 +22,7 @@ Required * PHP needs to be a minimum version of PHP 5.3.3 * JSON needs to be enabled * ctype needs to be enabled -* Your PHP.ini needs to have the ``date.timezone`` setting +* Your php.ini needs to have the ``date.timezone`` setting Optional -------- @@ -35,7 +35,7 @@ Optional * POSIX needs to be enabled (only on \*nix) * Intl needs to be installed with ICU 4+ * APC 3.0.17+ (or another opcode cache needs to be installed) -* PHP.ini recommended settings +* php.ini recommended settings * ``short_open_tag = Off`` * ``magic_quotes_gpc = Off`` From 7cbcf20dd0ccee1d5e9775a3348bfebe948782bb Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Tue, 5 Nov 2013 11:54:45 +0100 Subject: [PATCH 0719/2078] Add missing literal formatting to all usages of php.ini filename --- book/performance.rst | 2 +- components/http_foundation/introduction.rst | 2 +- components/http_foundation/session_configuration.rst | 6 +++--- components/http_foundation/sessions.rst | 2 +- cookbook/form/form_collections.rst | 2 +- reference/configuration/framework.rst | 2 +- reference/constraints/File.rst | 2 +- reference/requirements.rst | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/book/performance.rst b/book/performance.rst index 7ecc1da2937..c3f3debd559 100644 --- a/book/performance.rst +++ b/book/performance.rst @@ -37,7 +37,7 @@ to ensure that the cache is cleared whenever any source files change. Otherwise, the updates you've made won't be seen. For example, to disable these checks in APC, simply add ``apc.stat=0`` to -your php.ini configuration. +your ``php.ini`` configuration. .. index:: single: Performance; Autoloader diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index bf2c4ac0fd4..a2cadf911d2 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -415,7 +415,7 @@ represented by a PHP callable instead of a string:: .. note:: The ``flush()`` function does not flush buffering. If ``ob_start()`` has - been called before or the ``output_buffering`` php.ini option is enabled, + been called before or the ``output_buffering`` ``php.ini`` option is enabled, you must call ``ob_flush()`` before ``flush()``. Additionally, PHP isn't the only layer that can buffer output. Your web diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index d6084fbc3b9..a55957b0986 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -26,7 +26,7 @@ So-called 'native' handlers, are save handlers which are either compiled into PHP or provided by PHP extensions, such as PHP-Sqlite, PHP-Memcached and so on. All native save handlers are internal to PHP and as such, have no public facing API. -They must be configured by php.ini directives, usually ``session.save_path`` and +They must be configured by ``php.ini`` directives, usually ``session.save_path`` and potentially other driver specific directives. Specific details can be found in docblock of the ``setOptions()`` method of each class. @@ -87,7 +87,7 @@ Configuring PHP Sessions ~~~~~~~~~~~~~~~~~~~~~~~~ The :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage` -can configure most of the php.ini configuration directives which are documented +can configure most of the ``php.ini`` configuration directives which are documented at `php.net/session.configuration`_. To configure these settings, pass the keys (omitting the initial ``session.`` part @@ -131,7 +131,7 @@ example if these were set to ``5/100`` respectively, it would mean a probability of 5%. Similarly, ``3/4`` would mean a 3 in 4 chance of being called, i.e. 75%. If the garbage collection handler is invoked, PHP will pass the value stored in -the php.ini directive ``session.gc_maxlifetime``. The meaning in this context is +the ``php.ini`` directive ``session.gc_maxlifetime``. The meaning in this context is that any stored session that was saved more than ``maxlifetime`` ago should be deleted. This allows one to expire records based on idle time. diff --git a/components/http_foundation/sessions.rst b/components/http_foundation/sessions.rst index 24d2b2b76c6..6e1ae379916 100644 --- a/components/http_foundation/sessions.rst +++ b/components/http_foundation/sessions.rst @@ -50,7 +50,7 @@ Quick example:: .. caution:: - Symfony sessions are incompatible with php.ini directive ``session.auto_start = 1`` + Symfony sessions are incompatible with ``php.ini`` directive ``session.auto_start = 1`` This directive should be turned off in ``php.ini``, in the webserver directives or in ``.htaccess``. diff --git a/cookbook/form/form_collections.rst b/cookbook/form/form_collections.rst index f6a19e2de80..675667bfbdc 100755 --- a/cookbook/form/form_collections.rst +++ b/cookbook/form/form_collections.rst @@ -258,7 +258,7 @@ great, your user can't actually add any new tags yet. This directive limits recursion to 100 calls which may not be enough for rendering the form in the template if you render the whole form at once (e.g ``form_widget(form)``). To fix this you can set this directive - to a higher value (either via a php.ini file or via :phpfunction:`ini_set`, + to a higher value (either via a ``php.ini`` file or via :phpfunction:`ini_set`, for example in ``app/autoload.php``) or render each form field by hand using ``form_row``. diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 5996615cbaf..985ac5938c2 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -79,7 +79,7 @@ full TextMate string would look like this: Of course, since every developer uses a different IDE, it's better to set this on a system level. This can be done by setting the ``xdebug.file_link_format`` -php.ini value to the file link string. If this configuration value is set, then +``php.ini`` value to the file link string. If this configuration value is set, then the ``ide`` option does not need to be specified. .. _reference-framework-test: diff --git a/reference/constraints/File.rst b/reference/constraints/File.rst index b082a8caf5d..6cfc87c4e34 100644 --- a/reference/constraints/File.rst +++ b/reference/constraints/File.rst @@ -217,7 +217,7 @@ uploadIniSizeErrorMessage **type**: ``string`` **default**: ``The file is too large. Allowed maximum size is {{ limit }}`` The message that is displayed if the uploaded file is larger than the ``upload_max_filesize`` -php.ini setting. +``php.ini`` setting. uploadFormSizeErrorMessage ~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/reference/requirements.rst b/reference/requirements.rst index 59be11f6245..39ddfa25a65 100644 --- a/reference/requirements.rst +++ b/reference/requirements.rst @@ -22,7 +22,7 @@ Required * PHP needs to be a minimum version of PHP 5.3.3 * JSON needs to be enabled * ctype needs to be enabled -* Your php.ini needs to have the ``date.timezone`` setting +* Your ``php.ini`` needs to have the ``date.timezone`` setting Optional -------- @@ -35,7 +35,7 @@ Optional * POSIX needs to be enabled (only on \*nix) * Intl needs to be installed with ICU 4+ * APC 3.0.17+ (or another opcode cache needs to be installed) -* php.ini recommended settings +* ``php.ini`` recommended settings * ``short_open_tag = Off`` * ``magic_quotes_gpc = Off`` From 4de7b735b9dc38a3b9368392ac3fa71adab8cf41 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 4 Nov 2013 19:12:18 +0100 Subject: [PATCH 0720/2078] document the DateTimeType widget option --- reference/forms/types/datetime.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst index 8db1145623a..f3990be28d0 100644 --- a/reference/forms/types/datetime.rst +++ b/reference/forms/types/datetime.rst @@ -17,6 +17,7 @@ data can be a ``DateTime`` object, a string, a timestamp or an array. +----------------------+-----------------------------------------------------------------------------+ | Options | - `date_widget`_ | | | - `time_widget`_ | +| | - `widget`_ | | | - `input`_ | | | - `date_format`_ | | | - `hours`_ | @@ -59,6 +60,15 @@ time_widget Defines the ``widget`` option for the :doc:`time ` type +widget +~~~~~~ + +**type**: ``string`` **default**: ``null`` + +Defines the ``widget`` option for both the :doc:`date ` +type and :doc:`time ` type. Can be overridden with +the `date_widget`_ and `time_widget`_ options. + input ~~~~~ From 30eb2394381280ef2c6b50225637f5d1bbf0113f Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Wed, 6 Nov 2013 06:54:07 +0100 Subject: [PATCH 0721/2078] [Reference][Twig] Fix typos and formatting --- reference/forms/twig_reference.rst | 3 +-- reference/twig_reference.rst | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/reference/forms/twig_reference.rst b/reference/forms/twig_reference.rst index e01ecd05d41..cf67e6491cc 100644 --- a/reference/forms/twig_reference.rst +++ b/reference/forms/twig_reference.rst @@ -218,8 +218,7 @@ object: .. code-block:: html+jinja -