From ae95ea1c860d49785cba6ce034039316b8b0605a Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 4 Mar 2014 19:25:38 +0100 Subject: [PATCH 01/15] close opened literals --- 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 73b00b494a7..35e740241d1 100644 --- a/quick_tour/the_controller.rst +++ b/quick_tour/the_controller.rst @@ -109,7 +109,7 @@ Getting information from the Request ------------------------------------ Symfony automatically injects the ``Request`` object when the controller has an -argument that's type hinted with ``Symfony\Component\HttpFoundation\Request`:: +argument that's type hinted with ``Symfony\Component\HttpFoundation\Request``:: use Symfony\Component\HttpFoundation\Request; From 7089d97c234a9460830d2f15a49d93053f70ff46 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 5 Mar 2014 11:10:06 -0600 Subject: [PATCH 02/15] [#3116] Fixing wrong table name - singular is used elsewhere --- 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 8ba616eb481..6e0ebabd598 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -629,7 +629,7 @@ of the application:: use Doctrine\ORM\Mapping as ORM; /** - * @ORM\Table(name="acme_roles") + * @ORM\Table(name="acme_role") * @ORM\Entity() */ class Role implements RoleInterface From 5bafc3cce94f9edf881a3f5f7b4a8ee2672d93ab Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 8 Mar 2014 11:04:36 +0100 Subject: [PATCH 03/15] remove the label_attr option which is not available in the button type --- reference/forms/types/button.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/reference/forms/types/button.rst b/reference/forms/types/button.rst index d688598008a..dc723fd1630 100644 --- a/reference/forms/types/button.rst +++ b/reference/forms/types/button.rst @@ -15,7 +15,6 @@ A simple, non-responsive button. | Options | - `attr`_ | | | - `disabled`_ | | | - `label`_ | -| | - `label_attr`_ | | | - `translation_domain`_ | +----------------------+----------------------------------------------------------------------+ | Overridden options | - `auto_initialize`_ | @@ -34,8 +33,6 @@ Options .. include:: /reference/forms/types/options/button_label.rst.inc -.. include:: /reference/forms/types/options/label_attr.rst.inc - .. include:: /reference/forms/types/options/button_translation_domain.rst.inc Overridden Options From a7cdfe96a53e64af467272b372583a3ae96c6379 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 8 Mar 2014 12:39:55 -0600 Subject: [PATCH 04/15] [#3596] Tweaking language on HTTP cache I realized that the sentence on the notes was a bid hard to read. I also removed a usage of the word "client" right before this, so I can use the word "cache" instead (meaning, I want the user to be thinking about the reverse proxy, not a user's browser cache - that's valid, but not the typical use-case). --- book/http_cache.rst | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/book/http_cache.rst b/book/http_cache.rst index 620b647d341..7a989805178 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -526,11 +526,9 @@ the application whether or not the cached response is still valid. If the cache *is* still valid, your application should return a 304 status code and no content. This tells the cache that it's ok to return the cached response. -Under this model, you mainly save bandwidth as the representation is not -sent twice to the same client (a 304 response is sent instead). But if you -design your application carefully, you might be able to get the bare minimum -data needed to send a 304 response and save CPU also (see below for an implementation -example). +Under this model, you only save CPU if you're able to determine that the +cached response is still valid by doing *less* work than generating the whole +page again (see below for an implementation example). .. tip:: @@ -578,10 +576,10 @@ automatically sets the ``Response`` status code to 304. .. note:: - The ``If-None-Match`` request header equals the ``ETag`` header of the - last response sent to the client for the particular resource. This is - how the client and server communicate with each other and decide whether - or not the resource has been updated since it was cached. + The cache sets the ``If-None-Match`` header on the request to the ``ETag`` + of the original cached response before sending the request back to the + app. This is how the cache and server communicate with each other and + decide whether or not the resource has been updated since it was cached. This algorithm is simple enough and very generic, but you need to create the whole ``Response`` before being able to compute the ETag, which is sub-optimal. @@ -646,10 +644,10 @@ the ``Response`` will be set to a 304 status code. .. note:: - The ``If-Modified-Since`` request header equals the ``Last-Modified`` - header of the last response sent to the client for the particular resource. - This is how the client and server communicate with each other and decide - whether or not the resource has been updated since it was cached. + The cache sets the ``If-Modified-Since`` header on the request to the ``Last-Modified`` + of the original cached response before sending the request back to the + app. This is how the cache and server communicate with each other and + decide whether or not the resource has been updated since it was cached. .. index:: single: Cache; Conditional get From 7006c02a1e3839d5eec119ccb70a8c775d311f54 Mon Sep 17 00:00:00 2001 From: Andrew M Date: Mon, 10 Mar 2014 18:10:07 +0200 Subject: [PATCH 05/15] Minimize horizontal scrolling, add missing characters. --- components/options_resolver.rst | 7 +++++-- components/property_access/introduction.rst | 10 +++++++--- components/security/firewall.rst | 12 +++++++++--- components/stopwatch.rst | 14 +++++++------- components/templating/helpers/slotshelper.rst | 4 +++- components/translation/introduction.rst | 7 ++++++- 6 files changed, 37 insertions(+), 17 deletions(-) diff --git a/components/options_resolver.rst b/components/options_resolver.rst index 3eed8478d7b..acb4d1bc553 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -107,7 +107,8 @@ the ``OptionsResolver`` class:: protected function configureOptions(OptionsResolverInterface $resolver) { - // ... configure the resolver, you will learn this in the sections below + // ... configure the resolver, you will learn this + // in the sections below } } @@ -256,7 +257,9 @@ again. When using a closure as the new value it is passed 2 arguments: $resolver->setDefaults(array( 'encryption' => 'tls', // simple overwrite 'host' => function (Options $options, $previousValue) { - return 'localhost' == $previousValue ? '127.0.0.1' : $previousValue; + return 'localhost' == $previousValue + ? '127.0.0.1' + : $previousValue; }, )); } diff --git a/components/property_access/introduction.rst b/components/property_access/introduction.rst index 37a56d4dfd5..22ad48b9a2e 100644 --- a/components/property_access/introduction.rst +++ b/components/property_access/introduction.rst @@ -196,7 +196,9 @@ enable this feature by using :class:`Symfony\\Component\\PropertyAccess\\Propert { $property = lcfirst(substr($name, 3)); if ('get' === substr($name, 0, 3)) { - return isset($this->children[$property]) ? $this->children[$property] : null; + return isset($this->children[$property]) + ? $this->children[$property] + : null; } elseif ('set' === substr($name, 0, 3)) { $value = 1 == count($args) ? $args[0] : null; $this->children[$property] = $value; @@ -289,7 +291,9 @@ see `Enable other Features`_. { $property = lcfirst(substr($name, 3)); if ('get' === substr($name, 0, 3)) { - return isset($this->children[$property]) ? $this->children[$property] : null; + return isset($this->children[$property]) + ? $this->children[$property] + : null; } elseif ('set' === substr($name, 0, 3)) { $value = 1 == count($args) ? $args[0] : null; $this->children[$property] = $value; @@ -307,7 +311,7 @@ see `Enable other Features`_. $accessor->setValue($person, 'wouter', array(...)); - echo $person->getWouter() // array(...) + echo $person->getWouter(); // array(...) Mixing Objects and Arrays ------------------------- diff --git a/components/security/firewall.rst b/components/security/firewall.rst index 0817662db65..2c19dd9c6c5 100644 --- a/components/security/firewall.rst +++ b/components/security/firewall.rst @@ -12,14 +12,17 @@ certain action or resource of the application:: use Symfony\Component\Security\Core\SecurityContext; use Symfony\Component\Security\Core\Exception\AccessDeniedException; - + // instance of Symfony\Component\Security\Core\Authentication\AuthenticationManagerInterface $authenticationManager = ...; // instance of Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface $accessDecisionManager = ...; - $securityContext = new SecurityContext($authenticationManager, $accessDecisionManager); + $securityContext = new SecurityContext( + $authenticationManager, + $accessDecisionManager + ); // ... authenticate the user @@ -71,7 +74,10 @@ with the event dispatcher that is used by the :class:`Symfony\\Component\\HttpKe $firewall = new Firewall($map, $dispatcher); - $dispatcher->addListener(KernelEvents::REQUEST, array($firewall, 'onKernelRequest'); + $dispatcher->addListener( + KernelEvents::REQUEST, + array($firewall, 'onKernelRequest') + ); The firewall is registered to listen to the ``kernel.request`` event that will be dispatched by the HttpKernel at the beginning of each request diff --git a/components/stopwatch.rst b/components/stopwatch.rst index 3ac7f760a66..a839b432ddf 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -68,13 +68,13 @@ call:: In addition to periods, you can get other useful information from the event object. For example:: - $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(); // Returns the event duration, including all periods - $event->getMemory(); // Returns the max memory usage of all periods + $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(); // Returns the event duration, including all periods + $event->getMemory(); // Returns the max memory usage of all periods Sections -------- diff --git a/components/templating/helpers/slotshelper.rst b/components/templating/helpers/slotshelper.rst index cd01977616f..c264b2244e2 100644 --- a/components/templating/helpers/slotshelper.rst +++ b/components/templating/helpers/slotshelper.rst @@ -24,7 +24,9 @@ display the content of the slot on that place: - <?php $view['slots']->output('title', 'Default title') ?> + + <?php $view['slots']->output('title', 'Default title') ?> + output('_content') ?> diff --git a/components/translation/introduction.rst b/components/translation/introduction.rst index 9ccc34c74ed..ca1df51756b 100644 --- a/components/translation/introduction.rst +++ b/components/translation/introduction.rst @@ -190,7 +190,12 @@ loaded like this:: $translator->addResource('xliff', 'messages.fr.xliff', 'fr_FR'); $translator->addResource('xliff', 'admin.fr.xliff', 'fr_FR', 'admin'); - $translator->addResource('xliff', 'navigation.fr.xliff', 'fr_FR', 'navigation'); + $translator->addResource( + 'xliff', + 'navigation.fr.xliff', + 'fr_FR', + 'navigation' + ); When translating strings that are not in the default domain (``messages``), you must specify the domain as the third argument of ``trans()``:: From 2ec09a3fab297b25095f95091843452fa6b7f8bd Mon Sep 17 00:00:00 2001 From: Andrew M Date: Mon, 10 Mar 2014 18:30:21 +0200 Subject: [PATCH 06/15] Fix typos, remove trailing whitespace. --- components/serializer.rst | 2 +- reference/configuration/framework.rst | 6 +++--- reference/constraints/UniqueEntity.rst | 8 ++++---- reference/dic_tags.rst | 4 ++-- reference/forms/twig_reference.rst | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index 4064743c076..e45dc61f74c 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -186,7 +186,7 @@ JMSSerializer A popular third-party library, `JMS serializer`_, provides a more sophisticated albeit more complex solution. This library includes the -ability to configure how your objects should be serialize/deserialized via +ability to configure how your objects should be serialized/deserialized via annotations (as well as YAML, XML and PHP), integration with the Doctrine ORM, and handling of other complex cases (e.g. circular references). diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index ade3c89fe22..0f06b609f67 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -171,9 +171,9 @@ cookie_lifetime **type**: ``integer`` **default**: ``null`` -This determines the lifetime of the session - in seconds. It will use ``null`` by +This determines the lifetime of the session - in seconds. It will use ``null`` by default, which means ``session.cookie_lifetime`` value from ``php.ini`` will be used. -Setting this value to ``0`` means the cookie is valid for the length of the browser +Setting this value to ``0`` means the cookie is valid for the length of the browser session. cookie_path @@ -204,7 +204,7 @@ cookie_httponly **type**: ``Boolean`` **default**: ``false`` -This determines whether cookies should only accessible through the HTTP protocol. +This determines whether cookies should only be accessible through the HTTP protocol. This means that the cookie won't be accessible by scripting languages, such as JavaScript. This setting can effectively help to reduce identity theft through XSS attacks. diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index 2c05d02863b..bdc90af17fe 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -64,7 +64,7 @@ table: * @Assert\Email() */ protected $email; - + // ... } @@ -97,7 +97,7 @@ table: // DON'T forget this use statement!!! use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; - + class Author { public static function loadValidatorMetadata(ClassMetadata $metadata) @@ -142,8 +142,8 @@ em **type**: ``string`` The name of the entity manager to use for making the query to determine the -uniqueness. If it's left blank, the correct entity manager will determined for -this class. For that reason, this option should probably not need to be +uniqueness. If it's left blank, the correct entity manager will be determined +for this class. For that reason, this option should probably not need to be used. repositoryMethod diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index cbb8ca4c6a9..ab3228c895d 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -847,7 +847,7 @@ swiftmailer.default.plugin If you're using a custom SwiftMailer plugin (or want to create one), you can register it with SwiftMailer by creating a service for your plugin and tagging -it with ``swiftmailer.default.plugin`` (it has no options). +it with ``swiftmailer.default.plugin`` (it has no options). .. note:: @@ -901,7 +901,7 @@ translation.loader **Purpose**: To register a custom service that loads translations -By default, translations are loaded form the filesystem in a variety of different +By default, translations are loaded from the filesystem in a variety of different formats (YAML, XLIFF, PHP, etc). If you need to load translations from some other source, first create a class that implements the :class:`Symfony\\Component\\Translation\\Loader\\LoaderInterface` interface:: diff --git a/reference/forms/twig_reference.rst b/reference/forms/twig_reference.rst index 06654a89916..1088f4f6f88 100644 --- a/reference/forms/twig_reference.rst +++ b/reference/forms/twig_reference.rst @@ -267,7 +267,7 @@ to see what options you have available. Behind the scenes, these variables are made available to the ``FormView`` object of your form when the Form component calls ``buildView`` and ``buildViewBottomUp`` - on each "node" of your form tree. To see what "view" variables a particularly + on each "node" of your form tree. To see what "view" variables a particular field has, find the source code for the form field (and its parent fields) and look at the above two functions. From 7e09e825996b147eafa52da32abdb173030d3e6d Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Mon, 10 Mar 2014 20:29:57 +0100 Subject: [PATCH 07/15] [Internals] Complete notification description for kernel.terminate --- book/internals.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/book/internals.rst b/book/internals.rst index 7ed0cbe2272..d93cb0ab587 100644 --- a/book/internals.rst +++ b/book/internals.rst @@ -172,7 +172,10 @@ Event): #. Listeners of the ``kernel.response`` event can manipulate the ``Response`` (content and headers); -#. The Response is returned. +#. The Response is returned; + +#. Listeners of the ``kernel.terminate`` event can perform tasks after the + Response has been served. If an Exception is thrown during processing, the ``kernel.exception`` is notified and listeners are given a chance to convert the Exception to a @@ -367,6 +370,8 @@ The FrameworkBundle registers several listeners: ``kernel.terminate`` Event .......................... +*Event Class*: :class:`Symfony\\Component\\HttpKernel\\Event\\PostResponseEvent` + The purpose of this event is to perform "heavier" tasks after the response was already served to the client. From 2ed16bc68f9e5d56cff7289cd20c8d5fb9af379e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20PY?= Date: Tue, 4 Mar 2014 16:18:46 +0100 Subject: [PATCH 08/15] =?UTF-8?q?Fix=20goal=20of=20=E2=80=9Cframework.prof?= =?UTF-8?q?iler.only=5Fexceptions=E2=80=9C=20option=20which=20profile=20on?= =?UTF-8?q?=20each=20exceptions=20on=20controller=20(not=20only=20500)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- book/internals.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/internals.rst b/book/internals.rst index 7ed0cbe2272..b2e77ec107d 100644 --- a/book/internals.rst +++ b/book/internals.rst @@ -644,7 +644,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`` -settings limits profiling to 500 pages, but what if you want to get +settings limits profiling to exceptions, 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 in ":doc:`/cookbook/profiler/matchers`". From c66cd747d0a7adcf1ca0e1b4ff541bc9cfecd30a Mon Sep 17 00:00:00 2001 From: Antoine Date: Wed, 5 Mar 2014 12:07:08 +0100 Subject: [PATCH 09/15] Update render_without_controller.rst --- cookbook/templating/render_without_controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/templating/render_without_controller.rst b/cookbook/templating/render_without_controller.rst index c718dfdea5e..ae79a0d85b7 100644 --- a/cookbook/templating/render_without_controller.rst +++ b/cookbook/templating/render_without_controller.rst @@ -95,7 +95,7 @@ other variables in your route, you can control exactly how your page is cached: _controller: FrameworkBundle:Template:template template: 'AcmeBundle:Static:privacy.html.twig' maxAge: 86400 - sharedMaxAge: 86400 + sharedAge: 86400 .. code-block:: xml From da50d9b2752f31109b6ab0b10cc438c012ddd820 Mon Sep 17 00:00:00 2001 From: Antoine Date: Sun, 9 Mar 2014 14:02:18 +0100 Subject: [PATCH 10/15] Update render_without_controller.rst --- cookbook/templating/render_without_controller.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cookbook/templating/render_without_controller.rst b/cookbook/templating/render_without_controller.rst index ae79a0d85b7..72cbdacc563 100644 --- a/cookbook/templating/render_without_controller.rst +++ b/cookbook/templating/render_without_controller.rst @@ -109,7 +109,7 @@ other variables in your route, you can control exactly how your page is cached: FrameworkBundle:Template:template AcmeBundle:Static:privacy.html.twig 86400 - 86400 + 86400 @@ -123,15 +123,15 @@ other variables in your route, you can control exactly how your page is cached: '_controller' => 'FrameworkBundle:Template:template', 'template' => 'AcmeBundle:Static:privacy.html.twig', 'maxAge' => 86400, - 'sharedMaxAge' => 86400, + 'sharedAge' => 86400, ))); return $collection; -The ``maxAge`` and ``sharedMaxAge`` values are used to modify the Response +The ``maxAge`` and ``sharedAge`` 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. +will be made public, as long as ``maxAge`` or ``sharedAge`` are passed. If set to ``true``, the Response will be marked as private. From c8092d46eb8c5f4428d5f1166cf75bb6fecd3ad6 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 6 Mar 2014 11:06:11 +0100 Subject: [PATCH 11/15] Fixed one typo and one formatting issue --- components/dependency_injection/parameters.rst | 1 - reference/forms/types/choice.rst | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/components/dependency_injection/parameters.rst b/components/dependency_injection/parameters.rst index 98194076885..24edfc4ff98 100644 --- a/components/dependency_injection/parameters.rst +++ b/components/dependency_injection/parameters.rst @@ -155,7 +155,6 @@ making the class of a service a parameter: %mailer.transport% - .. code-block:: php diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index a814df05f91..4cc88ed5f50 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -122,7 +122,7 @@ compound **type**: ``boolean`` **default**: same value as ``expanded`` option This option specifies if a form is compound. The value is by default -overriden by the value of the ``expanded`` option. +overridden by the value of the ``expanded`` option. error_bubbling ~~~~~~~~~~~~~~ From fabdd8ab2cb652aa56a8e213c8dce27ab115b040 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 6 Mar 2014 12:11:26 +0100 Subject: [PATCH 12/15] Added some examples to the "services as parameters" section --- .../dependency_injection/parameters.rst | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/components/dependency_injection/parameters.rst b/components/dependency_injection/parameters.rst index 24edfc4ff98..b4209e7f68a 100644 --- a/components/dependency_injection/parameters.rst +++ b/components/dependency_injection/parameters.rst @@ -343,6 +343,16 @@ Start the string with ``@`` or ``@?`` to reference a service in YAML. * ``@?mailer`` references the ``mailer`` service. If the service does not exist, it will be ignored; +.. code-block:: yaml + + # app/config/config.yml + parameters: + # if 'my_mailer' service isn't defined, an exception will be raised + foo: @my_mailer + + # if 'my_logger' service isn't defined, 'bar' will be null + bar: @?my_logger + .. tip:: Use ``@@`` to escape the ``@`` symbol in YAML. ``@@mailer`` will be @@ -358,6 +368,17 @@ 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). +.. code-block:: xml + + + + + + + + + + PHP ~~~ @@ -366,3 +387,16 @@ In PHP, you can use the a service. The invalid behavior is configured using the second constructor argument and constants from :class:`Symfony\\Component\\DependencyInjection\\ContainerInterface`. + +.. code-block:: php + + // app/config/config.php + use Symfony\Component\DependencyInjection\Reference; + + // if 'my_mailer' service isn't defined, an exception will be raised + $container->setParameter('foo', new Reference('my_mailer')); + + // if 'my_logger' service isn't defined, 'bar' will be null + $container->setParameter('bar', new Reference('my_logger', + ContainerInterface::NULL_ON_INVALID_REFERENCE + )); From c0d766eeef5a15c92ceca4448d3f861c0dd5716c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 8 Mar 2014 12:11:27 +0100 Subject: [PATCH 13/15] Removed the file path comments because this doc is for the component and it should not make any reference to Symfony --- components/dependency_injection/parameters.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/components/dependency_injection/parameters.rst b/components/dependency_injection/parameters.rst index b4209e7f68a..e30a186fb76 100644 --- a/components/dependency_injection/parameters.rst +++ b/components/dependency_injection/parameters.rst @@ -345,7 +345,6 @@ Start the string with ``@`` or ``@?`` to reference a service in YAML. .. code-block:: yaml - # app/config/config.yml parameters: # if 'my_mailer' service isn't defined, an exception will be raised foo: @my_mailer @@ -370,7 +369,6 @@ method call, the method call is removed). .. code-block:: xml - @@ -390,7 +388,6 @@ argument and constants from .. code-block:: php - // app/config/config.php use Symfony\Component\DependencyInjection\Reference; // if 'my_mailer' service isn't defined, an exception will be raised From c649f3885e85009c59b076b5eb4dfa765d81eb9f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 6 Mar 2014 13:22:59 +0100 Subject: [PATCH 14/15] Fixed some typos and formatting issues --- .../http_foundation/session_configuration.rst | 42 ++++++++++--------- components/http_foundation/sessions.rst | 14 +++---- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index f5ad863a2cb..bb8ba19c64e 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -13,16 +13,16 @@ Save Handlers ~~~~~~~~~~~~~ The PHP session workflow has 6 possible operations that may occur. The normal -session follows `open`, `read`, `write` and `close`, with the possibility of -`destroy` and `gc` (garbage collection which will expire any old sessions: `gc` -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 +session follows ``open``, ``read``, ``write`` and ``close``, with the possibility +of ``destroy`` and ``gc`` (garbage collection which will expire any old sessions: +``gc`` 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 ------------------------ -So-called 'native' handlers, are save handlers which are either compiled into +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. @@ -50,14 +50,16 @@ Example usage:: .. note:: - With the exception of the ``files`` handler which is built into PHP and always available, - the availability of the other handlers depends on those PHP extensions being active at runtime. + With the exception of the ``files`` handler which is built into PHP and + always available, the availability of the other handlers depends on those + PHP extensions being active at runtime. .. note:: - Native save handlers provide a quick solution to session storage, however, in complex systems - where you need more control, custom save handlers may provide more freedom and flexibility. - Symfony2 provides several implementations which you may further customize as required. + Native save handlers provide a quick solution to session storage, however, + in complex systems where you need more control, custom save handlers may + provide more freedom and flexibility. Symfony2 provides several implementations + which you may further customize as required. Custom Save Handlers -------------------- @@ -183,14 +185,14 @@ session is started. The session can be destroyed as required. This method of processing can allow the expiry of sessions to be integrated into the user experience, for example, by displaying a message. -Symfony2 records some basic meta-data about each session to give you complete +Symfony2 records some basic metadata about each session to give you complete freedom in this area. -Session meta-data -~~~~~~~~~~~~~~~~~ +Session metadata +~~~~~~~~~~~~~~~~ -Sessions are decorated with some basic meta-data to enable fine control over the -security settings. The session object has a getter for the meta-data, +Sessions are decorated with some basic metadata to enable fine control over the +security settings. The session object has a getter for the metadata, :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getMetadataBag` which exposes an instance of :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\MetadataBag`:: @@ -199,7 +201,7 @@ exposes an instance of :class:`Symfony\\Component\\HttpFoundation\\Session\\Stor Both methods return a Unix timestamp (relative to the server). -This meta-data can be used to explicitly expire a session on access, e.g.:: +This metadata can be used to explicitly expire a session on access, e.g.:: $session->start(); if (time() - $session->getMetadataBag()->getLastUsed() > $maxIdleTime) { @@ -220,7 +222,7 @@ PHP 5.4 compatibility Since PHP 5.4.0, :phpclass:`SessionHandler` and :phpclass:`SessionHandlerInterface` are available. Symfony provides forward compatibility for the :phpclass:`SessionHandlerInterface` -so it can be used under PHP 5.3. This greatly improves inter-operability with other +so it can be used under PHP 5.3. This greatly improves interoperability with other libraries. :phpclass:`SessionHandler` is a special PHP internal class which exposes native save @@ -228,7 +230,7 @@ handlers to PHP user-space. In order to provide a solution for those using PHP 5.4, Symfony2 has a special class called :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeSessionHandler` -which under PHP 5.4, extends from `\SessionHandler` and under PHP 5.3 is just a +which under PHP 5.4, extends from ``\SessionHandler`` and under PHP 5.3 is just a empty base class. This provides some interesting opportunities to leverage PHP 5.4 functionality if it is available. @@ -251,12 +253,12 @@ wrapped by one. :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeProxy` is used automatically under PHP 5.3 when internal PHP save handlers are specified -using the `Native*SessionHandler` classes, while +using the ``Native*SessionHandler`` classes, while :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\SessionHandlerProxy` will be used to wrap any custom save handlers, that implement :phpclass:`SessionHandlerInterface`. From PHP 5.4 and above, all session handlers implement :phpclass:`SessionHandlerInterface` -including `Native*SessionHandler` classes which inherit from :phpclass:`SessionHandler`. +including ``Native*SessionHandler`` classes which inherit from :phpclass:`SessionHandler`. The proxy mechanism allows you to get more deeply involved in session save handler classes. A proxy for example could be used to encrypt any session transaction diff --git a/components/http_foundation/sessions.rst b/components/http_foundation/sessions.rst index 837da929b41..2f1ef11579e 100644 --- a/components/http_foundation/sessions.rst +++ b/components/http_foundation/sessions.rst @@ -121,7 +121,7 @@ an array. A few methods exist for "Bag" management: Gets the :class:`Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface`. This is just a shortcut for convenience. -Session meta-data +Session metadata * :method:`Symfony\\Component\\HttpFoundation\\Session\\Session::getMetadataBag`: Gets the :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\MetadataBag` @@ -132,8 +132,8 @@ Session Data Management PHP's session management requires the use of the ``$_SESSION`` super-global, however, this interferes somewhat with code testability and encapsulation in a -OOP paradigm. To help overcome this, Symfony2 uses 'session bags' linked to the -session to encapsulate a specific dataset of 'attributes' or 'flash messages'. +OOP paradigm. To help overcome this, Symfony2 uses *session bags* linked to the +session to encapsulate a specific dataset of attributes or flash messages. This approach also mitigates namespace pollution within the ``$_SESSION`` super-global because each bag stores all its data under a unique namespace. @@ -141,7 +141,7 @@ This allows Symfony2 to peacefully co-exist with other applications or libraries that might use the ``$_SESSION`` super-global and all data remains completely compatible with Symfony2's session management. -Symfony2 provides 2 kinds of storage bags, with two separate implementations. +Symfony2 provides two kinds of storage bags, with two separate implementations. Everything is written against interfaces so you may extend or create your own bag types if necessary. @@ -172,11 +172,11 @@ and remember me login settings or other user based state information. * :class:`Symfony\\Component\\HttpFoundation\\Session\\Attribute\\NamespacedAttributeBag` This implementation allows for attributes to be stored in a structured namespace. -Any plain `key => value` storage system is limited in the extent to which +Any plain ``key => value`` storage system is limited in the extent to which complex data can be stored since each key must be unique. You can achieve namespacing by introducing a naming convention to the keys so different parts of -your application could operate without clashing. For example, `module1.foo` and -`module2.foo`. However, sometimes this is not very practical when the attributes +your application could operate without clashing. For example, ``module1.foo`` and +``module2.foo``. However, sometimes this is not very practical when the attributes data is an array, for example a set of tokens. In this case, managing the array becomes a burden because you have to retrieve the array then process it and store it again:: From 8def8299d3d573742a32f4a58f039be66374ab16 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 8 Mar 2014 12:17:10 +0100 Subject: [PATCH 15/15] Minor corrections --- components/http_foundation/session_configuration.rst | 2 +- components/http_foundation/sessions.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index bb8ba19c64e..ba8dfa80fd8 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -22,7 +22,7 @@ invoked after the ``open`` operation). You can read more about this at Native PHP Save Handlers ------------------------ -So-called *native* handlers, are save handlers which are either compiled into +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. diff --git a/components/http_foundation/sessions.rst b/components/http_foundation/sessions.rst index 2f1ef11579e..dd5ddfdba54 100644 --- a/components/http_foundation/sessions.rst +++ b/components/http_foundation/sessions.rst @@ -172,7 +172,7 @@ and remember me login settings or other user based state information. * :class:`Symfony\\Component\\HttpFoundation\\Session\\Attribute\\NamespacedAttributeBag` This implementation allows for attributes to be stored in a structured namespace. -Any plain ``key => value`` storage system is limited in the extent to which +Any plain key-value storage system is limited in the extent to which complex data can be stored since each key must be unique. You can achieve namespacing by introducing a naming convention to the keys so different parts of your application could operate without clashing. For example, ``module1.foo`` and