From 5e5d5672bebd53cdb2601bbd96ca1cd503ff2bfa Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 28 May 2017 13:07:41 +0200 Subject: [PATCH 001/261] Reworded the note about dump() not being available in prod --- templating/debug.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/templating/debug.rst b/templating/debug.rst index 00f2cd9b58f..3a4ba66074d 100644 --- a/templating/debug.rst +++ b/templating/debug.rst @@ -46,6 +46,8 @@ The same mechanism can be used in Twig templates thanks to ``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. +By design, the ``dump()`` function is only available if the ``debug`` setting +(in ``config.yml``) is ``true``, to avoid leaking sensitive information in +production. In fact, trying to use the ``dump()`` function when ``debug`` is +``false`` (for example in the ``prod`` environment) will result in an +application error. From 3e6dc191465c2703720a675fb72d59fe50847592 Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Mon, 6 Mar 2017 13:30:35 +0200 Subject: [PATCH 002/261] Add docs about the validator TypeTestCase class --- form/unit_testing.rst | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/form/unit_testing.rst b/form/unit_testing.rst index 53d82d2171b..b89b2605626 100644 --- a/form/unit_testing.rst +++ b/form/unit_testing.rst @@ -157,12 +157,31 @@ before creating the parent form using the ``PreloadedExtension`` class:: be getting errors that are not related to the form you are currently testing but to its children. +Forms Using Validation +------------------------------------ + +If your forms uses the ``invalid_message`` or ``constraints`` option for validation, you need to +register the validation extension which provides this options. +Luckily Symfony provides a custom test class which does this for you. +In order to have this option registered, your test needs to extend from the +:class:`Symfony\\Component\\Form\\Tests\\Extension\\Validator\\Type\\TypeTestCase` +class:: + + // tests/AppBundle/Form/Type/TestedTypeTests.php + namespace Tests\AppBundle\Form\Type; + + use Symfony\Component\Form\Tests\Extension\Validator\Type\TypeTestCase; + + class TestedTypeTest extends TypeTestCase + { + // ... + } + Adding Custom Extensions ------------------------ It often happens that you use some options that are added by -:doc:`form extensions `. One of the -cases may be the ``ValidatorExtension`` with its ``invalid_message`` option. +:doc:`form extensions `. The ``TypeTestCase`` only loads the core form extension, which means an :class:`Symfony\\Component\\OptionsResolver\\Exception\\InvalidOptionsException` will be raised if you try to test a class that depends on other extensions. @@ -173,37 +192,32 @@ allows you to return a list of extensions to register:: namespace AppBundle\Tests\Form\Type; use AppBundle\Form\Type\TestedType; - use Symfony\Component\Form\Extension\Validator\ValidatorExtension; use Symfony\Component\Form\Form; use Symfony\Component\Form\Forms; use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\Test\TypeTestCase; - use Symfony\Component\Validator\ConstraintViolationList; use Symfony\Component\Validator\Mapping\ClassMetadata; - use Symfony\Component\Validator\Validator\ValidatorInterface; class TestedTypeTest extends TypeTestCase { protected function getExtensions() { - $validator = $this->createMock(ValidatorInterface::class); // use getMock() on PHPUnit 5.3 or below // $validator = $this->getMock(ValidatorInterface::class); - $validator - ->method('validate') - ->will($this->returnValue(new ConstraintViolationList())); $validator ->method('getMetadataFor') ->will($this->returnValue(new ClassMetadata(Form::class))); - return array( - new ValidatorExtension($validator), + new MyFormExtension(), ); } // ... your tests } +It is also possible to load custom form types, form type extensions or type guessers using the +``getTypedExtensions``, ``getTypes`` and ``getTypeGuessers`` methods. + Testing against Different Sets of Data -------------------------------------- From d4979eb9f71b541eea4cdb6c47c17b68fb3660d7 Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Mon, 6 Mar 2017 13:53:05 +0200 Subject: [PATCH 003/261] Fix typos --- form/unit_testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/form/unit_testing.rst b/form/unit_testing.rst index b89b2605626..79b96fedcf2 100644 --- a/form/unit_testing.rst +++ b/form/unit_testing.rst @@ -163,7 +163,7 @@ Forms Using Validation If your forms uses the ``invalid_message`` or ``constraints`` option for validation, you need to register the validation extension which provides this options. Luckily Symfony provides a custom test class which does this for you. -In order to have this option registered, your test needs to extend from the +In order to have these options registered, your test needs to extend the :class:`Symfony\\Component\\Form\\Tests\\Extension\\Validator\\Type\\TypeTestCase` class:: From d17821add4a02812053274a1da2ed15d3491f49d Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Mon, 6 Mar 2017 16:31:34 +0200 Subject: [PATCH 004/261] Fix heading underlining --- form/unit_testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/form/unit_testing.rst b/form/unit_testing.rst index 79b96fedcf2..152cd1a31ef 100644 --- a/form/unit_testing.rst +++ b/form/unit_testing.rst @@ -158,7 +158,7 @@ before creating the parent form using the ``PreloadedExtension`` class:: testing but to its children. Forms Using Validation ------------------------------------- +---------------------- If your forms uses the ``invalid_message`` or ``constraints`` option for validation, you need to register the validation extension which provides this options. From 070b2c07f082a812557589565f9177bb4b4cc61f Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Tue, 7 Mar 2017 12:00:38 +0200 Subject: [PATCH 005/261] Renamed TestedTypeTests to TestedTypeTest --- form/unit_testing.rst | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/form/unit_testing.rst b/form/unit_testing.rst index 152cd1a31ef..76909be8093 100644 --- a/form/unit_testing.rst +++ b/form/unit_testing.rst @@ -124,7 +124,7 @@ 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 using the ``PreloadedExtension`` class:: - // src/AppBundle/Tests/Form/Type/TestedTypeTests.php + // src/AppBundle/Tests/Form/Type/TestedTypeTest.php namespace AppBundle\Tests\Form\Type; use AppBundle\Form\Type\TestedType; @@ -167,7 +167,7 @@ In order to have these options registered, your test needs to extend the :class:`Symfony\\Component\\Form\\Tests\\Extension\\Validator\\Type\\TypeTestCase` class:: - // tests/AppBundle/Form/Type/TestedTypeTests.php + // tests/AppBundle/Form/Type/TestedTypeTest.php namespace Tests\AppBundle\Form\Type; use Symfony\Component\Form\Tests\Extension\Validator\Type\TypeTestCase; @@ -188,7 +188,7 @@ will be raised if you try to test a class that depends on other extensions. The :method:`Symfony\\Component\\Form\\Test\\TypeTestCase::getExtensions` method allows you to return a list of extensions to register:: - // src/AppBundle/Tests/Form/Type/TestedTypeTests.php + // src/AppBundle/Tests/Form/Type/TestedTypeTest.php namespace AppBundle\Tests\Form\Type; use AppBundle\Form\Type\TestedType; @@ -215,16 +215,13 @@ allows you to return a list of extensions to register:: // ... your tests } -It is also possible to load custom form types, form type extensions or type guessers using the -``getTypedExtensions``, ``getTypes`` and ``getTypeGuessers`` methods. - Testing against Different Sets of Data -------------------------------------- If you are not familiar yet with PHPUnit's `data providers`_, this might be a good opportunity to use them:: - // src/AppBundle/Tests/Form/Type/TestedTypeTests.php + // src/AppBundle/Tests/Form/Type/TestedTypeTest.php namespace AppBundle\Tests\Form\Type; use AppBundle\Form\Type\TestedType; From cf0f9e6968f097081b284f86911352e63b81fce6 Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Tue, 7 Mar 2017 12:02:29 +0200 Subject: [PATCH 006/261] Update fomr testing sentence --- form/unit_testing.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/form/unit_testing.rst b/form/unit_testing.rst index 76909be8093..52764a3b145 100644 --- a/form/unit_testing.rst +++ b/form/unit_testing.rst @@ -160,11 +160,10 @@ before creating the parent form using the ``PreloadedExtension`` class:: Forms Using Validation ---------------------- -If your forms uses the ``invalid_message`` or ``constraints`` option for validation, you need to -register the validation extension which provides this options. -Luckily Symfony provides a custom test class which does this for you. -In order to have these options registered, your test needs to extend the -:class:`Symfony\\Component\\Form\\Tests\\Extension\\Validator\\Type\\TypeTestCase` +If your form uses the ``invalid_message`` or ``constraints`` option for validation, you need to +register the validation extension which provides these options. +Luckily Symfony provides a base test class which takes care of it, just extend +``Symfony\Component\Form\Tests\Extension\Validator\Type\TypeTestCase`` class:: // tests/AppBundle/Form/Type/TestedTypeTest.php From 6fda2df30c6597e998cc5f682fb327fe770f0cc5 Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Tue, 7 Mar 2017 12:08:26 +0200 Subject: [PATCH 007/261] Removed extra class --- form/unit_testing.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/form/unit_testing.rst b/form/unit_testing.rst index 52764a3b145..64883922a35 100644 --- a/form/unit_testing.rst +++ b/form/unit_testing.rst @@ -163,8 +163,7 @@ Forms Using Validation If your form uses the ``invalid_message`` or ``constraints`` option for validation, you need to register the validation extension which provides these options. Luckily Symfony provides a base test class which takes care of it, just extend -``Symfony\Component\Form\Tests\Extension\Validator\Type\TypeTestCase`` -class:: +``Symfony\Component\Form\Tests\Extension\Validator\Type\TypeTestCase``:: // tests/AppBundle/Form/Type/TestedTypeTest.php namespace Tests\AppBundle\Form\Type; From f0887ae0c6b9ed6cedbbf8c2ce16aba5ecfb4785 Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Sat, 24 Jun 2017 15:53:04 +0200 Subject: [PATCH 008/261] Remove section about forms using validation --- form/unit_testing.rst | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/form/unit_testing.rst b/form/unit_testing.rst index 64883922a35..38c718f3502 100644 --- a/form/unit_testing.rst +++ b/form/unit_testing.rst @@ -157,24 +157,6 @@ before creating the parent form using the ``PreloadedExtension`` class:: be getting errors that are not related to the form you are currently testing but to its children. -Forms Using Validation ----------------------- - -If your form uses the ``invalid_message`` or ``constraints`` option for validation, you need to -register the validation extension which provides these options. -Luckily Symfony provides a base test class which takes care of it, just extend -``Symfony\Component\Form\Tests\Extension\Validator\Type\TypeTestCase``:: - - // tests/AppBundle/Form/Type/TestedTypeTest.php - namespace Tests\AppBundle\Form\Type; - - use Symfony\Component\Form\Tests\Extension\Validator\Type\TypeTestCase; - - class TestedTypeTest extends TypeTestCase - { - // ... - } - Adding Custom Extensions ------------------------ From fe063c6b77526ebf2f2d684eba45c5b716ed2fb2 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 6 Jan 2017 12:40:00 +0100 Subject: [PATCH 009/261] clarify silencing deprecations in tests --- components/phpunit_bridge.rst | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index dc556c72d2c..a852bd748bf 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -73,15 +73,25 @@ in the **Unsilenced** section of the deprecation report. Mark Tests as Legacy -------------------- -There are four ways to mark a test as legacy: +There are three ways to mark a test as legacy: * (**Recommended**) Add the ``@group legacy`` annotation to its class or method; * Make its class name start with the ``Legacy`` prefix; -* Make its method name start with ``testLegacy*()`` instead of ``test*()``; +* Make its method name start with ``testLegacy*()`` instead of ``test*()``. -* Make its data provider start with ``provideLegacy*()`` or ``getLegacy*()``. +.. note:: + + If your data provider calls code that would usually trigger a deprecation, + you can prefix its name with ``provideLegacy`` or ``getLegacy`` to silent + these deprecations. If your data provider does not execute deprecated + code, it is not required to choose a special naming just because the + test being fed by the data provider is marked as legacy. + + Also be aware that choosing one of the two legacy prefixes will not mark + tests as legacy that make use of this data provider. You still have to + mark them as legacy tests explicitly. Configuration ------------- From 84c154184afedf80041a365b25a0f6274075d598 Mon Sep 17 00:00:00 2001 From: Noel Garcia Date: Fri, 17 Feb 2017 17:45:04 +0100 Subject: [PATCH 010/261] added a tip to register annotations namespaces --- components/routing.rst | 20 ++++++++++++++++++++ components/serializer.rst | 20 ++++++++++++++++++++ components/validator/resources.rst | 15 +++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/components/routing.rst b/components/routing.rst index 686faf31ccb..1b889206537 100644 --- a/components/routing.rst +++ b/components/routing.rst @@ -312,6 +312,26 @@ Last but not least there are route definitions from class annotations. The specific details are left out here. +.. note:: + + In order to use the annotation loader, you should have installed the + ``doctrine/annotations`` and ``doctrine/cache`` packages from `Packagist`_. + +.. tip:: + +   Remember that annotation classes aren't loaded automatically, so you should load + them like Symfony usually does in the ``app/autoload.php`` file:: + +       use Composer\Autoload\ClassLoader; + use Doctrine\Common\Annotations\AnnotationRegistry; + + /** @var ClassLoader $loader */ + $loader = require __DIR__.'/../vendor/autoload.php'; + + AnnotationRegistry::registerLoader([$loader, 'loadClass']); + + return $loader; + The all-in-one Router ~~~~~~~~~~~~~~~~~~~~~ diff --git a/components/serializer.rst b/components/serializer.rst index cb16d951afc..5cea6eee643 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -314,6 +314,26 @@ You are now able to serialize only attributes in the groups you want:: .. _ignoring-attributes-when-serializing: +.. note:: + + In order to use the annotation loader, you should have installed the + ``doctrine/annotations`` and ``doctrine/cache`` packages from `Packagist`_. + +.. tip:: + +   Remember that annotation classes aren't loaded automatically, so you should load + them like Symfony usually does in the ``app/autoload.php`` file:: + +       use Composer\Autoload\ClassLoader; + use Doctrine\Common\Annotations\AnnotationRegistry; + + /** @var ClassLoader $loader */ + $loader = require __DIR__.'/../vendor/autoload.php'; + + AnnotationRegistry::registerLoader([$loader, 'loadClass']); + + return $loader; + Ignoring Attributes ------------------- diff --git a/components/validator/resources.rst b/components/validator/resources.rst index 23e5ba83cde..cbd9573fdfa 100644 --- a/components/validator/resources.rst +++ b/components/validator/resources.rst @@ -124,6 +124,21 @@ To disable the annotation loader after it was enabled, call In order to use the annotation loader, you should have installed the ``doctrine/annotations`` and ``doctrine/cache`` packages from `Packagist`_. +.. tip:: + +   Remember that annotation classes aren't loaded automatically, so you should load + them like Symfony usually does in the ``app/autoload.php`` file:: + +       use Composer\Autoload\ClassLoader; + use Doctrine\Common\Annotations\AnnotationRegistry; + + /** @var ClassLoader $loader */ + $loader = require __DIR__.'/../vendor/autoload.php'; + + AnnotationRegistry::registerLoader([$loader, 'loadClass']); + + return $loader; + Using Multiple Loaders ---------------------- From 0ddf3d21b12c05fb5b34f982feb4005dab877185 Mon Sep 17 00:00:00 2001 From: Noel Date: Sun, 6 Aug 2017 13:35:18 +0200 Subject: [PATCH 011/261] moved the tips to an include fragment file --- _includes/_annotation_loader_tip.rst.inc | 19 +++++++++++++++++++ components/routing.rst | 20 +------------------- components/serializer.rst | 20 +------------------- components/validator/resources.rst | 20 +------------------- 4 files changed, 22 insertions(+), 57 deletions(-) create mode 100644 _includes/_annotation_loader_tip.rst.inc diff --git a/_includes/_annotation_loader_tip.rst.inc b/_includes/_annotation_loader_tip.rst.inc new file mode 100644 index 00000000000..c0daf86570f --- /dev/null +++ b/_includes/_annotation_loader_tip.rst.inc @@ -0,0 +1,19 @@ +.. note:: + + In order to use the annotation loader, you should have installed the + ``doctrine/annotations`` and ``doctrine/cache`` packages from `Packagist`_. + +.. tip:: + +   Remember that annotation classes aren't loaded automatically, so you should load + them like Symfony usually does in the ``app/autoload.php`` file:: + +       use Composer\Autoload\ClassLoader; + use Doctrine\Common\Annotations\AnnotationRegistry; + + /** @var ClassLoader $loader */ + $loader = require __DIR__.'/../vendor/autoload.php'; + + AnnotationRegistry::registerLoader([$loader, 'loadClass']); + + return $loader; diff --git a/components/routing.rst b/components/routing.rst index 1b889206537..1b8c291fa6e 100644 --- a/components/routing.rst +++ b/components/routing.rst @@ -312,25 +312,7 @@ Last but not least there are route definitions from class annotations. The specific details are left out here. -.. note:: - - In order to use the annotation loader, you should have installed the - ``doctrine/annotations`` and ``doctrine/cache`` packages from `Packagist`_. - -.. tip:: - -   Remember that annotation classes aren't loaded automatically, so you should load - them like Symfony usually does in the ``app/autoload.php`` file:: - -       use Composer\Autoload\ClassLoader; - use Doctrine\Common\Annotations\AnnotationRegistry; - - /** @var ClassLoader $loader */ - $loader = require __DIR__.'/../vendor/autoload.php'; - - AnnotationRegistry::registerLoader([$loader, 'loadClass']); - - return $loader; +.. include:: /_includes/_rewrite_rule_tip.rst.inc The all-in-one Router ~~~~~~~~~~~~~~~~~~~~~ diff --git a/components/serializer.rst b/components/serializer.rst index 5cea6eee643..af8dd06bd0d 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -314,25 +314,7 @@ You are now able to serialize only attributes in the groups you want:: .. _ignoring-attributes-when-serializing: -.. note:: - - In order to use the annotation loader, you should have installed the - ``doctrine/annotations`` and ``doctrine/cache`` packages from `Packagist`_. - -.. tip:: - -   Remember that annotation classes aren't loaded automatically, so you should load - them like Symfony usually does in the ``app/autoload.php`` file:: - -       use Composer\Autoload\ClassLoader; - use Doctrine\Common\Annotations\AnnotationRegistry; - - /** @var ClassLoader $loader */ - $loader = require __DIR__.'/../vendor/autoload.php'; - - AnnotationRegistry::registerLoader([$loader, 'loadClass']); - - return $loader; +.. include:: /_includes/_rewrite_rule_tip.rst.inc Ignoring Attributes ------------------- diff --git a/components/validator/resources.rst b/components/validator/resources.rst index cbd9573fdfa..b8e16755cda 100644 --- a/components/validator/resources.rst +++ b/components/validator/resources.rst @@ -119,25 +119,7 @@ method. It takes an optional annotation reader instance, which defaults to To disable the annotation loader after it was enabled, call :method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAnnotationMapping`. -.. note:: - - In order to use the annotation loader, you should have installed the - ``doctrine/annotations`` and ``doctrine/cache`` packages from `Packagist`_. - -.. tip:: - -   Remember that annotation classes aren't loaded automatically, so you should load - them like Symfony usually does in the ``app/autoload.php`` file:: - -       use Composer\Autoload\ClassLoader; - use Doctrine\Common\Annotations\AnnotationRegistry; - - /** @var ClassLoader $loader */ - $loader = require __DIR__.'/../vendor/autoload.php'; - - AnnotationRegistry::registerLoader([$loader, 'loadClass']); - - return $loader; +.. include:: /_includes/_rewrite_rule_tip.rst.inc Using Multiple Loaders ---------------------- From 269150478f5ade4a862899ea5005d50359c10b37 Mon Sep 17 00:00:00 2001 From: flip111 Date: Mon, 4 Sep 2017 17:59:32 +0200 Subject: [PATCH 012/261] Update choice_attr.rst.inc https://github.com/symfony/symfony/issues/24088 --- reference/forms/types/options/choice_attr.rst.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/options/choice_attr.rst.inc b/reference/forms/types/options/choice_attr.rst.inc index 4b4d8f187ac..d7501cc73b0 100644 --- a/reference/forms/types/options/choice_attr.rst.inc +++ b/reference/forms/types/options/choice_attr.rst.inc @@ -6,8 +6,9 @@ choice_attr **type**: ``array``, ``callable`` or ``string`` **default**: ``array()`` -Use this to add additional HTML attributes to each choice. This can be an array -of attributes (if they are the same for each choice), a callable or a property path +Use this to add additional HTML attributes to each choice. This can be +an associative array where the keys match the choice keys and the values +are the options for each choice, a callable or a property path (just like `choice_label`_). If an array, the keys of the ``choices`` array must be used as keys:: From 36f81742cf77dca481bd9c16e40fee0c750e2cb7 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 17 Dec 2017 13:29:32 +0100 Subject: [PATCH 013/261] Don't use OutputInterface::VERBOSITY constants, use PHP methods instead --- logging/monolog_console.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/logging/monolog_console.rst b/logging/monolog_console.rst index d56a5f9949b..4f84265386f 100644 --- a/logging/monolog_console.rst +++ b/logging/monolog_console.rst @@ -16,19 +16,18 @@ is passed when a command gets executed. When a lot of logging has to happen, it's cumbersome to print information depending on the verbosity settings (``-v``, ``-vv``, ``-vvv``) because the -calls need to be wrapped in conditions. The code quickly gets verbose or dirty. -For example:: +calls need to be wrapped in conditions. For example:: use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; protected function execute(InputInterface $input, OutputInterface $output) { - if ($output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG) { + if ($output->isDebug()) { $output->writeln('Some info'); } - if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { + if ($output->isVerbose()) { $output->writeln('Some more info'); } } From 4583fbd2e1f29308bc8da816d889bbe6f9a6fa60 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 19 Dec 2017 17:45:53 +0100 Subject: [PATCH 014/261] Document that Doctrine associations don't work across different entity managers --- doctrine/multiple_entity_managers.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doctrine/multiple_entity_managers.rst b/doctrine/multiple_entity_managers.rst index 50acceddf1a..949c41112f5 100644 --- a/doctrine/multiple_entity_managers.rst +++ b/doctrine/multiple_entity_managers.rst @@ -16,6 +16,12 @@ entity manager that connects to another database might handle the rest. usually required. Be sure you actually need multiple entity managers before adding in this layer of complexity. +.. caution:: + + Entities cannot define associations across different entity managers. If you + need that, there are `several alternatives `_ + that require some custom setup. + The following configuration code shows how you can configure two entity managers: .. configuration-block:: From 19c89daf85747da34a86760994b1ee14307909ad Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 29 Dec 2017 08:45:56 +0100 Subject: [PATCH 015/261] Minor reword --- _includes/_annotation_loader_tip.rst.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_includes/_annotation_loader_tip.rst.inc b/_includes/_annotation_loader_tip.rst.inc index c0daf86570f..098407582fb 100644 --- a/_includes/_annotation_loader_tip.rst.inc +++ b/_includes/_annotation_loader_tip.rst.inc @@ -1,12 +1,12 @@ .. note:: In order to use the annotation loader, you should have installed the - ``doctrine/annotations`` and ``doctrine/cache`` packages from `Packagist`_. + ``doctrine/annotations`` and ``doctrine/cache`` packages with Composer. .. tip:: -   Remember that annotation classes aren't loaded automatically, so you should load - them like Symfony usually does in the ``app/autoload.php`` file:: +   Annotation classes aren't loaded automatically, so you must load them + like Symfony does in the ``app/autoload.php`` file::       use Composer\Autoload\ClassLoader; use Doctrine\Common\Annotations\AnnotationRegistry; From f56b5af7f1b2e1e03b4a312df7c5311532be23b3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 29 Dec 2017 08:46:34 +0100 Subject: [PATCH 016/261] Moved the note before the label --- components/serializer.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index af8dd06bd0d..668039f4b05 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -312,10 +312,10 @@ You are now able to serialize only attributes in the groups you want:: ); // $obj2 = MyObj(foo: 'foo', bar: 'bar') -.. _ignoring-attributes-when-serializing: - .. include:: /_includes/_rewrite_rule_tip.rst.inc +.. _ignoring-attributes-when-serializing: + Ignoring Attributes ------------------- From 2b904b7200b45dc7ea9583460515a121389ce7aa Mon Sep 17 00:00:00 2001 From: HeahDude Date: Mon, 1 Jan 2018 18:09:00 +0100 Subject: [PATCH 017/261] Fixed invalid form validation reference --- form/disabling_validation.rst | 10 ++++++++-- form/dynamic_form_modification.rst | 8 -------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/form/disabling_validation.rst b/form/disabling_validation.rst index 06acfdbac6e..9a7923ecf46 100644 --- a/form/disabling_validation.rst +++ b/form/disabling_validation.rst @@ -21,5 +21,11 @@ these cases you can set the ``validation_groups`` option to ``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, you can use the -:ref:`POST_SUBMIT event `. +fields were submitted. + +Note that to disable the extra fields check, you can use the proper +`form type option`_. +One the other hand, the uploaded file limit should be handled via your php and +web server configuration. + +.. _`form type option`: http://symfony.com/doc/current/reference/forms/types/form.html#allow-extra-fields diff --git a/form/dynamic_form_modification.rst b/form/dynamic_form_modification.rst index 3a3a0e9d8d8..72c731c90c6 100644 --- a/form/dynamic_form_modification.rst +++ b/form/dynamic_form_modification.rst @@ -702,11 +702,3 @@ field according to the current selection in the ``sport`` field: The major benefit of submitting the whole form to just extract the updated ``position`` field is that no additional server-side code is needed; all the code from above to generate the submitted form can be reused. - -.. _form-dynamic-form-modification-suppressing-form-validation: - -Suppressing Form Validation ---------------------------- - -To suppress form validation, set ``validation_groups`` to ``false`` or an empty -array. From 2af182d9bb775547ade300bb8bc4787f56f199d0 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 2 Jan 2018 08:47:20 +0100 Subject: [PATCH 018/261] Reword --- form/disabling_validation.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/form/disabling_validation.rst b/form/disabling_validation.rst index 9a7923ecf46..e06cc4696a9 100644 --- a/form/disabling_validation.rst +++ b/form/disabling_validation.rst @@ -23,9 +23,8 @@ 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. -Note that to disable the extra fields check, you can use the proper -`form type option`_. -One the other hand, the uploaded file limit should be handled via your php and -web server configuration. +The submission of extra form fields can be controlled with the +`allow_extra_fields config option`_ and the maximum upload file size should be +handled via your PHP and web server configuration. -.. _`form type option`: http://symfony.com/doc/current/reference/forms/types/form.html#allow-extra-fields +.. _`allow_extra_fields config option`: https://symfony.com/doc/current/reference/forms/types/form.html#allow-extra-fields From dc3a2ca08481a8036dd7353bc4c0b5c27a85b185 Mon Sep 17 00:00:00 2001 From: Marcus Schwarz Date: Mon, 1 Jan 2018 03:51:04 +0100 Subject: [PATCH 019/261] Update entity_provider.rst Change link to form_login_setup instead form_login, since the later one seems to be "step 2" of form_login (How to Customize Redirect After Form Login) --- security/entity_provider.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/entity_provider.rst b/security/entity_provider.rst index c4e0ab33960..c42b621998c 100644 --- a/security/entity_provider.rst +++ b/security/entity_provider.rst @@ -415,7 +415,7 @@ template to customize them further). not be deserialized correctly from the session on each request. Congrats! Your database-loading security system is all setup! Next, add a -true :doc:`login form ` instead of HTTP Basic +true :doc:`login form ` instead of HTTP Basic or keep reading for other topics. .. _authenticating-someone-with-a-custom-entity-provider: From 376a840b0ff1f3a9a6e47ebd79b9f419e8dc3540 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 19 Dec 2017 17:45:53 +0100 Subject: [PATCH 020/261] Document that Doctrine associations don't work across different entity managers --- doctrine/multiple_entity_managers.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doctrine/multiple_entity_managers.rst b/doctrine/multiple_entity_managers.rst index 50acceddf1a..949c41112f5 100644 --- a/doctrine/multiple_entity_managers.rst +++ b/doctrine/multiple_entity_managers.rst @@ -16,6 +16,12 @@ entity manager that connects to another database might handle the rest. usually required. Be sure you actually need multiple entity managers before adding in this layer of complexity. +.. caution:: + + Entities cannot define associations across different entity managers. If you + need that, there are `several alternatives `_ + that require some custom setup. + The following configuration code shows how you can configure two entity managers: .. configuration-block:: From accf51420caebd1aab5eb6929d1ffee111208f7b Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 2 Jan 2018 20:30:47 +0100 Subject: [PATCH 021/261] use the ref role instead of URLs --- form/disabling_validation.rst | 7 +++---- reference/forms/types/form.rst | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/form/disabling_validation.rst b/form/disabling_validation.rst index e06cc4696a9..dafbd684b21 100644 --- a/form/disabling_validation.rst +++ b/form/disabling_validation.rst @@ -24,7 +24,6 @@ for example whether an uploaded file was too large or whether non-existing fields were submitted. The submission of extra form fields can be controlled with the -`allow_extra_fields config option`_ and the maximum upload file size should be -handled via your PHP and web server configuration. - -.. _`allow_extra_fields config option`: https://symfony.com/doc/current/reference/forms/types/form.html#allow-extra-fields +:ref:`allow_extra_fields config option ` and +the maximum upload file size should be handled via your PHP and web server +configuration. diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index 6c57283941e..0ba959d9677 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -54,6 +54,8 @@ Field Options .. include:: /reference/forms/types/options/action.rst.inc +.. _form-option-allow-extra-fields: + allow_extra_fields ~~~~~~~~~~~~~~~~~~ From 2dc7830d4c4c33fc3f82bcf7ad08771f6f0d17c5 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 2 Jan 2018 16:41:11 +0100 Subject: [PATCH 022/261] minor #8704 Client's history clear alternative (takman1) This PR was squashed before being merged into the 3.3 branch (closes #8704). Discussion ---------- Client's history clear alternative Another way to clear client's history. Commits ------- 153b7f792 Client's history clear alternative --- components/browser_kit.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/browser_kit.rst b/components/browser_kit.rst index 3b4f5bf214b..a55134293a0 100644 --- a/components/browser_kit.rst +++ b/components/browser_kit.rst @@ -225,7 +225,7 @@ also delete all the cookies:: $client = new Client(); $client->request('GET', '/'); - // delete history + // reset the client (history and cookies are cleared too) $client->restart(); Learn more From c1fc8680377f140b755bb135ff4e9ea3f3f59df7 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 6 Dec 2017 09:47:54 +0100 Subject: [PATCH 023/261] Improved the example to generate URLs in the console --- console/request_context.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/console/request_context.rst b/console/request_context.rst index 28e842ac2ae..8760379aa9c 100644 --- a/console/request_context.rst +++ b/console/request_context.rst @@ -72,11 +72,13 @@ from the ``router`` service and override its settings:: { protected function execute(InputInterface $input, OutputInterface $output) { - $context = $this->getContainer()->get('router')->getContext(); + $router = $this->getContainer()->get('router'); + $context = $router->getContext(); $context->setHost('example.com'); $context->setScheme('https'); $context->setBaseUrl('my/path'); - // ... your code here + $url = $router->generate('route-name', array('param-name' => 'param-value')); + // ... } } From de8db42d5f60cca280b622cc8bc397d4ad0c2ebc Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 3 Jan 2018 13:35:07 +0100 Subject: [PATCH 024/261] Improved the routing debug article --- routing/debug.rst | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/routing/debug.rst b/routing/debug.rst index ad5953b7188..7d9f5117f9b 100644 --- a/routing/debug.rst +++ b/routing/debug.rst @@ -6,21 +6,13 @@ How to Visualize And Debug Routes While adding and customizing routes, it's helpful to be able to visualize and get detailed information about your routes. A great way to see every -route in your application is via the ``debug:router`` console command. Execute -the command by running the following from the root of your project. +route in your application is via the ``debug:router`` console command, which +lists *all* the configured routes in your application: .. code-block:: terminal $ php app/console debug:router -.. versionadded:: 2.6 - Prior to Symfony 2.6, this command was called ``router:debug``. - -This command will print a helpful list of *all* the configured routes in -your application: - -.. code-block:: text - homepage ANY / contact GET /contact contact_process POST /contact @@ -29,21 +21,18 @@ your application: blog_show ANY /blog/{slug} You can also get very specific information on a single route by including -the route name after the command: +the route name as the command argument: .. code-block:: terminal $ php app/console debug:router article_show -Likewise, if you want to test whether a URL matches a given route, you can -use the ``router:match`` console command: +Likewise, if you want to test whether a URL matches a given route, use the +``router:match`` command. This is useful to debug routing issues and find out +which route is associated with the given URL: .. code-block:: terminal $ php app/console router:match /blog/my-latest-post -This command will print which route the URL matches. - -.. code-block:: text - Route "blog_show" matches From 36c183e923c9e5628ce5987e89158ba698b3ec1e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 3 Jan 2018 16:11:42 +0100 Subject: [PATCH 025/261] Fixed an example in the form testing article --- form/unit_testing.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/form/unit_testing.rst b/form/unit_testing.rst index 53d82d2171b..4d8b9e2e3ae 100644 --- a/form/unit_testing.rst +++ b/form/unit_testing.rst @@ -55,7 +55,8 @@ The simplest ``TypeTestCase`` implementation looks like the following:: $type = new TestedType(); $form = $this->factory->create($type); - $object = TestObject::fromArray($formData); + $object = new TestObject(); + // ...populate $object properties with the data stored in $formData // submit the data to the form directly $form->submit($formData); From ab5ac1e97ad1acbedcb354571f0c2e23cdcc5807 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 3 Jan 2018 13:24:50 +0100 Subject: [PATCH 026/261] Reworded the note about dump() availability per environment --- templating/debug.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/templating/debug.rst b/templating/debug.rst index 6e3e531db52..28742e83845 100644 --- a/templating/debug.rst +++ b/templating/debug.rst @@ -46,8 +46,7 @@ The same mechanism can be used in Twig templates thanks to ``dump()`` function: {% endfor %} -By design, the ``dump()`` function is only available if the ``kernel.debug`` -setting (in ``config.yml``) is ``true``, to avoid leaking sensitive information -in production. In fact, trying to use the ``dump()`` function when ``kernel.debug`` -is ``false`` (for example in the ``prod`` environment) will result in an -application error. +By design, the ``dump()`` function is only available in the ``dev`` and ``test`` +environments, to avoid leaking sensitive information in production. In fact, +trying to use the ``dump()`` function in the ``prod`` environment will result in +a PHP error. From 8bee65461e5991396adb19e9d1f75251d7acc29b Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 1 Aug 2017 10:20:55 +0200 Subject: [PATCH 027/261] Mention and recommend to use PHP-CS-Fixer when contributing code --- contributing/code/standards.rst | 47 ++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/contributing/code/standards.rst b/contributing/code/standards.rst index b324dfe7d73..96dfdc8d047 100644 --- a/contributing/code/standards.rst +++ b/contributing/code/standards.rst @@ -1,19 +1,33 @@ Coding Standards ================ -When contributing code to Symfony, you must follow its coding standards. To -make a long story short, here is the golden rule: **Imitate the existing -Symfony code**. Most open-source Bundles and libraries used by Symfony also -follow the same guidelines, and you should too. +Symfony code is contributed by thousands of developers around the world. To make +every piece of code look and feel familiar, Symfony defines some coding standards +that all contributions must follow. -Remember that the main advantage of standards is that every piece of code -looks and feels familiar, it's not about this or that being more readable. +These Symfony coding standards are based on the `PSR-1`_, `PSR-2`_ and `PSR-4`_ +standards, so you may already know most of them. -Symfony follows the standards defined in the `PSR-0`_, `PSR-1`_, `PSR-2`_ and `PSR-4`_ -documents. +Making your Code Follow the Coding Standards +-------------------------------------------- -Since a picture - or some code - is worth a thousand words, here's a short -example containing most features described below: +Instead of reviewing your code manually, Symfony makes it simple to ensure that +your contributed code matches the expected code syntax. First, install the +`PHP CS Fixer tool`_ and then, run this command to fix any problem: + +.. code-block:: terminal + + $ cd your-project/ + $ php php-cs-fixer.phar fix -v + +If you forget to run this command and make a pull request with any syntax issue, +our automated tools will warn you about that and will provide the solution. + +Symfony Coding Standards in Detail +---------------------------------- + +If you want to learn about the Symfony coding standards in detail, here's a +short example containing most features described below: .. code-block:: html+php @@ -122,7 +136,7 @@ example containing most features described below: } Structure ---------- +~~~~~~~~~ * Add a single space after each comma delimiter; @@ -181,7 +195,7 @@ Structure * Do not use spaces around ``[`` offset accessor and before ``]`` offset accessor. Naming Conventions ------------------- +~~~~~~~~~~~~~~~~~~ * Use camelCase, not underscores, for variable, function and method names, arguments; @@ -223,7 +237,7 @@ Service Naming Conventions * A group name uses the underscore notation. Documentation -------------- +~~~~~~~~~~~~~ * Add PHPDoc blocks for all classes, methods, and functions (though you may be asked to remove PHPDoc that do not add value); @@ -234,14 +248,17 @@ Documentation * Omit the ``@return`` tag if the method does not return anything; -* The ``@package`` and ``@subpackage`` annotations are not used. +* The ``@package`` and ``@subpackage`` annotations are not used; + +* Inline the ``@inheritdoc`` tag. License -------- +~~~~~~~ * Symfony is released under the MIT license, and the license block has to be present at the top of every PHP file, before the namespace. +.. _`PHP CS Fixer tool`: http://cs.sensiolabs.org/ .. _`PSR-0`: http://www.php-fig.org/psr/psr-0/ .. _`PSR-1`: http://www.php-fig.org/psr/psr-1/ .. _`PSR-2`: http://www.php-fig.org/psr/psr-2/ From 2f54aab61541e07fc9be59292f9609a9559a81ff Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 5 Jan 2018 15:34:09 +0100 Subject: [PATCH 028/261] minor #8983 cross-reference console command testing from testing guide (dbu) This PR was merged into the 4.0 branch. Discussion ---------- cross-reference console command testing from testing guide this feature is "hidden" in the console documentation. it belongs there, but we should find it from the testing guide as well. Commits ------- d0dfade10 cross-reference console testing to help users find this feature --- testing.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/testing.rst b/testing.rst index 284c14ceaed..86b81595ab8 100644 --- a/testing.rst +++ b/testing.rst @@ -919,6 +919,7 @@ Learn more testing/* +* :ref:`Testing a console command ` * :doc:`The chapter about tests in the Symfony Framework Best Practices ` * :doc:`/components/dom_crawler` * :doc:`/components/css_selector` From 2678b5244febccd0ea06f260cddd4386652aeb90 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 5 Jan 2018 11:34:57 +0100 Subject: [PATCH 029/261] minor #8091 Update js-datepicker usage for new jQuery UI (AdrianBorodziuk, javiereguiluz) This PR was merged into the 3.3 branch. Discussion ---------- Update js-datepicker usage for new jQuery UI Old variable used - "format" - doesn't work anymore in jQuery UI. Commits ------- 97f3f8462 Mention that we are using Bootstrap Datepicker 4d66b5074 Update js-datepicker usage for new jQuery UI --- 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 ef298636d25..5a6b76ceebc 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -99,7 +99,7 @@ picker: + .. tip:: From 74e82e074c067004a6913ceb8f71d1b74d78b192 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 13 Feb 2017 15:12:48 +0100 Subject: [PATCH 036/261] =?UTF-8?q?Added=20a=20new=20section=20"Extracting?= =?UTF-8?q?=20Translation=20Contents=20and=20Updating=20Cat=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- translation.rst | 49 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/translation.rst b/translation.rst index 418d7711369..2dc91ef9eb5 100644 --- a/translation.rst +++ b/translation.rst @@ -107,13 +107,12 @@ of text (called a *message*), use the for example, that you're translating a simple message from inside a controller:: // ... - use Symfony\Component\HttpFoundation\Response; public function indexAction() { $translated = $this->get('translator')->trans('Symfony is great'); - return new Response($translated); + // ... } .. _translation-resources: @@ -185,13 +184,11 @@ Message Placeholders Sometimes, a message containing a variable needs to be translated:: - use Symfony\Component\HttpFoundation\Response; - public function indexAction($name) { $translated = $this->get('translator')->trans('Hello '.$name); - return new Response($translated); + // ... } However, creating a translation for this string is impossible since the translator @@ -258,11 +255,11 @@ You can also specify the message domain and pass some additional variables: .. code-block:: twig - {% trans with {'%name%': 'Fabien'} from "app" %}Hello %name%{% endtrans %} + {% trans with {'%name%': 'Fabien'} from 'app' %}Hello %name%{% endtrans %} - {% trans with {'%name%': 'Fabien'} from "app" into "fr" %}Hello %name%{% endtrans %} + {% trans with {'%name%': 'Fabien'} from 'app' into 'fr' %}Hello %name%{% endtrans %} - {% transchoice count with {'%name%': 'Fabien'} from "app" %} + {% transchoice count with {'%name%': 'Fabien'} from 'app' %} {0} %name%, there are no apples|{1} %name%, there is one apple|]1,Inf[ %name%, there are %count% apples {% endtranschoice %} @@ -277,7 +274,7 @@ texts* and complex expressions: {{ message|transchoice(5) }} - {{ message|trans({'%name%': 'Fabien'}, "app") }} + {{ message|trans({'%name%': 'Fabien'}, 'app') }} {{ message|transchoice(5, {'%name%': 'Fabien'}, 'app') }} @@ -308,7 +305,7 @@ texts* and complex expressions: .. code-block:: twig - {% trans_default_domain "app" %} + {% trans_default_domain 'app' %} Note that this only influences the current template, not any "included" template (in order to avoid side effects). @@ -329,6 +326,33 @@ The translator service is accessible in PHP templates through the array('%count%' => 10) ) ?> +Extracting Translation Contents and Updating Catalogs Automatically +------------------------------------------------------------------- + +The most time-consuming tasks when translating an application is to extract all +the template contents to be translated and to keep all the translation files in +sync. Symfony includes a command called ``translation:update`` that helps you +with these tasks: + +.. code-block:: terminal + + # updates the French translation file with the missing strings found in app/Resources/ templates + $ ./app/console translation:update --dump-messages --force fr + + # updates the English translation file with the missing strings found in AppBundle + $ ./app/console translation:update --dump-messages --force en AppBundle + +.. note:: + + If you want to see the missing translation strings without actually updating + the translation files, remove the ``--force`` option from the command above. + +.. tip:: + + If you need to extract translation strings from other sources, such as + controllers, forms and flash messages, consider using the more advanced + third-party `TranslationBundle`_. + .. _translation-resource-locations: Translation Resource/File Names and Locations @@ -412,8 +436,8 @@ checks translation resources for several locales: .. note:: - When Symfony doesn't find a translation in the given locale, it will - add the missing translation to the log file. For details, + When Symfony doesn't find a translation in the given locale, it will + add the missing translation to the log file. For details, see :ref:`reference-framework-translator-logging`. Handling the User's Locale @@ -470,3 +494,4 @@ Learn more .. _`ISO 639-1`: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes .. _`Translatable Extension`: http://atlantic18.github.io/DoctrineExtensions/doc/translatable.html .. _`Translatable Behavior`: https://github.com/KnpLabs/DoctrineBehaviors +.. _`TranslationBundle`: https://github.com/php-translation/symfony-bundle From 1ce3a43b41cac12ff229d5585db2f5c858246652 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 12 Jan 2018 09:49:04 +0100 Subject: [PATCH 037/261] Removed the reference to specific Symfony files --- _includes/_annotation_loader_tip.rst.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_includes/_annotation_loader_tip.rst.inc b/_includes/_annotation_loader_tip.rst.inc index 098407582fb..ed43b8f51d8 100644 --- a/_includes/_annotation_loader_tip.rst.inc +++ b/_includes/_annotation_loader_tip.rst.inc @@ -5,8 +5,8 @@ .. tip:: -   Annotation classes aren't loaded automatically, so you must load them - like Symfony does in the ``app/autoload.php`` file:: + Annotation classes aren't loaded automatically, so you must load them + using a class loader like this::       use Composer\Autoload\ClassLoader; use Doctrine\Common\Annotations\AnnotationRegistry; From 26ff10bb7e76602a1334dff3482f8286c2ed3119 Mon Sep 17 00:00:00 2001 From: Sergey Podgornyy Date: Fri, 12 Jan 2018 13:30:02 +0100 Subject: [PATCH 038/261] Update best_practices.rst --- bundles/best_practices.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/best_practices.rst b/bundles/best_practices.rst index e0174a0f438..34e0f09993f 100644 --- a/bundles/best_practices.rst +++ b/bundles/best_practices.rst @@ -37,7 +37,7 @@ A namespace becomes a bundle as soon as you add a bundle class to it. The bundle class name must follow these simple rules: * Use only alphanumeric characters and underscores; -* Use a CamelCased name; +* Use a StudlyCaps name; * Use a descriptive and short name (no more than two words); * Prefix the name with the concatenation of the vendor (and optionally the category namespaces); From 69e78f4135b852127eb524e63455c13a57e87976 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 12 Jan 2018 15:43:23 +0100 Subject: [PATCH 039/261] Added minor clarification about what StudlyCaps is --- bundles/best_practices.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/best_practices.rst b/bundles/best_practices.rst index 34e0f09993f..0b2828876b7 100644 --- a/bundles/best_practices.rst +++ b/bundles/best_practices.rst @@ -37,7 +37,7 @@ A namespace becomes a bundle as soon as you add a bundle class to it. The bundle class name must follow these simple rules: * Use only alphanumeric characters and underscores; -* Use a StudlyCaps name; +* Use a StudlyCaps name (i.e. camelCase with the first letter uppercased); * Use a descriptive and short name (no more than two words); * Prefix the name with the concatenation of the vendor (and optionally the category namespaces); From 638063f9e730bdc12ecee4b7d725e4d2868b3bfb Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 12 Jan 2018 16:30:19 +0100 Subject: [PATCH 040/261] minor #9042 add missing twig dump construct (hellomedia, javiereguiluz) This PR was merged into the 2.8 branch. Discussion ---------- add missing twig dump construct added missing {% dump foo %} construct, in addition to {{ dump(foo) }}. The first one if the only one dumping to the debug toolbar. NB: copy pasted from the var_dumper component doc : https://symfony.com/doc/2.8/components/var_dumper.html Commits ------- 6e4f08473 Minor reword af6b4dead add missing twig dump construct --- templating/debug.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/templating/debug.rst b/templating/debug.rst index 28742e83845..8492941771f 100644 --- a/templating/debug.rst +++ b/templating/debug.rst @@ -33,14 +33,25 @@ for example, inside your controller:: The output of the ``dump()`` function is then rendered in the web developer toolbar. -The same mechanism can be used in Twig templates thanks to ``dump()`` function: +In a Twig template, you can use the ``dump`` utility as a function or a tag: + +* ``{% dump foo.bar %}`` is the way to go when the original template output + shall not be modified: variables are not dumped inline, but in the web + debug toolbar; +* on the contrary, ``{{ dump(foo.bar) }}`` dumps inline and thus may or not + be suited to your use case (e.g. you shouldn't use it in an HTML + attribute or a `` + + + {# pygment's styles are still loaded, undo some unwanted styles #}