diff --git a/book/controller.rst b/book/controller.rst index f693eb12028..1831dc75218 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -475,7 +475,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. @@ -794,7 +794,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 5b67730069e..b107a180460 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. @@ -1853,7 +1853,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. diff --git a/book/security.rst b/book/security.rst index 758bd7b3878..a2fea0592b9 100644 --- a/book/security.rst +++ b/book/security.rst @@ -51,7 +51,9 @@ authentication (i.e. the old-school username/password box): realm: "Secured Demo Area" access_control: - - { path: ^/admin, roles: ROLE_ADMIN } + - { path: ^/admin/, roles: ROLE_ADMIN } + # Include the following line to also secure the /admin path itself + # - { path: ^/admin$, roles: ROLE_ADMIN } providers: in_memory: @@ -79,7 +81,9 @@ authentication (i.e. the old-school username/password box): - + + + @@ -108,7 +112,9 @@ authentication (i.e. the old-school username/password box): ), ), 'access_control' => array( - array('path' => '^/admin', 'role' => 'ROLE_ADMIN'), + array('path' => '^/admin/', 'role' => 'ROLE_ADMIN'), + // Include the following line to also secure the /admin path itself + // array('path' => '^/admin$', 'role' => 'ROLE_ADMIN'), ), 'providers' => array( 'in_memory' => array( diff --git a/book/service_container.rst b/book/service_container.rst index 414c819cd8b..39fd36a68fe 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -1146,12 +1146,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 cfa9c1088c1..6e1090f7d71 100644 --- a/book/templating.rst +++ b/book/templating.rst @@ -1024,14 +1024,14 @@ stylesheets and JavaScripts that you'll need throughout your site: {# ... #} {% block stylesheets %} - + {% endblock %} {# ... #} {% block javascripts %} - + {% endblock %} @@ -1049,7 +1049,7 @@ page. From inside that contact page's template, do the following: {% block stylesheets %} {{ parent() }} - + {% endblock %} {# ... #} @@ -1314,7 +1314,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 c27ac70c933..17225c2c802 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -546,8 +546,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:: @@ -646,8 +646,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 ------- @@ -672,3 +672,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/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/console/helpers/dialoghelper.rst b/components/console/helpers/dialoghelper.rst index e4eec6b3a45..689ff2556c0 100644 --- a/components/console/helpers/dialoghelper.rst +++ b/components/console/helpers/dialoghelper.rst @@ -264,7 +264,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 4bc3323ebe6..305448845ba 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 7da8fb6655a..3801b5d7ebb 100644 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -225,8 +225,8 @@ verbosity levels:: } 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. .. tip:: @@ -321,13 +321,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 @@ -379,7 +379,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/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/dependency_injection/advanced.rst b/components/dependency_injection/advanced.rst index 16848ff7514..7c139a7b734 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 +.. tip:: + + 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 d3455a47440..40f453b73eb 100644 --- a/components/http_foundation/introduction.rst +++ b/components/http_foundation/introduction.rst @@ -261,7 +261,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(); @@ -420,7 +420,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/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 7a5c74eeff6..5f86be97d96 100644 --- a/components/map.rst.inc +++ b/components/map.rst.inc @@ -28,9 +28,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/components/property_access/introduction.rst b/components/property_access/introduction.rst index 11c0f5efe68..2d5f4716476 100644 --- a/components/property_access/introduction.rst +++ b/components/property_access/introduction.rst @@ -318,7 +318,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 f2cfc4c4125..8e4fb63d066 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/contributing/code/bc.rst b/contributing/code/bc.rst index e124f8b8ba6..e518f94b21b 100644 --- a/contributing/code/bc.rst +++ b/contributing/code/bc.rst @@ -238,7 +238,7 @@ Symfony's classes: Type of Change Regular API ================================================== ============== ============== Remove entirely No No -Make final Yes [2]_ No +Make final No No Make abstract No No Change name or namespace No No Change parent class Yes [7]_ Yes [7]_ 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/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: diff --git a/cookbook/email/cloud.rst b/cookbook/email/cloud.rst new file mode 100644 index 00000000000..3f62afc746b --- /dev/null +++ b/cookbook/email/cloud.rst @@ -0,0 +1,118 @@ +.. index:: + single: Emails; Using the 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. + +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 +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 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 + 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 ``Return-Path`` (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 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 80e24412acb..aba19a74a1e 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,35 @@ 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 diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index 43ae27bb8cf..6c23641e2e3 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` 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/cookbook/security/voters_data_permission.rst b/cookbook/security/voters_data_permission.rst index 1873d4100bb..0e5055261e1 100644 --- a/cookbook/security/voters_data_permission.rst +++ b/cookbook/security/voters_data_permission.rst @@ -54,7 +54,7 @@ Creating the Custom Voter ------------------------- The goal is to create a voter that checks if a user has access to view or -edit a particular object. Here's an example implementation: +edit a particular object. Here's an example implementation:: // src/Acme/DemoBundle/Security/Authorization/Voter/PostVoter.php namespace Acme\DemoBundle\Security\Authorization\Voter; diff --git a/reference/constraints/Image.rst b/reference/constraints/Image.rst index ee970da891a..ca7b43b1bdd 100644 --- a/reference/constraints/Image.rst +++ b/reference/constraints/Image.rst @@ -242,7 +242,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 f918c6cbf80..6c6207cd123 100644 --- a/reference/forms/types/collection.rst +++ b/reference/forms/types/collection.rst @@ -161,7 +161,7 @@ you need is the JavaScript: {# ... #} {# store the prototype on the data-prototype attribute #} -
    +
      {% for emailField in form.emails %}
    • {{ form_errors(emailField) }} @@ -177,7 +177,7 @@ you need is the JavaScript: