From 009d9cc47bc3915a301153ea934674c5b83049af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Mon, 19 Sep 2016 16:21:18 +0200 Subject: [PATCH 01/22] Add specific tip about the http-kernel component --- setup/bundles.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setup/bundles.rst b/setup/bundles.rst index a449f54c0f6..c66174c0b29 100644 --- a/setup/bundles.rst +++ b/setup/bundles.rst @@ -189,6 +189,13 @@ adding a ``setDefined()`` method. The recommended check in this case would be:: // code for the new OptionsResolver API } +.. tip:: + + There is one case when you actually can rely on the + ``Symfony\Component\HttpKernel\Kernel::VERSION_ID`` constant: when trying + to detect the version of the ``symfony/http-kernel`` component, because it + is the component where this constant is defined. + .. _`symfony/phpunit-bridge package`: https://github.com/symfony/phpunit-bridge .. _`Official Symfony Guide to Upgrade from 2.x to 3.0`: https://github.com/symfony/symfony/blob/2.8/UPGRADE-3.0.md .. _`SensioLabs DeprecationDetector`: https://github.com/sensiolabs-de/deprecation-detector From 4f89612bf2bfb59c0962b8988a97d4c35b2c7b4b Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 21 Sep 2016 17:00:02 +0200 Subject: [PATCH 02/22] replace dirname() call with .. Using `dirname(__DIR__)` is less readable than using `__DIR__.'/..'`. Also, this is in line with what we use above in `configureRoutes()`. --- configuration/micro_kernel_trait.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/micro_kernel_trait.rst b/configuration/micro_kernel_trait.rst index 7c8efb40945..383360a2012 100644 --- a/configuration/micro_kernel_trait.rst +++ b/configuration/micro_kernel_trait.rst @@ -199,13 +199,13 @@ to hold the kernel. Now it looks like this:: // optional, to use the standard Symfony cache directory public function getCacheDir() { - return dirname(__DIR__).'/var/cache/'.$this->getEnvironment(); + return __DIR__.'/../var/cache/'.$this->getEnvironment(); } // optional, to use the standard Symfony logs directory public function getLogDir() { - return dirname(__DIR__).'/var/logs'; + return __DIR__.'/../var/logs'; } } From 469d611f62ccb43150a83b778cb4661db5cd5c97 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 21 Sep 2016 20:55:05 +0200 Subject: [PATCH 03/22] versionadded directive for name_converter option --- reference/configuration/framework.rst | 8 +++++--- serializer.rst | 7 +++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 0b9d50e5705..8452b1dae19 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -104,7 +104,7 @@ Configuration * :ref:`enabled ` * :ref:`cache ` * :ref:`enable_annotations ` - * `name_converter`_ + * :ref:`name_converter ` secret ~~~~~~ @@ -1497,14 +1497,16 @@ If this option is enabled, serialization groups can be defined using annotations For more information, see :ref:`serializer-using-serialization-groups-annotations`. +.. _reference-serializer-name_converter: + name_converter .............. +**type**: ``string`` + .. versionadded:: 2.8 The ``name_converter`` setting was introduced in Symfony 2.8. -**type**: ``string`` - The name converter to use. The :class:`Symfony\\Component\\Serializer\\NameConverter\\CamelCaseToSnakeCaseNameConverter` name converter can enabled by using the ``serializer.name_converter.camel_case_to_snake_case`` diff --git a/serializer.rst b/serializer.rst index 5b51927be00..17274457859 100644 --- a/serializer.rst +++ b/serializer.rst @@ -241,9 +241,12 @@ A service leveraging `APCu`_ (and APC for PHP < 5.5) is built-in. Enabling a Name Converter ------------------------- +.. versionadded:: 2.8 + The ``name_converter`` option was introduced in Symfony 2.8. + The use of a :ref:`name converter ` -service can be defined in the configuration using the ``name_converter`` -serializer parameter. +service can be defined in the configuration using the :ref:`name_converter ` +option. The built-in :ref:`CamelCase to snake_case name converter ` can be enabled by using the ``serializer.name_converter.camel_case_to_snake_case`` From 834e7dc193c9bc565da2f213753c91c92afe328e Mon Sep 17 00:00:00 2001 From: Victor Bocharsky Date: Fri, 23 Sep 2016 09:43:18 +0300 Subject: [PATCH 04/22] Tweak URL - CMF project moved to the other repo Now CMF SE is a fork of Symfony SE --- setup.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.rst b/setup.rst index 786e42dea44..af918be87f4 100644 --- a/setup.rst +++ b/setup.rst @@ -286,7 +286,7 @@ Go Deeper with Setup .. _`Phar extension`: http://php.net/manual/en/intro.phar.php .. _`Symfony Standard Edition`: https://github.com/symfony/symfony-standard .. _`The Symfony Demo application`: https://github.com/symfony/symfony-demo -.. _`The Symfony CMF Standard Edition`: https://github.com/symfony-cmf/symfony-cmf-standard +.. _`The Symfony CMF Standard Edition`: https://github.com/symfony-cmf/standard-edition .. _`Symfony CMF`: http://cmf.symfony.com/ .. _`The Symfony REST Edition`: https://github.com/gimler/symfony-rest-edition .. _`FOSRestBundle`: https://github.com/FriendsOfSymfony/FOSRestBundle From 27c99cccbcbf39e4ae22009272799352a990c06d Mon Sep 17 00:00:00 2001 From: Victor Bocharsky Date: Fri, 23 Sep 2016 10:10:10 +0300 Subject: [PATCH 05/22] Use new array syntax and make a few minor tweaks --- page_creation.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/page_creation.rst b/page_creation.rst index 5d681ef4339..40ad027cd9b 100644 --- a/page_creation.rst +++ b/page_creation.rst @@ -81,7 +81,7 @@ to creating a page? #. *Create a controller*: The method below the route - ``numberAction()`` - is called the *controller*: this is a function where *you* build the page and ultimately return a ``Response`` object. You'll learn more about :doc:`controllers ` - in their own section, including how to return JSON responses; + in their own section, including how to return JSON responses. The Web Debug Toolbar: Debugging Dream -------------------------------------- @@ -129,7 +129,7 @@ variable so we can render that:: $number = mt_rand(0, 100); return $this->render('lucky/number.html.twig', array( - 'number' => $number + 'number' => $number, )); } } From 8588820c694be5fd7d2c1b2ec66e6baa98029b14 Mon Sep 17 00:00:00 2001 From: Victor Bocharsky Date: Fri, 23 Sep 2016 10:10:10 +0300 Subject: [PATCH 06/22] Use new array syntax and make a few minor tweaks --- page_creation.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/page_creation.rst b/page_creation.rst index 133f71a5c42..cf4409f08e9 100644 --- a/page_creation.rst +++ b/page_creation.rst @@ -86,7 +86,7 @@ to creating a page? #. *Create a controller*: The method below the route - ``numberAction()`` - is called the *controller*: this is a function where *you* build the page and ultimately return a ``Response`` object. You'll learn more about :doc:`controllers ` - in their own section, including how to return JSON responses; + in their own section, including how to return JSON responses. The Web Debug Toolbar: Debugging Dream -------------------------------------- @@ -134,7 +134,7 @@ variable so we can render that:: $number = mt_rand(0, 100); return $this->render('lucky/number.html.twig', array( - 'number' => $number + 'number' => $number, )); } } @@ -184,7 +184,7 @@ So what about the other directories in the project? ``var/`` This is where automatically-created files are stored, like cache files - (``var/cache/``) and logs (``var/logs/``). + (``var/cache/``), logs (``var/logs/``) and sessions (``var/sessions/``). ``vendor/`` Third-party (i.e. "vendor") libraries live here! These are downloaded via the `Composer`_ From 29e4241e726756893039609694d8b3a0d11f16a0 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 24 Sep 2016 10:44:29 +0200 Subject: [PATCH 07/22] normalize versionadded wording --- reference/configuration/framework.rst | 2 +- service_container/alias_private.rst | 2 +- service_container/shared.rst | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 79f493cc600..5719e793e65 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1519,7 +1519,7 @@ name_converter **type**: ``string`` .. versionadded:: 2.8 - The ``name_converter`` setting was introduced in Symfony 2.8. + The ``name_converter`` option was introduced in Symfony 2.8. The name converter to use. The :class:`Symfony\\Component\\Serializer\\NameConverter\\CamelCaseToSnakeCaseNameConverter` diff --git a/service_container/alias_private.rst b/service_container/alias_private.rst index 137684ed858..6f3d8b7d30d 100644 --- a/service_container/alias_private.rst +++ b/service_container/alias_private.rst @@ -134,7 +134,7 @@ Deprecating Services -------------------- .. versionadded:: 2.8 - The ``deprecated`` setting was introduced in Symfony 2.8. + The ``deprecated`` option was introduced in Symfony 2.8. Once you have decided to deprecate the use of a service (because it is outdated or you decided not to maintain it anymore), you can deprecate its definition: diff --git a/service_container/shared.rst b/service_container/shared.rst index 62ef094f426..db685a922f9 100644 --- a/service_container/shared.rst +++ b/service_container/shared.rst @@ -5,8 +5,8 @@ How to Define Non Shared Services ================================= .. versionadded:: 2.8 - The ``shared`` setting was introduced in Symfony 2.8. Prior to Symfony 2.8, - you had to use the ``prototype`` scope. + The ``shared`` option was introduced in Symfony 2.8. Prior to Symfony + 2.8, you had to use the ``prototype`` scope. In the service container, all services are shared by default. This means that each time you retrieve the service, you'll get the *same* instance. This is From c876100c3787ea36a056cbd50d2c422236e8f28c Mon Sep 17 00:00:00 2001 From: Michael Kimsal Date: Sun, 26 Jun 2016 21:36:33 -0400 Subject: [PATCH 08/22] Update installation.rst Reminder note to view specific documentation version when installing specific version. Reference to installing LTS means example commands later on down in this same page will not work. --- setup.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.rst b/setup.rst index af918be87f4..e0e8fd9ae2e 100644 --- a/setup.rst +++ b/setup.rst @@ -89,6 +89,9 @@ optional second argument of the ``new`` command: # use the most recent 'lts' version (Long Term Support version) $ symfony new my_project_name lts +Each version has its *own* documentation, which you can select on any documentation +page. + .. note:: Read the :doc:`Symfony Release process ` From 57923b9d92c4981dab8eb2b063e39bd8fcd589f5 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Date: Sun, 25 Sep 2016 20:16:35 +0100 Subject: [PATCH 09/22] Missing semicolon --- components/cache/cache_pools.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/cache/cache_pools.rst b/components/cache/cache_pools.rst index 3b064822bcd..ed1311ce416 100644 --- a/components/cache/cache_pools.rst +++ b/components/cache/cache_pools.rst @@ -169,7 +169,7 @@ is ``getItem($key)``, which returns the cache item identified by the given key:: use Symfony\Component\Cache\Adapter\FilesystemAdapter; - $cache = new FilesystemAdapter('app.cache') + $cache = new FilesystemAdapter('app.cache'); $latestNews = $cache->getItem('latest_news'); If no item is defined for the given key, the method doesn't return a ``null`` From b7f82573c23101dc879ff093f2ee4bea776208ed Mon Sep 17 00:00:00 2001 From: Lamari Alaa Date: Mon, 26 Sep 2016 13:22:43 +0100 Subject: [PATCH 10/22] Update service_decoration.rst --- service_container/service_decoration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service_container/service_decoration.rst b/service_container/service_decoration.rst index 09100907fc0..d5e08ad2c46 100644 --- a/service_container/service_decoration.rst +++ b/service_container/service_decoration.rst @@ -18,7 +18,7 @@ the original service is lost: # this replaces the old app.mailer definition with the new one, the # old definition is lost app.mailer: - class AppBundle\DecoratingMailer + class: AppBundle\DecoratingMailer .. code-block:: xml From 7dbcb7c6a4a3ed7de739d00504af1ce4f7ea0f4c Mon Sep 17 00:00:00 2001 From: ReDnAxE Date: Mon, 26 Sep 2016 10:50:32 +0200 Subject: [PATCH 11/22] Update form_dependencies.rst: fix DI Fix service definitions for `__construct(EntityManager $em)` argument --- form/form_dependencies.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/form/form_dependencies.rst b/form/form_dependencies.rst index 35b4be594a8..3906be4ba60 100644 --- a/form/form_dependencies.rst +++ b/form/form_dependencies.rst @@ -100,6 +100,7 @@ Next, register this as a service and tag it with ``form.type``: services: app.form.type.task: class: AppBundle\Form\TaskType + arguments: ['@doctrine.orm.entity_manager'] tags: - { name: form.type, alias: app_task } @@ -113,6 +114,7 @@ Next, register this as a service and tag it with ``form.type``: + @@ -126,6 +128,7 @@ Next, register this as a service and tag it with ``form.type``: 'app.form.type.task', 'AppBundle\Form\TaskType' ) + ->addArgument('@doctrine.orm.entity_manager') ->addTag('form.type', array( 'alias' => 'app_task', )) From 8d08a2647ad91057b6ec157a5a1f0e861ec131e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Andrieu?= Date: Wed, 28 Sep 2016 17:37:23 +0200 Subject: [PATCH 12/22] Add a note about Filesystem:mkdir behavior --- components/filesystem.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/filesystem.rst b/components/filesystem.rst index 2efc4cffb2e..b2799d7b922 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -64,6 +64,10 @@ On POSIX filesystems, directories are created with a default mode value You can pass an array or any :phpclass:`Traversable` object as the first argument. +.. note:: + + This function ignores already existing directories. + exists ~~~~~~ From 4760bf41b1522536c96cbafa7a02c6a49e68e8f4 Mon Sep 17 00:00:00 2001 From: Victor Bocharsky Date: Thu, 29 Sep 2016 10:43:21 +0300 Subject: [PATCH 13/22] Replace title placeholder name with slug As we show slug in examples further: - /articles/en/2010/my-post - /articles/fr/2010/my-post.rss - /articles/en/2013/my-latest-post.html --- routing.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/routing.rst b/routing.rst index 9262b78b9d4..cb7b6a9c565 100644 --- a/routing.rst +++ b/routing.rst @@ -363,7 +363,7 @@ With all of this in mind, check out this advanced example: { /** * @Route( - * "/articles/{_locale}/{year}/{title}.{_format}", + * "/articles/{_locale}/{year}/{slug}.{_format}", * defaults={"_format": "html"}, * requirements={ * "_locale": "en|fr", @@ -372,7 +372,7 @@ With all of this in mind, check out this advanced example: * } * ) */ - public function showAction($_locale, $year, $title) + public function showAction($_locale, $year, $slug) { } } @@ -381,7 +381,7 @@ With all of this in mind, check out this advanced example: # app/config/routing.yml article_show: - path: /articles/{_locale}/{year}/{title}.{_format} + path: /articles/{_locale}/{year}/{slug}.{_format} defaults: { _controller: AppBundle:Article:show, _format: html } requirements: _locale: en|fr @@ -398,7 +398,7 @@ With all of this in mind, check out this advanced example: http://symfony.com/schema/routing/routing-1.0.xsd"> + path="/articles/{_locale}/{year}/{slug}.{_format}"> AppBundle:Article:show html @@ -418,7 +418,7 @@ With all of this in mind, check out this advanced example: $collection = new RouteCollection(); $collection->add( 'article_show', - new Route('/articles/{_locale}/{year}/{title}.{_format}', array( + new Route('/articles/{_locale}/{year}/{slug}.{_format}', array( '_controller' => 'AppBundle:Article:show', '_format' => 'html', ), array( From 04c44e9fd2c42f71a6448cde62cdadde08780bd0 Mon Sep 17 00:00:00 2001 From: Victor Bocharsky Date: Thu, 29 Sep 2016 10:51:19 +0300 Subject: [PATCH 14/22] Add empty parentheses to the method name --- routing.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/routing.rst b/routing.rst index cb7b6a9c565..da1f3026937 100644 --- a/routing.rst +++ b/routing.rst @@ -120,7 +120,7 @@ Thanks to these two routes: * If the user goes to ``/blog/*``, the second route is matched and ``showAction()`` is executed. Because the route path is ``/blog/{slug}``, a ``$slug`` variable is - passed to ``showAction`` matching that value. For example, if the user goes to + passed to ``showAction()`` matching that value. For example, if the user goes to ``/blog/yay-routing``, then ``$slug`` will equal ``yay-routing``. Whenever you have a ``{placeholder}`` in your route path, that portion becomes a @@ -502,11 +502,11 @@ The pattern has three parts, each separated by a colon: For example, a ``_controller`` value of ``AppBundle:Blog:show`` means: -============= ================== ============== +============= ================== ================ Bundle Controller Class Method Name -============= ================== ============== -``AppBundle`` ``BlogController`` ``showAction`` -============= ================== ============== +============= ================== ================ +``AppBundle`` ``BlogController`` ``showAction()`` +============= ================== ================ The controller might look like this:: @@ -524,7 +524,7 @@ The controller might look like this:: } Notice that Symfony adds the string ``Controller`` to the class name (``Blog`` -=> ``BlogController``) and ``Action`` to the method name (``show`` => ``showAction``). +=> ``BlogController``) and ``Action`` to the method name (``show`` => ``showAction()``). You could also refer to this controller using its fully-qualified class name and method: ``AppBundle\Controller\BlogController::showAction``. But if you From 31e538580a95e3fc72ae16966f3e2c0a2f35c335 Mon Sep 17 00:00:00 2001 From: Victor Bocharsky Date: Fri, 30 Sep 2016 10:38:01 +0300 Subject: [PATCH 15/22] Reorder arguments: $request as the first argument The `Request` argument should be the first one due to it can't be optional, but other arguments can --- controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller.rst b/controller.rst index 1c986fd681e..89242365c76 100644 --- a/controller.rst +++ b/controller.rst @@ -331,7 +331,7 @@ object. To get it in your controller, just add it as an argument and use Symfony\Component\HttpFoundation\Request; - public function indexAction($firstName, $lastName, Request $request) + public function indexAction(Request $request, $firstName, $lastName) { $page = $request->query->get('page', 1); From b547804b1e777441dc96b398e52ef5c71de2b10e Mon Sep 17 00:00:00 2001 From: Victor Bocharsky Date: Sun, 2 Oct 2016 22:55:05 +0300 Subject: [PATCH 16/22] Remove dash prefix from route name Actually, in most cases, the `_` prefix means something internal and probably better to avoid using it in examples --- templating.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/templating.rst b/templating.rst index 50ad22ee7ca..b14ef6681f5 100644 --- a/templating.rst +++ b/templating.rst @@ -578,7 +578,7 @@ the routing configuration. Later, if you want to modify the URL of a particular page, all you'll need to do is change the routing configuration; the templates will automatically generate the new URL. -First, link to the "_welcome" page, which is accessible via the following routing +First, link to the "welcome" page, which is accessible via the following routing configuration: .. configuration-block:: @@ -593,7 +593,7 @@ configuration: class WelcomeController extends Controller { /** - * @Route("/", name="_welcome") + * @Route("/", name="welcome") */ public function indexAction() { @@ -604,7 +604,7 @@ configuration: .. code-block:: yaml # app/config/routing.yml - _welcome: + welcome: path: / defaults: { _controller: AppBundle:Welcome:index } @@ -617,7 +617,7 @@ configuration: xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd"> - + AppBundle:Welcome:index @@ -629,7 +629,7 @@ configuration: use Symfony\Component\Routing\RouteCollection; $collection = new RouteCollection(); - $collection->add('_welcome', new Route('/', array( + $collection->add('welcome', new Route('/', array( '_controller' => 'AppBundle:Welcome:index', ))); @@ -641,11 +641,11 @@ To link to the page, just use the ``path`` Twig function and refer to the route: .. code-block:: html+twig - Home + Home .. code-block:: html+php - Home + Home As expected, this will generate the URL ``/``. Now, for a more complicated route: @@ -737,7 +737,7 @@ correctly: .. code-block:: html+twig - Home + Home The same can be done in PHP templates by passing a third argument to the ``generate()`` method: @@ -749,7 +749,7 @@ correctly: ?> Home From edaab1096ed41aba96ce248113902e96a26700a3 Mon Sep 17 00:00:00 2001 From: Victor Bocharsky Date: Sun, 2 Oct 2016 23:09:20 +0300 Subject: [PATCH 17/22] A few minor tweaks --- configuration.rst | 6 +++--- templating.rst | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/configuration.rst b/configuration.rst index 7e4291849c8..31263244347 100644 --- a/configuration.rst +++ b/configuration.rst @@ -112,14 +112,14 @@ There are *two* ways to know *what* keys you can configure: #. Use the :doc:`Reference Section `; -#. Use the ``config:dump`` command; +#. Use the ``config:dump-reference`` command. For example, if you want to configure something in Twig, you can see an example dump of all available configuration options by running: .. code-block:: terminal - $ php app/console config:dump twig + $ php app/console config:dump-reference twig .. index:: single: Environments; Introduction @@ -183,7 +183,7 @@ can also load XML files or PHP files. .. _config-parameter-intro: -The parameters key: Parameters (Variables) +The parameters Key: Parameters (Variables) ------------------------------------------ Another special key is called ``parameters``: it's used to define *variables* that diff --git a/templating.rst b/templating.rst index 50ad22ee7ca..f200647a58f 100644 --- a/templating.rst +++ b/templating.rst @@ -575,7 +575,7 @@ Creating links to other pages in your application is one of the most common jobs for a template. Instead of hardcoding URLs in templates, use the ``path`` Twig function (or the ``router`` helper in PHP) to generate URLs based on the routing configuration. Later, if you want to modify the URL of a particular -page, all you'll need to do is change the routing configuration; the templates +page, all you'll need to do is change the routing configuration: the templates will automatically generate the new URL. First, link to the "_welcome" page, which is accessible via the following routing @@ -706,7 +706,7 @@ route: In this case, you need to specify both the route name (``article_show``) and a value for the ``{slug}`` parameter. Using this route, revisit the -``recent_list`` template from the previous section and link to the articles +``recent_list.html.twig`` template from the previous section and link to the articles correctly: .. configuration-block:: @@ -905,14 +905,14 @@ block of the base template. You can also include assets located in your bundles' ``Resources/public`` folder. You will need to run the ``php app/console assets:install target [--symlink]`` -command, which moves (or symlinks) files into the correct location. (target +command, which copies (or symlinks) files into the correct location. (target is by default "web"). .. code-block:: html+twig -The end result is a page that includes both the ``main.css`` and ``contact.css`` +The end result is a page that includes ``main.js`` and both the ``main.css`` and ``contact.css`` stylesheets. Referencing the Request, User or Session @@ -934,7 +934,7 @@ Suppose ``description`` equals ``I <3 this product``: .. code-block:: twig - {{ description }} + {{ description }} {{ description|raw }} From 839c4489282d5e66fd7ba2a5b64c659a30e0471a Mon Sep 17 00:00:00 2001 From: Simo Heinonen Date: Mon, 3 Oct 2016 15:50:01 +0300 Subject: [PATCH 18/22] Capitalize the time designator --- components/yaml/yaml_format.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/yaml/yaml_format.rst b/components/yaml/yaml_format.rst index 2e9d24a95ef..1f7ef6d98a3 100644 --- a/components/yaml/yaml_format.rst +++ b/components/yaml/yaml_format.rst @@ -158,7 +158,7 @@ YAML uses the ISO-8601 standard to express dates: .. code-block:: yaml - 2001-12-14t21:59:43.10-05:00 + 2001-12-14T21:59:43.10-05:00 .. code-block:: yaml From c18f7b536e0dc5a08f6aa3107676a9f81f5c3627 Mon Sep 17 00:00:00 2001 From: asandjivy Date: Thu, 18 Aug 2016 11:02:25 +0200 Subject: [PATCH 19/22] Update controllers.rst --- best_practices/controllers.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/best_practices/controllers.rst b/best_practices/controllers.rst index b30b27a15de..98e55f4eef7 100644 --- a/best_practices/controllers.rst +++ b/best_practices/controllers.rst @@ -85,10 +85,10 @@ it more difficult to know which template is being rendered. It also makes it less obvious to beginners that a controller should always return a Response object (unless you're using a view layer). -How the Controller Looks ------------------------- +What does the Controller look like +---------------------------------- -Considering all this, here is an example of how the controller should look +Considering all this, here is an example of what the controller should look like for the homepage of our app: .. code-block:: php From 4c10ea8afd83de363737f1e726c958905d43e6d8 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 30 Aug 2016 11:17:10 +0200 Subject: [PATCH 20/22] Explain the limitations of the custom messages in UniqueEntity --- reference/constraints/UniqueEntity.rst | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index 211fb0a3753..7d03f107aa9 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -132,7 +132,18 @@ message **type**: ``string`` **default**: ``This value is already used.`` -The message that's displayed when this constraint fails. +The message that's displayed when this constraint fails. This message is always +mapped to the first field causing the violation, even when using multiple fields +in the constraint. + +.. versionadded:: 3.1 + The ability to include the invalid value into the message was introduced + in Symfony 3.1. + +Messages can include the ``{{ value }}`` placeholder to display a string +representation of the invalid entity. If the entity doesn't define the +``__toString()`` method, the following generic value will be used: *"Object of +class __CLASS__ identified by "* em ~~ From 218915fcbf859262be2105737d702d7013718514 Mon Sep 17 00:00:00 2001 From: Henry Snoek Date: Mon, 3 Oct 2016 11:00:35 +0200 Subject: [PATCH 21/22] refer to Symfony instead of Symfony2 With Symfony version 3.x it doesn't make sense to refer to Symfony2 in the documentation. --- components/expression_language.rst | 2 +- translation/debug.rst | 34 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/components/expression_language.rst b/components/expression_language.rst index bb0cf1c510d..ad7f3f924f6 100644 --- a/components/expression_language.rst +++ b/components/expression_language.rst @@ -21,7 +21,7 @@ How can the Expression Engine Help Me? -------------------------------------- The purpose of the component is to allow users to use expressions inside -configuration for more complex logic. For some examples, the Symfony2 Framework +configuration for more complex logic. For some examples, the Symfony Framework uses expressions in security, for validation rules and in route matching. Besides using the component in the framework itself, the ExpressionLanguage diff --git a/translation/debug.rst b/translation/debug.rst index 75805ae3fa3..899b56889ec 100644 --- a/translation/debug.rst +++ b/translation/debug.rst @@ -15,21 +15,21 @@ tag or filter usages in Twig templates: .. code-block:: jinja - {% trans %}Symfony2 is great{% endtrans %} + {% trans %}Symfony is great{% endtrans %} - {{ 'Symfony2 is great'|trans }} + {{ 'Symfony is great'|trans }} - {{ 'Symfony2 is great'|transchoice(1) }} + {{ 'Symfony is great'|transchoice(1) }} - {% transchoice 1 %}Symfony2 is great{% endtranschoice %} + {% transchoice 1 %}Symfony is great{% endtranschoice %} It will also detect the following translator usages in PHP templates: .. code-block:: php - $view['translator']->trans("Symfony2 is great"); + $view['translator']->trans("Symfony is great"); - $view['translator']->transChoice('Symfony2 is great', 1); + $view['translator']->transChoice('Symfony is great', 1); .. caution:: @@ -41,7 +41,7 @@ It will also detect the following translator usages in PHP templates: .. code-block:: jinja - {% set message = 'Symfony2 is great' %} + {% set message = 'Symfony is great' %} {{ message|trans }} Suppose your application's default_locale is ``fr`` and you have configured @@ -59,8 +59,8 @@ you've already setup some translations for the ``fr`` locale inside an AcmeDemoB - Symfony2 is great - J'aime Symfony2 + Symfony is great + J'aime Symfony @@ -70,13 +70,13 @@ you've already setup some translations for the ``fr`` locale inside an AcmeDemoB .. code-block:: yaml # src/Acme/AcmeDemoBundle/Resources/translations/messages.fr.yml - Symfony2 is great: J'aime Symfony2 + Symfony is great: J'aime Symfony .. code-block:: php // src/Acme/AcmeDemoBundle/Resources/translations/messages.fr.php return array( - 'Symfony2 is great' => 'J\'aime Symfony2', + 'Symfony is great' => 'J\'aime Symfony', ); and for the ``en`` locale: @@ -91,8 +91,8 @@ and for the ``en`` locale: - Symfony2 is great - Symfony2 is great + Symfony is great + Symfony is great @@ -101,13 +101,13 @@ and for the ``en`` locale: .. code-block:: yaml # src/Acme/AcmeDemoBundle/Resources/translations/messages.en.yml - Symfony2 is great: Symfony2 is great + Symfony is great: Symfony is great .. code-block:: php // src/Acme/AcmeDemoBundle/Resources/translations/messages.en.php return array( - 'Symfony2 is great' => 'Symfony2 is great', + 'Symfony is great' => 'Symfony is great', ); To inspect all messages in the ``fr`` locale for the AcmeDemoBundle, run: @@ -128,7 +128,7 @@ It shows you a table with the result when translating the message in the ``fr`` locale and the result when the fallback locale ``en`` would be used. On top of that, it will also show you when the translation is the same as the fallback translation (this could indicate that the message was not correctly translated). -Furthermore, it indicates that the message ``Symfony2 is great`` is unused +Furthermore, it indicates that the message ``Symfony is great`` is unused because it is translated, but you haven't used it anywhere yet. Now, if you translate the message in one of your templates, you will get this @@ -140,7 +140,7 @@ output: The state is empty which means the message is translated in the ``fr`` locale and used in one or more templates. -If you delete the message ``Symfony2 is great`` from your translation file +If you delete the message ``Symfony is great`` from your translation file for the ``fr`` locale and run the command, you will get: .. image:: /_images/translation/debug_3.png From 1ab78e036a3b9e58823a35106fe0bac5f6130939 Mon Sep 17 00:00:00 2001 From: Zairig Imad Date: Sun, 2 Oct 2016 09:50:35 +0100 Subject: [PATCH 22/22] Update buisness-logic --- best_practices/business-logic.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/best_practices/business-logic.rst b/best_practices/business-logic.rst index 2ad86cfea2f..5e3a54a2701 100644 --- a/best_practices/business-logic.rst +++ b/best_practices/business-logic.rst @@ -15,7 +15,7 @@ Inside here, you can create whatever directories you want to organize things: .. code-block:: text - symfony2-project/ + symfony-project/ ├─ app/ ├─ src/ │ └─ AppBundle/ @@ -33,7 +33,7 @@ and put things there: .. code-block:: text - symfony2-project/ + symfony-project/ ├─ app/ ├─ src/ │ ├─ Acme/ @@ -176,7 +176,7 @@ The three entities defined by our sample blog application are a good example: .. code-block:: text - symfony2-project/ + symfony-project/ ├─ ... └─ src/ └─ AppBundle/