From 42579bb06ea2521c61456be604444a917070d00b Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Tue, 26 Nov 2013 07:41:26 +0100 Subject: [PATCH 1/8] New cookbok: How to use the Cloud to send Emails --- cookbook/email/cloud.rst | 110 +++++++++++++++++++++++++++++++++++++++ cookbook/map.rst.inc | 1 + 2 files changed, 111 insertions(+) create mode 100644 cookbook/email/cloud.rst diff --git a/cookbook/email/cloud.rst b/cookbook/email/cloud.rst new file mode 100644 index 00000000000..52544a381ca --- /dev/null +++ b/cookbook/email/cloud.rst @@ -0,0 +1,110 @@ +.. index:: + single: Emails; Cloud + +How to use the Cloud to send Emails +=================================== + +Requirements for sending emails from a production system differ from your +development setup as you don't want to be limited in the number of emails, +the sending rate or the sender address. Thus, +:doc:`using Gmail `_ or similar services is not an +option. If setting up and maintaining your own reliable mail server causes +you a headache there's a simple solution: Leverage the cloud to send your +emails. + +The following example shows how easy it is to integrate +`Amazon's Simple Email Services (SES)`_ into Symfony. But no matter what +service you're actually using, there's nothing more to it than configuring an +SMTP endpoint for Swift Mailer. + +In the Symfony configuration, change the Swift Mailer settings ``transport``, +``host``, ``port`` and ``encryption`` according to the information provided in +the `SES console`_. Create your individual SMTP credentials in the SES console +and complete the configuration with the provided ``username`` and ``password``: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config.yml + swiftmailer: + transport: smtp + host: email-smtp.us-east-1.amazonaws.com + port: 465 # different ports are available, see SES console + encryption: tls # TLS encryption is required + username: AWS_ACCESS_KEY # to be created in the SES console + password: AWS_SECRET_KEY # to be created in the SES console + + .. code-block:: xml + + + + + + + + .. code-block:: php + + // app/config/config.php + $container->loadFromExtension('swiftmailer', array( + 'transport' => "smtp", + 'host' => "email-smtp.us-east-1.amazonaws.com", + 'port' => 465, + 'encryption' => "tls", + 'username' => "AWS_ACCESS_KEY", + 'password' => "AWS_SECRET_KEY", + )); + +The ``port`` and ``encryption`` keys are not present in the Symfony Standard +Edition configuration by default, but you can simply add them as needed. + +And that's it, you're ready to start sending emails through the cloud! + +.. tip:: + + If you are using the Symfony Standard Edition, configure the parameters at + ``parameters.yml`` and use them in your configuration files. This allows + for different Swift Mailer configurations for each installation of your + application. For instance, use Gmail during development and the cloud in + production. + + .. code-block:: yaml + + # app/config/parameters.yml + parameters: + # ... + mailer_transport: smtp + mailer_host: email-smtp.us-east-1.amazonaws.com + mailer_port: 465 # different ports are available, see SES console + mailer_encryption: tls # TLS encryption is required + mailer_user: AWS_ACCESS_KEY # to be created in the SES console + mailer_password: AWS_SECRET_KEY # to be created in the SES console + +.. note:: + + If you intend to use Amazon SES, please note the following: + + * You have to sign up to `Amazon Web Services (AWS)`_; + + * Every sender address used in the ``From`` or ``ReturnPath`` (bounce + address) header needs to be confirmed by the owner. You can also + confirm an entire domain; + + * Initially you are in a restricted sandbox mode. You need to request + production access before being allowed to send to arbitrary + recipients; + + * SES may be subject to a charge. + +.. _`Amazon's Simple Email Services (SES)`: http://aws.amazon.com/ses +.. _`SES console`: https://console.aws.amazon.com/ses +.. _`Amazon Web Services (AWS)`: http://aws.amazon.com diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index 8c990f258cc..da80c233b36 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -68,6 +68,7 @@ * :doc:`/cookbook/email/email` * :doc:`/cookbook/email/gmail` + * :doc:`/cookbook/email/cloud` * :doc:`/cookbook/email/dev_environment` * :doc:`/cookbook/email/spool` * :doc:`/cookbook/email/testing` From 84fc4c3fae3fbf8fd544bb234a5228e86a2918cb Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sun, 1 Dec 2013 07:32:10 +0100 Subject: [PATCH 2/8] Fixes and improvements after review --- cookbook/email/cloud.rst | 47 +++++++++++++++++++++------------------- cookbook/email/gmail.rst | 29 ++++++++++++++----------- cookbook/email/index.rst | 1 + 3 files changed, 42 insertions(+), 35 deletions(-) diff --git a/cookbook/email/cloud.rst b/cookbook/email/cloud.rst index 52544a381ca..729f4bec208 100644 --- a/cookbook/email/cloud.rst +++ b/cookbook/email/cloud.rst @@ -1,7 +1,7 @@ .. index:: - single: Emails; Cloud + single: Emails; Using the cloud -How to use the Cloud to send Emails +How to use the Cloud to Send Emails =================================== Requirements for sending emails from a production system differ from your @@ -38,30 +38,33 @@ and complete the configuration with the provided ``username`` and ``password``: .. code-block:: xml - - - - + xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/swiftmailer http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd"> + + + + .. code-block:: php // app/config/config.php $container->loadFromExtension('swiftmailer', array( - 'transport' => "smtp", - 'host' => "email-smtp.us-east-1.amazonaws.com", - 'port' => 465, - 'encryption' => "tls", - 'username' => "AWS_ACCESS_KEY", - 'password' => "AWS_SECRET_KEY", + 'transport' => 'smtp', + 'host' => 'email-smtp.us-east-1.amazonaws.com', + 'port' => 465, + 'encryption' => 'tls', + 'username' => 'AWS_ACCESS_KEY', + 'password' => 'AWS_SECRET_KEY', )); The ``port`` and ``encryption`` keys are not present in the Symfony Standard @@ -71,7 +74,7 @@ And that's it, you're ready to start sending emails through the cloud! .. tip:: - If you are using the Symfony Standard Edition, configure the parameters at + If you are using the Symfony Standard Edition, configure the parameters in ``parameters.yml`` and use them in your configuration files. This allows for different Swift Mailer configurations for each installation of your application. For instance, use Gmail during development and the cloud in @@ -95,7 +98,7 @@ And that's it, you're ready to start sending emails through the cloud! * You have to sign up to `Amazon Web Services (AWS)`_; - * Every sender address used in the ``From`` or ``ReturnPath`` (bounce + * Every sender address used in the ``From`` or ``Return-Path`` (bounce address) header needs to be confirmed by the owner. You can also confirm an entire domain; diff --git a/cookbook/email/gmail.rst b/cookbook/email/gmail.rst index 80e24412acb..44f312fdc37 100644 --- a/cookbook/email/gmail.rst +++ b/cookbook/email/gmail.rst @@ -1,7 +1,7 @@ .. index:: single: Emails; Gmail -How to use Gmail to send Emails +How to use Gmail to Send Emails =============================== During development, instead of using a regular SMTP server to send emails, you @@ -29,31 +29,34 @@ In the development configuration file, change the ``transport`` setting to .. code-block:: xml - - + xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/swiftmailer http://symfony.com/schema/dic/swiftmailer/swiftmailer-1.0.xsd"> - + + + .. code-block:: php // app/config/config_dev.php $container->loadFromExtension('swiftmailer', array( - 'transport' => "gmail", - 'username' => "your_gmail_username", - 'password' => "your_gmail_password", + 'transport' => 'gmail', + 'username' => 'your_gmail_username', + 'password' => 'your_gmail_password', )); You're done! .. tip:: - If you are using the Symfony Standard Edition, configure the parameters at ``parameters.yml``: + If you are using the Symfony Standard Edition, configure the parameters in ``parameters.yml``: .. code-block:: yaml diff --git a/cookbook/email/index.rst b/cookbook/email/index.rst index 7209fbcc652..351301f03e6 100644 --- a/cookbook/email/index.rst +++ b/cookbook/email/index.rst @@ -6,6 +6,7 @@ Email email gmail + cloud dev_environment spool testing From 0f6c24635b6f15d04416d940c00f77e5922649a5 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Sun, 1 Dec 2013 16:54:27 +0100 Subject: [PATCH 3/8] Fix wording and formatting --- cookbook/email/cloud.rst | 17 +++++++++++------ cookbook/email/gmail.rst | 3 ++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cookbook/email/cloud.rst b/cookbook/email/cloud.rst index 729f4bec208..3f62afc746b 100644 --- a/cookbook/email/cloud.rst +++ b/cookbook/email/cloud.rst @@ -12,10 +12,14 @@ option. If setting up and maintaining your own reliable mail server causes you a headache there's a simple solution: Leverage the cloud to send your emails. -The following example shows how easy it is to integrate -`Amazon's Simple Email Services (SES)`_ into Symfony. But no matter what -service you're actually using, there's nothing more to it than configuring an -SMTP endpoint for Swift Mailer. +This cookbook shows how easy it is to integrate +`Amazon's Simple Email Service (SES)`_ into Symfony. + +.. note:: + + You can use the same technique for other mail services, as most of the + time there is nothing more to it than configuring an SMTP endpoint for + Swift Mailer. In the Symfony configuration, change the Swift Mailer settings ``transport``, ``host``, ``port`` and ``encryption`` according to the information provided in @@ -52,7 +56,8 @@ and complete the configuration with the provided ``username`` and ``password``: port="465" encryption="tls" username="AWS_ACCESS_KEY" - password="AWS_SECRET_KEY" /> + password="AWS_SECRET_KEY" + /> .. code-block:: php @@ -108,6 +113,6 @@ And that's it, you're ready to start sending emails through the cloud! * SES may be subject to a charge. -.. _`Amazon's Simple Email Services (SES)`: http://aws.amazon.com/ses +.. _`Amazon's Simple Email Service (SES)`: http://aws.amazon.com/ses .. _`SES console`: https://console.aws.amazon.com/ses .. _`Amazon Web Services (AWS)`: http://aws.amazon.com diff --git a/cookbook/email/gmail.rst b/cookbook/email/gmail.rst index 44f312fdc37..aba19a74a1e 100644 --- a/cookbook/email/gmail.rst +++ b/cookbook/email/gmail.rst @@ -40,7 +40,8 @@ In the development configuration file, change the ``transport`` setting to + password="your_gmail_password" + /> .. code-block:: php From 9a938795926cb16e65b9e4e2a817af48cf28ca06 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 5 Oct 2013 10:17:03 +0200 Subject: [PATCH 4/8] use DebugClassLoader class from Debug component instead of the one from the Class Loader component --- .../class_loader/debug_class_loader.rst | 14 +++--------- components/debug/class_loader.rst | 22 +++++++++++++++++++ components/debug/index.rst | 8 +++++++ .../{debug.rst => debug/introduction.rst} | 5 ++--- components/index.rst | 2 +- components/map.rst.inc | 5 +++-- .../front_controllers_and_kernel.rst | 4 ++-- 7 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 components/debug/class_loader.rst create mode 100644 components/debug/index.rst rename components/{debug.rst => debug/introduction.rst} (92%) diff --git a/components/class_loader/debug_class_loader.rst b/components/class_loader/debug_class_loader.rst index 7c724fb6a01..c56d7ffe095 100644 --- a/components/class_loader/debug_class_loader.rst +++ b/components/class_loader/debug_class_loader.rst @@ -4,14 +4,6 @@ Debugging a Class Loader ======================== -The :class:`Symfony\\Component\\ClassLoader\\DebugClassLoader` attempts to -throw more helpful exceptions when a class isn't found by the registered -autoloaders. All autoloaders that implement a ``findFile()`` method are replaced -with a ``DebugClassLoader`` wrapper. - -Using the ``DebugClassLoader`` is as easy as calling its static -:method:`Symfony\\Component\\ClassLoader\\DebugClassLoader::enable` method:: - - use Symfony\Component\ClassLoader\DebugClassLoader; - - DebugClassLoader::enable(); +Since Symfony 2.4, the ``DebugClassLoader`` of the Class Loader component is +deprecated. Use the +:doc:`DebugClassLoader provided by the Debug component `. diff --git a/components/debug/class_loader.rst b/components/debug/class_loader.rst new file mode 100644 index 00000000000..090b230baf4 --- /dev/null +++ b/components/debug/class_loader.rst @@ -0,0 +1,22 @@ +.. index:: + single: Class Loader; DebugClassLoader + single: Debug; DebugClassLoader + +Debugging a Class Loader +======================== + +.. versionadded:: 2.4 + The ``DebugClassLoader`` of the Debug component is new in Symfony 2.4. + Previously, it was located in the Class Loader component. + +The :class:`Symfony\\Component\\Debug\\DebugClassLoader` attempts to +throw more helpful exceptions when a class isn't found by the registered +autoloaders. All autoloaders that implement a ``findFile()`` method are replaced +with a ``DebugClassLoader`` wrapper. + +Using the ``DebugClassLoader`` is as easy as calling its static +:method:`Symfony\\Component\\Debug\\DebugClassLoader::enable` method:: + + use Symfony\Component\ClassLoader\DebugClassLoader; + + DebugClassLoader::enable(); diff --git a/components/debug/index.rst b/components/debug/index.rst new file mode 100644 index 00000000000..6797789cb1b --- /dev/null +++ b/components/debug/index.rst @@ -0,0 +1,8 @@ +Debug +===== + +.. toctree:: + :maxdepth: 2 + + introduction + class_loader diff --git a/components/debug.rst b/components/debug/introduction.rst similarity index 92% rename from components/debug.rst rename to components/debug/introduction.rst index 0d20a13ee9a..5691ca58be4 100644 --- a/components/debug.rst +++ b/components/debug/introduction.rst @@ -30,9 +30,8 @@ Enabling them all is as easy as it can get:: Debug::enable(); The :method:`Symfony\\Component\\Debug\\Debug::enable` method registers an -error handler and an exception handler. If the :doc:`ClassLoader component -` is available, a special class loader -is also registered. +error handler, an exception handler and +:doc:`a special class loader `. Read the following sections for more information about the different available tools. diff --git a/components/index.rst b/components/index.rst index b53785bb642..8e167cd2ac9 100644 --- a/components/index.rst +++ b/components/index.rst @@ -9,7 +9,7 @@ The Components config/index console/index css_selector - debug + debug/index dependency_injection/index dom_crawler event_dispatcher/index diff --git a/components/map.rst.inc b/components/map.rst.inc index a5f2d0f8db7..b472a607d3d 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -27,9 +27,10 @@ * :doc:`/components/css_selector` -* **Debug** +* :doc:`/components/debug/index` - * :doc:`/components/debug` + * :doc:`/components/debug/introduction` + * :doc:`/components/debug/class_loader` * :doc:`/components/dependency_injection/index` diff --git a/cookbook/configuration/front_controllers_and_kernel.rst b/cookbook/configuration/front_controllers_and_kernel.rst index c49788f9056..8c4264a2161 100644 --- a/cookbook/configuration/front_controllers_and_kernel.rst +++ b/cookbook/configuration/front_controllers_and_kernel.rst @@ -45,8 +45,8 @@ to `decorate`_ the kernel with additional features. Examples include: * Configuring the autoloader or adding additional autoloading mechanisms; * Adding HTTP level caching by wrapping the kernel with an instance of :ref:`AppCache `; -* Enabling (or skipping) the :doc:`ClassCache ` -* Enabling the :doc:`Debug component `. +* Enabling (or skipping) the :doc:`ClassCache `; +* Enabling the :doc:`Debug Component `. The front controller can be chosen by requesting URLs like: From 8d4f444c25ba45439bef046bda1b1abb89c84ed0 Mon Sep 17 00:00:00 2001 From: Philipp Rieber Date: Thu, 20 Feb 2014 08:28:41 +0100 Subject: [PATCH 5/8] Fixes of all kind --- book/controller.rst | 4 ++-- book/forms.rst | 12 ++++++------ book/security.rst | 8 ++++---- book/service_container.rst | 8 +++----- book/templating.rst | 8 ++++---- book/translation.rst | 9 +++++---- book/validation.rst | 4 ++-- components/console/helpers/dialoghelper.rst | 2 +- components/console/helpers/tablehelper.rst | 2 +- components/console/introduction.rst | 12 ++++++------ components/dependency_injection/advanced.rst | 14 +++++++++++++- components/dependency_injection/definitions.rst | 2 +- components/dependency_injection/introduction.rst | 4 ++-- components/dependency_injection/parentservices.rst | 2 +- components/dependency_injection/tags.rst | 12 ++++++++++++ components/http_foundation/introduction.rst | 4 ++-- components/property_access/introduction.rst | 2 +- components/routing/introduction.rst | 10 +++++----- components/translation/usage.rst | 2 +- cookbook/bundles/inheritance.rst | 2 +- cookbook/bundles/override.rst | 2 +- cookbook/bundles/prepend_extension.rst | 4 ++-- cookbook/security/entity_provider.rst | 2 +- reference/constraints/Image.rst | 2 +- reference/constraints/Valid.rst | 6 ++++-- reference/forms/types/collection.rst | 4 ++-- reference/forms/types/date.rst | 2 +- reference/forms/types/entity.rst | 2 +- .../forms/types/options/checkbox_compound.rst.inc | 2 +- reference/forms/types/options/date_widget.rst.inc | 4 ++-- reference/forms/types/options/empty_data.rst.inc | 2 +- reference/forms/types/options/label.rst.inc | 13 +++++++++++-- reference/forms/types/options/label_attr.rst.inc | 2 +- reference/forms/types/textarea.rst | 2 +- 34 files changed, 103 insertions(+), 69 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index 7692b7e59ae..de17696b4a9 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -470,7 +470,7 @@ object that's returned from that controller:: return $response; } -Notice that the `forward()` method uses the same string representation of +Notice that the ``forward()`` method uses the same string representation of the controller used in the routing configuration. In this case, the target controller class will be ``HelloController`` inside some ``AcmeHelloBundle``. The array passed to the method becomes the arguments on the resulting controller. @@ -786,7 +786,7 @@ The Request Object Besides the values of the routing placeholders, the controller also has access to the ``Request`` object. The framework injects the ``Request`` object in the controller if a variable is type-hinted with -`Symfony\Component\HttpFoundation\Request`:: +:class:`Symfony\\Component\\HttpFoundation\\Request`:: use Symfony\Component\HttpFoundation\Request; diff --git a/book/forms.rst b/book/forms.rst index 08acb2a8e4d..e1c898a0b41 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -495,7 +495,7 @@ 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 ` +:ref:`POST_SUBMIT event `. .. index:: single: Forms; Validation groups based on submitted data @@ -1811,7 +1811,7 @@ an array. $this->get('request')->request->get('name'); - Be advised, however, that in most cases using the getData() method is + Be advised, however, that in most cases using the ``getData()`` method is a better choice, since it returns the data (usually an object) after it's been transformed by the form framework. @@ -1858,7 +1858,7 @@ but here's a short example: .. tip:: - If you are using Validation Groups, you need to either reference the + If you are using validation groups, you need to either reference the ``Default`` group when creating the form, or set the correct group on the constraint you are adding. @@ -1896,7 +1896,7 @@ Learn more from the Cookbook .. _`Symfony2 Form component`: https://github.com/symfony/Form .. _`DateTime`: http://php.net/manual/en/class.datetime.php -.. _`Twig Bridge`: https://github.com/symfony/symfony/tree/2.2/src/Symfony/Bridge/Twig -.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/2.2/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +.. _`Twig Bridge`: https://github.com/symfony/symfony/tree/2.3/src/Symfony/Bridge/Twig +.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/2.3/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig .. _`Cross-site request forgery`: http://en.wikipedia.org/wiki/Cross-site_request_forgery -.. _`view on GitHub`: https://github.com/symfony/symfony/tree/2.2/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form +.. _`view on GitHub`: https://github.com/symfony/symfony/tree/2.3/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form diff --git a/book/security.rst b/book/security.rst index 30492147938..1912cce1d23 100644 --- a/book/security.rst +++ b/book/security.rst @@ -34,7 +34,7 @@ Basic Example: HTTP Authentication The Security component can be configured via your application configuration. In fact, most standard security setups are just a matter of using the right configuration. The following configuration tells Symfony to secure any URL -matching ``/admin/*`` and to ask the user for credentials using basic HTTP +matching ``/admin*`` and to ask the user for credentials using basic HTTP authentication (i.e. the old-school username/password box): .. configuration-block:: @@ -143,9 +143,9 @@ that looks like the following: * There are two users in the system (``ryan`` and ``admin``); * Users authenticate themselves via the basic HTTP authentication prompt; -* Any URL matching ``/admin/*`` is secured, and only the ``admin`` user +* Any URL matching ``/admin*`` is secured, and only the ``admin`` user can access it; -* All URLs *not* matching ``/admin/*`` are accessible by all users (and the +* All URLs *not* matching ``/admin*`` are accessible by all users (and the user is never prompted to log in). Read this short summary about how security works and how each part of the @@ -193,7 +193,7 @@ Access Controls (Authorization) If a user requests ``/admin/foo``, however, the process behaves differently. This is because of the ``access_control`` configuration section that says that any URL matching the regular expression pattern ``^/admin`` (i.e. ``/admin`` -or anything matching ``/admin/*``) requires the ``ROLE_ADMIN`` role. Roles +or anything matching ``/admin*``) requires the ``ROLE_ADMIN`` role. Roles are the basis for most authorization: a user can access ``/admin/foo`` only if it has the ``ROLE_ADMIN`` role. diff --git a/book/service_container.rst b/book/service_container.rst index 14a9bff96e6..a036a6cae41 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -980,12 +980,10 @@ with ``twig.extension`` and automatically registers them as extensions. Tags, then, are a way to tell Symfony2 or other third-party bundles that your service should be registered or used in some special way by the bundle. -The following is a list of tags available with the core Symfony2 bundles. -Each of these has a different effect on your service and many tags require -additional arguments (beyond just the ``name`` parameter). - For a list of all the tags available in the core Symfony Framework, check -out :doc:`/reference/dic_tags`. +out :doc:`/reference/dic_tags`. Each of these has a different effect on your +service and many tags require additional arguments (beyond just the ``name`` +parameter). Debugging Services ------------------ diff --git a/book/templating.rst b/book/templating.rst index e9a5aa53072..58ac2bc114e 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -1039,14 +1039,14 @@ stylesheets and JavaScripts that you'll need throughout your site: {# ... #} {% block stylesheets %} - + {% endblock %} {# ... #} {% block javascripts %} - + {% endblock %} @@ -1064,7 +1064,7 @@ page. From inside that contact page's template, do the following: {% block stylesheets %} {{ parent() }} - + {% endblock %} {# ... #} @@ -1329,7 +1329,7 @@ covered: {% endfor %} {% endblock %} -Notice that this template extends the section template -(``AcmeBlogBundle::layout.html.twig``) +Notice that this template extends the section template (``AcmeBlogBundle::layout.html.twig``) which in-turn extends the base application layout (``::base.html.twig``). This is the common three-level inheritance model. diff --git a/book/translation.rst b/book/translation.rst index 73d1dcfd156..8fb80da7954 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -554,8 +554,8 @@ use somewhere in your application:: } Add constraints though any of the supported methods. Set the message option to the -translation source text. For example, to guarantee that the $name property is not -empty, add the following: +translation source text. For example, to guarantee that the ``$name`` property is +not empty, add the following: .. configuration-block:: @@ -654,8 +654,8 @@ Translating Database Content ---------------------------- The translation of database content should be handled by Doctrine through -the `Translatable Extension`_. For more information, see the documentation -for that library. +the `Translatable Extension`_ or the `Translatable Bahavior`_ (PHP 5.4+). +For more information, see the documentation for thes libraries. Summary ------- @@ -680,3 +680,4 @@ steps: .. _`ISO 3166-1 alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes .. _`ISO 639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes .. _`Translatable Extension`: https://github.com/l3pp4rd/DoctrineExtensions +.. _`Translatable Bahavior`: https://github.com/KnpLabs/DoctrineBehaviors diff --git a/book/validation.rst b/book/validation.rst index f7f7e8205df..aa97b1f2f1f 100644 --- a/book/validation.rst +++ b/book/validation.rst @@ -985,9 +985,9 @@ entity and a new constraint group called ``Premium``: Acme\DemoBundle\Entity\User: properties: name: - - NotBlank + - NotBlank: ~ creditCard: - - CardScheme + - CardScheme: schemes: [VISA] groups: [Premium] diff --git a/components/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index fd0b4356e38..5af4b6a5d22 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -277,7 +277,7 @@ from the command line, you need to overwrite the HelperSet used by the command:: return $stream; } -By setting the inputStream of the ``DialogHelper``, you imitate what the +By setting the input stream of the ``DialogHelper``, you imitate what the console would do internally with all user input through the cli. This way you can test any user interaction (even complex ones) by passing an appropriate input stream. diff --git a/components/console/helpers/tablehelper.rst b/components/console/helpers/tablehelper.rst index 1145dd7b603..fdb0d5c22e2 100644 --- a/components/console/helpers/tablehelper.rst +++ b/components/console/helpers/tablehelper.rst @@ -11,7 +11,7 @@ When building a console application it may be useful to display tabular data: .. image:: /images/components/console/table.png -To display table, use the :class:`Symfony\\Component\\Console\\Helper\\TableHelper`, +To display a table, use the :class:`Symfony\\Component\\Console\\Helper\\TableHelper`, set headers, rows and render:: $table = $app->getHelperSet()->get('table'); diff --git a/components/console/introduction.rst b/components/console/introduction.rst index bb2eb39de96..249121258a9 100644 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -197,8 +197,8 @@ level. For example:: } When the quiet level is used, all output is suppressed as the default -:method:`Symfony\Component\Console\Output::write ` -method returns without actually printing. +:method:`Symfony\\Component\\Console\\Output\\Output::write` method returns +without actually printing. Using Command Arguments ----------------------- @@ -286,13 +286,13 @@ Unlike arguments, options are not ordered (meaning you can specify them in any order) and are specified with two dashes (e.g. ``--yell`` - you can also declare a one-letter shortcut that you can call with a single dash like ``-y``). Options are *always* optional, and can be setup to accept a value -(e.g. ``dir=src``) or simply as a boolean flag without a value (e.g. -``yell``). +(e.g. ``--dir=src``) or simply as a boolean flag without a value (e.g. +``--yell``). .. tip:: It is also possible to make an option *optionally* accept a value (so that - ``--yell`` or ``yell=loud`` work). Options can also be configured to + ``--yell`` or ``--yell=loud`` work). Options can also be configured to accept an array of values. For example, add a new option to the command that can be used to specify @@ -344,7 +344,7 @@ Option Value InputOption::VALUE_IS_ARRAY This option accepts multiple values (e.g. ``--dir=/foo --dir=/bar``) InputOption::VALUE_NONE Do not accept input for this option (e.g. ``--yell``) InputOption::VALUE_REQUIRED This value is required (e.g. ``--iterations=5``), the option itself is still optional -InputOption::VALUE_OPTIONAL This option may or may not have a value (e.g. ``yell`` or ``yell=loud``) +InputOption::VALUE_OPTIONAL This option may or may not have a value (e.g. ``--yell`` or ``--yell=loud``) =========================== ===================================================================================== You can combine ``VALUE_IS_ARRAY`` with ``VALUE_REQUIRED`` or ``VALUE_OPTIONAL`` like this: diff --git a/components/dependency_injection/advanced.rst b/components/dependency_injection/advanced.rst index 16848ff7514..a234a868924 100644 --- a/components/dependency_injection/advanced.rst +++ b/components/dependency_injection/advanced.rst @@ -142,6 +142,18 @@ service by asking for the ``bar`` service like this:: $container->get('bar'); // Would return the foo service +.. note:: + + In YAML, you can also use a shortcut to alias a service: + + .. code-block:: yaml + + services: + foo: + class: Example\Foo + bar: "@foo" + + Requiring files --------------- @@ -169,5 +181,5 @@ the service itself gets loaded. To do so, you can use the ``file`` directive. $definition->setFile('%kernel.root_dir%/src/path/to/file/foo.php'); $container->setDefinition('foo', $definition); -Notice that Symfony will internally call the PHP function require_once +Notice that Symfony will internally call the PHP statement ``require_once`` which means that your file will be included only once per request. diff --git a/components/dependency_injection/definitions.rst b/components/dependency_injection/definitions.rst index 13710504ed5..f1c7278cedd 100644 --- a/components/dependency_injection/definitions.rst +++ b/components/dependency_injection/definitions.rst @@ -104,7 +104,7 @@ Add a method call with:: $definition->addMethodCall($method, $arguments); -Where ``$method`` is the method name and $arguments is an array of the arguments +Where ``$method`` is the method name and ``$arguments`` is an array of the arguments to call the method with. The arguments can be strings, arrays, parameters or service ids as with the constructor arguments. diff --git a/components/dependency_injection/introduction.rst b/components/dependency_injection/introduction.rst index a2e4d51c85f..a07d0aef948 100644 --- a/components/dependency_injection/introduction.rst +++ b/components/dependency_injection/introduction.rst @@ -9,7 +9,7 @@ The DependencyInjection Component the way objects are constructed in your application. For an introduction to Dependency Injection and service containers see -:doc:`/book/service_container` +:doc:`/book/service_container`. Installation ------------ @@ -181,7 +181,7 @@ Setting Up the Container with Configuration Files As well as setting up the services using PHP as above you can also use configuration files. This allows you to use XML or YAML to write the definitions for the services rather than using PHP to define the services as in the above -examples. In anything but the smallest applications it make sense to organize +examples. In anything but the smallest applications it makes sense to organize the service definitions by moving them into one or more configuration files. To do this you also need to install :doc:`the Config component `. diff --git a/components/dependency_injection/parentservices.rst b/components/dependency_injection/parentservices.rst index 00545e52b99..e5a44e2a30e 100644 --- a/components/dependency_injection/parentservices.rst +++ b/components/dependency_injection/parentservices.rst @@ -68,7 +68,7 @@ The service config for these classes would look something like this: - [setEmailFormatter, ["@my_email_formatter"]] greeting_card_manager: - class: "%greeting_card_manager.class%" + class: "%greeting_card_manager.class%" calls: - [setMailer, ["@my_mailer"]] - [setEmailFormatter, ["@my_email_formatter"]] diff --git a/components/dependency_injection/tags.rst b/components/dependency_injection/tags.rst index 2e96926b365..b96cce13287 100644 --- a/components/dependency_injection/tags.rst +++ b/components/dependency_injection/tags.rst @@ -235,6 +235,18 @@ To answer this, change the service declaration: + .. code-block:: php + + use Symfony\Component\DependencyInjection\Definition; + + $definitionSmtp = new Definition('\Swift_SmtpTransport', array('%mailer_host%')); + $definitionSmtp->addTag('acme_mailer.transport', array('alias' => 'foo')); + $container->setDefinition('acme_mailer.transport.smtp', $definitionSmtp); + + $definitionSendmail = new Definition('\Swift_SendmailTransport'); + $definitionSendmail->addTag('acme_mailer.transport', array('alias' => 'bar')); + $container->setDefinition('acme_mailer.transport.sendmail', $definitionSendmail); + Notice that you've added a generic ``alias`` key to the tag. To actually use this, update the compiler:: diff --git a/components/http_foundation/introduction.rst b/components/http_foundation/introduction.rst index a93ce40eb58..70ad63559f2 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -258,7 +258,7 @@ If you need to get full access to parsed data from ``Accept``, ``Accept-Language $quality = $item->getQuality(); } - // accepts items are sorted by descending quality + // Accept header items are sorted by descending quality $accepts = AcceptHeader::fromString($request->headers->get('Accept')) ->all(); @@ -378,7 +378,7 @@ method:: $response->send(); } -If the Response is not modified, it sets the status code to 304 and remove the +If the Response is not modified, it sets the status code to 304 and removes the actual response content. Redirecting the User diff --git a/components/property_access/introduction.rst b/components/property_access/introduction.rst index 1498c925016..37a56d4dfd5 100644 --- a/components/property_access/introduction.rst +++ b/components/property_access/introduction.rst @@ -322,7 +322,7 @@ You can also mix objects and arrays:: public function setChildren($children) { - return $this->children; + $this->children = $children; } public function getChildren() diff --git a/components/routing/introduction.rst b/components/routing/introduction.rst index 62e9840b451..00b6d04f373 100644 --- a/components/routing/introduction.rst +++ b/components/routing/introduction.rst @@ -73,17 +73,17 @@ Defining routes A full route definition can contain up to seven parts: 1. The URL path route. This is matched against the URL passed to the `RequestContext`, -and can contain named wildcard placeholders (e.g. ``{placeholders}``) -to match dynamic parts in the URL. + and can contain named wildcard placeholders (e.g. ``{placeholders}``) + to match dynamic parts in the URL. 2. An array of default values. This contains an array of arbitrary values -that will be returned when the request matches the route. + that will be returned when the request matches the route. 3. An array of requirements. These define constraints for the values of the -placeholders as regular expressions. + placeholders as regular expressions. 4. An array of options. These contain internal settings for the route and -are the least commonly needed. + are the least commonly needed. 5. A host. This is matched against the host of the request. See :doc:`/components/routing/hostname_pattern` for more details. diff --git a/components/translation/usage.rst b/components/translation/usage.rst index 5c1d84a365b..fbb6664c607 100644 --- a/components/translation/usage.rst +++ b/components/translation/usage.rst @@ -95,7 +95,7 @@ The second step is done by creating message catalogs that define the translation for any number of different locales. Creating Translations -===================== +--------------------- The act of creating translation files is an important part of "localization" (often abbreviated `L10n`_). Translation files consist of a series of diff --git a/cookbook/bundles/inheritance.rst b/cookbook/bundles/inheritance.rst index a6825921170..3d6832b41c1 100644 --- a/cookbook/bundles/inheritance.rst +++ b/cookbook/bundles/inheritance.rst @@ -12,7 +12,7 @@ things like controllers, templates, and other files in a bundle's For example, suppose that you're installing the `FOSUserBundle`_, but you want to override its base ``layout.html.twig`` template, as well as one of -its controllers. Suppose also that you have your own ``AcmeUserBundle`` +its controllers. Suppose also that you have your own AcmeUserBundle where you want the overridden files to live. Start by registering the FOSUserBundle as the "parent" of your bundle:: diff --git a/cookbook/bundles/override.rst b/cookbook/bundles/override.rst index 22188f7e597..4e51034cdb4 100644 --- a/cookbook/bundles/override.rst +++ b/cookbook/bundles/override.rst @@ -181,7 +181,7 @@ can override the translations from any translation file, as long as it is in .. caution:: - The last translation file always wins. That mean that you need to make + The last translation file always wins. That means that you need to make sure that the bundle containing *your* translations is loaded after any bundle whose translations you're overriding. This is done in ``AppKernel``. diff --git a/cookbook/bundles/prepend_extension.rst b/cookbook/bundles/prepend_extension.rst index 5ae75f23f6b..4fb830250fd 100644 --- a/cookbook/bundles/prepend_extension.rst +++ b/cookbook/bundles/prepend_extension.rst @@ -79,10 +79,10 @@ in case a specific other Bundle is not registered:: // process the configuration of AcmeHelloExtension $configs = $container->getExtensionConfig($this->getAlias()); - // use the Configuration class to generate a config array with the settings ``acme_hello`` + // use the Configuration class to generate a config array with the settings "acme_hello" $config = $this->processConfiguration(new Configuration(), $configs); - // check if entity_manager_name is set in the ``acme_hello`` configuration + // check if entity_manager_name is set in the "acme_hello" configuration if (isset($config['entity_manager_name'])) { // prepend the acme_something settings with the entity_manager_name $config = array('entity_manager_name' => $config['entity_manager_name']); diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index 8ba616eb481..76cb782129c 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -226,7 +226,7 @@ user records and encode their password, see :ref:`book-security-encoding-user-pa .. code-block:: bash - $ mysql> select * from acme_users; + $ mysql> SELECT * FROM acme_users; +----+----------+------------------------------------------+--------------------+-----------+ | id | username | password | email | is_active | +----+----------+------------------------------------------+--------------------+-----------+ diff --git a/reference/constraints/Image.rst b/reference/constraints/Image.rst index 1a9caf906c0..363aca62537 100644 --- a/reference/constraints/Image.rst +++ b/reference/constraints/Image.rst @@ -155,7 +155,7 @@ mimeTypes **type**: ``array`` or ``string`` **default**: ``image/*`` -You can find a list of existing image mime types on the `IANA website`_ +You can find a list of existing image mime types on the `IANA website`_. mimeTypesMessage ~~~~~~~~~~~~~~~~ diff --git a/reference/constraints/Valid.rst b/reference/constraints/Valid.rst index 79c1b992ef9..64bc6274629 100644 --- a/reference/constraints/Valid.rst +++ b/reference/constraints/Valid.rst @@ -249,8 +249,10 @@ property. If you validate an author with an invalid address now, you can see that the validation of the ``Address`` fields failed. - Acme\HelloBundle\Author.address.zipCode: - This value is too long. It should have 5 characters or less +.. code-block:: text + + Acme\\HelloBundle\\Author.address.zipCode: + This value is too long. It should have 5 characters or less. Options ------- diff --git a/reference/forms/types/collection.rst b/reference/forms/types/collection.rst index 9f442d2fda8..dfe53129202 100644 --- a/reference/forms/types/collection.rst +++ b/reference/forms/types/collection.rst @@ -160,7 +160,7 @@ you need is the JavaScript: {# ... #} {# store the prototype on the data-prototype attribute #} -
    +
      {% for emailField in form.emails %}
    • {{ form_errors(emailField) }} @@ -176,7 +176,7 @@ you need is the JavaScript: