diff --git a/book/doctrine.rst b/book/doctrine.rst index 0f3f62086d0..ca51d143e18 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -77,8 +77,10 @@ information. By convention, this information is usually configured in an + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/doctrine + http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd"> + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/doctrine + http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd"> getDoctrine()->getManager(); $products = $em->getRepository('AppBundle:Product') - ->findAllOrderedByName(); + ->findAllOrderedByName(); .. note:: @@ -884,7 +889,9 @@ you can let Doctrine create the class for you. .. code-block:: bash - $ php app/console doctrine:generate:entity --entity="AppBundle:Category" --fields="name:string(255)" + $ php app/console doctrine:generate:entity \ + --entity="AppBundle:Category" \ + --fields="name:string(255)" This task generates the ``Category`` entity for you, with an ``id`` field, a ``name`` field and the associated getter and setter functions. @@ -929,7 +936,8 @@ To relate the ``Category`` and ``Product`` entities, start by creating a products: targetEntity: Product mappedBy: category - # don't forget to init the collection in the __construct() method of the entity + # don't forget to init the collection in the __construct() method + # of the entity .. code-block:: xml @@ -1038,7 +1046,7 @@ methods for you: .. code-block:: bash - $ php app/console doctrine:generate:entities Acme + $ php app/console doctrine:generate:entities AppBundle Ignore the Doctrine metadata for a moment. You now have two classes - ``Category`` and ``Product`` with a natural one-to-many relationship. The ``Category`` @@ -1151,7 +1159,7 @@ the category (i.e. it's "lazily loaded"). You can also query in the other direction:: - public function showProductAction($id) + public function showProductsAction($id) { $category = $this->getDoctrine() ->getRepository('AppBundle:Category') @@ -1372,7 +1380,7 @@ list of all available types and more information, see Doctrine's Summary ------- -With Doctrine, you can focus on your objects and how they're useful in your +With Doctrine, you can focus on your objects and how they're used in your application and worry about database persistence second. This is because Doctrine allows you to use any PHP object to hold your data and relies on mapping metadata information to map an object's data to a particular database diff --git a/book/http_cache.rst b/book/http_cache.rst index 658288f1958..eae091e92ab 100644 --- a/book/http_cache.rst +++ b/book/http_cache.rst @@ -856,7 +856,7 @@ If one content corresponds to one URL, the ``PURGE`` model works well. You send a request to the cache proxy with the HTTP method ``PURGE`` (using the word "PURGE" is a convention, technically this can be any string) instead of ``GET`` and make the cache proxy detect this and remove the data from the -cache instead of going to Symfony to get a response. +cache instead of going to the application to get a response. Here is how you can configure the Symfony reverse proxy to support the ``PURGE`` HTTP method:: @@ -877,7 +877,10 @@ Here is how you can configure the Symfony reverse proxy to support the } if ('127.0.0.1' !== $request->getClientIp()) { - return new Response('Invalid HTTP method', Response::HTTP_BAD_REQUEST); + return new Response( + 'Invalid HTTP method', + Response::HTTP_BAD_REQUEST + ); } $response = new Response(); @@ -987,8 +990,10 @@ First, to use ESI, be sure to enable it in your application configuration: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/symfony + http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> @@ -1115,8 +1120,10 @@ that must be enabled in your configuration: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/symfony + http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> diff --git a/book/security.rst b/book/security.rst index c159d2429af..7336316abaf 100644 --- a/book/security.rst +++ b/book/security.rst @@ -56,14 +56,17 @@ configuration looks like this: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd"> - + @@ -145,7 +148,8 @@ To activate this, add the ``http_basic`` key under your firewall: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd"> @@ -216,7 +220,8 @@ user to be logged in to access this URL: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd"> @@ -309,7 +314,8 @@ provider, but it's better to think of it as an "in configuration" provider: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd"> @@ -376,7 +382,8 @@ To fix this, add an ``encoders`` key: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd"> @@ -456,13 +463,16 @@ else, you'll want to encode their passwords. The best algorithm to use is + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd"> + algorithm="bcrypt" + cost="12" /> + @@ -514,7 +524,8 @@ like this: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd"> @@ -681,7 +692,8 @@ URL pattern. You saw this earlier, where anything matching the regular expressio + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd"> diff --git a/book/testing.rst b/book/testing.rst index d51699e552b..19d6443d83d 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -558,7 +558,8 @@ narrow down your node selection by chaining the method calls:: return false; } }) - ->first(); + ->first() + ; .. tip:: @@ -720,8 +721,10 @@ configuration option: + 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"> @@ -784,8 +787,9 @@ machine only. the ``app/phpunit.xml`` file. By default, only the tests from your own custom bundles stored in the standard -directories ``src/*/*Bundle/Tests`` or ``src/*/Bundle/*Bundle/Tests`` are run -by the ``phpunit`` command, as configured in the ``app/phpunit.xml.dist`` file: +directories ``src/*/*Bundle/Tests``, ``src/*/Bundle/*Bundle/Tests``, +``src/*Bundle/Tests`` are run by the ``phpunit`` command, as configured +in the ``app/phpunit.xml.dist`` file: .. code-block:: xml @@ -796,6 +800,7 @@ by the ``phpunit`` command, as configured in the ``app/phpunit.xml.dist`` file: ../src/*/*Bundle/Tests ../src/*/Bundle/*Bundle/Tests + ../src/*Bundle/Tests diff --git a/book/translation.rst b/book/translation.rst index d6094a3a5d7..39fe75031de 100644 --- a/book/translation.rst +++ b/book/translation.rst @@ -68,8 +68,10 @@ enable the ``translator`` in your configuration: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/symfony + http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> @@ -366,7 +368,8 @@ provides many loaders, including: * ``yml``: YAML file. The choice of which loader to use is entirely up to you and is a matter of -taste. For more options, see :ref:`component-translator-message-catalogs`. +taste. The recommended option is to use ``xliff`` for translations. +For more options, see :ref:`component-translator-message-catalogs`. .. note:: @@ -454,7 +457,7 @@ by the routing system using the special ``_locale`` parameter: # app/config/routing.yml contact: path: /{_locale}/contact - defaults: { _controller: AcmeDemoBundle:Contact:index } + defaults: { _controller: AppBundle:Contact:index } requirements: _locale: en|fr|de @@ -468,7 +471,7 @@ by the routing system using the special ``_locale`` parameter: http://symfony.com/schema/routing/routing-1.0.xsd"> - AcmeDemoBundle:Contact:index + AppBundle:Contact:index en|fr|de @@ -483,7 +486,7 @@ by the routing system using the special ``_locale`` parameter: $collection->add('contact', new Route( '/{_locale}/contact', array( - '_controller' => 'AcmeDemoBundle:Contact:index', + '_controller' => 'AppBundle:Contact:index', ), array( '_locale' => 'en|fr|de', @@ -524,8 +527,10 @@ the framework: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/symfony + http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> @@ -554,8 +559,8 @@ the error messages is easy: simply create a translation resource for the To start, suppose you've created a plain-old-PHP object that you need to use somewhere in your application:: - // src/Acme/BlogBundle/Entity/Author.php - namespace Acme\BlogBundle\Entity; + // src/AppBundle/Entity/Author.php + namespace AppBundle\Entity; class Author { @@ -568,17 +573,9 @@ not empty, add the following: .. configuration-block:: - .. code-block:: yaml - - # src/Acme/BlogBundle/Resources/config/validation.yml - Acme\BlogBundle\Entity\Author: - properties: - name: - - NotBlank: { message: "author.name.not_blank" } - .. code-block:: php-annotations - // src/Acme/BlogBundle/Entity/Author.php + // src/AppBundle/Entity/Author.php use Symfony\Component\Validator\Constraints as Assert; class Author @@ -589,15 +586,24 @@ not empty, add the following: public $name; } + .. code-block:: yaml + + # src/AppBundle/Resources/config/validation.yml + AppBundle\Entity\Author: + properties: + name: + - NotBlank: { message: "author.name.not_blank" } + .. code-block:: xml - + + xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping + http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"> - + @@ -608,7 +614,7 @@ not empty, add the following: .. code-block:: php - // src/Acme/BlogBundle/Entity/Author.php + // src/AppBundle/Entity/Author.php // ... use Symfony\Component\Validator\Mapping\ClassMetadata; diff --git a/cookbook/assetic/apply_to_option.rst b/cookbook/assetic/apply_to_option.rst index 4c080691f03..eedc6e8e7af 100644 --- a/cookbook/assetic/apply_to_option.rst +++ b/cookbook/assetic/apply_to_option.rst @@ -60,7 +60,7 @@ templates: .. code-block:: html+jinja {% javascripts '@AppBundle/Resources/public/js/example.coffee' filter='coffee' %} - + {% endjavascripts %} .. code-block:: html+php @@ -69,7 +69,7 @@ templates: array('@AppBundle/Resources/public/js/example.coffee'), array('coffee') ) as $url): ?> - + This is all that's needed to compile this CoffeeScript file and serve it @@ -87,7 +87,7 @@ You can also combine multiple CoffeeScript files into a single output file: {% javascripts '@AppBundle/Resources/public/js/example.coffee' '@AppBundle/Resources/public/js/another.coffee' filter='coffee' %} - + {% endjavascripts %} .. code-block:: html+php @@ -99,7 +99,7 @@ You can also combine multiple CoffeeScript files into a single output file: ), array('coffee') ) as $url): ?> - + Both the files will now be served up as a single file compiled into regular @@ -118,7 +118,7 @@ adding the JavaScript files to the files to be combined as above will not work as the regular JavaScript files will not survive the CoffeeScript compilation. This problem can be avoided by using the ``apply_to`` option in the config, -which allows you to specify that a filter should always be applied to particular +which allows you to specify which filter should always be applied to particular file extensions. In this case you can specify that the ``coffee`` filter is applied to all ``.coffee`` files: @@ -173,7 +173,7 @@ being run through the CoffeeScript filter): {% javascripts '@AppBundle/Resources/public/js/example.coffee' '@AppBundle/Resources/public/js/another.coffee' '@AppBundle/Resources/public/js/regular.js' %} - + {% endjavascripts %} .. code-block:: html+php @@ -185,5 +185,5 @@ being run through the CoffeeScript filter): '@AppBundle/Resources/public/js/regular.js', ) ) as $url): ?> - + diff --git a/cookbook/assetic/asset_management.rst b/cookbook/assetic/asset_management.rst index 785e239b1a0..68d81c4553b 100644 --- a/cookbook/assetic/asset_management.rst +++ b/cookbook/assetic/asset_management.rst @@ -18,11 +18,11 @@ directly: .. code-block:: html+jinja - + .. code-block:: php - + But *with* Assetic, you can manipulate these assets however you want (or load them from anywhere) before serving them. This means you can: @@ -60,7 +60,7 @@ To include JavaScript files, use the ``javascripts`` tag in any template: .. code-block:: html+jinja {% javascripts '@AppBundle/Resources/public/js/*' %} - + {% endjavascripts %} .. code-block:: html+php @@ -68,7 +68,7 @@ To include JavaScript files, use the ``javascripts`` tag in any template: javascripts( array('@AppBundle/Resources/public/js/*') ) as $url): ?> - + .. note:: @@ -82,7 +82,7 @@ To include JavaScript files, use the ``javascripts`` tag in any template: {# ... #} {% block javascripts %} {% javascripts '@AppBundle/Resources/public/js/*' %} - + {% endjavascripts %} {% endblock %} {# ... #} @@ -548,7 +548,7 @@ command will automatically regenerate assets *as they change*: $ php app/console assetic:dump --watch Since running this command in the ``dev`` environment may generate a bunch -of files, it's usually a good idea to point your generated assets files to +of files, it's usually a good idea to point your generated asset files to some isolated directory (e.g. ``/js/compiled``), to keep things organized: .. configuration-block:: diff --git a/cookbook/bundles/configuration.rst b/cookbook/bundles/configuration.rst index 445521f9c58..fd1c9ea14a1 100644 --- a/cookbook/bundles/configuration.rst +++ b/cookbook/bundles/configuration.rst @@ -384,7 +384,8 @@ Assume the XSD file is called ``hello-1.0.xsd``, the schema location will be + xsi:schemaLocation="http://acme_company.com/schema/dic/hello + http://acme_company.com/schema/dic/hello/hello-1.0.xsd"> diff --git a/cookbook/bundles/inheritance.rst b/cookbook/bundles/inheritance.rst index 13500eb6685..25c29da67fc 100644 --- a/cookbook/bundles/inheritance.rst +++ b/cookbook/bundles/inheritance.rst @@ -91,7 +91,7 @@ The same goes for routing files and some other resources. .. note:: The overriding of resources only works when you refer to resources with - the ``@FosUserBundle/Resources/config/routing/security.xml`` method. + the ``@FOSUserBundle/Resources/config/routing/security.xml`` method. If you refer to resources without using the @BundleName shortcut, they can't be overridden in this way. diff --git a/cookbook/bundles/prepend_extension.rst b/cookbook/bundles/prepend_extension.rst index 4c5cb7364fc..deaf7551917 100644 --- a/cookbook/bundles/prepend_extension.rst +++ b/cookbook/bundles/prepend_extension.rst @@ -68,9 +68,10 @@ in case a specific other bundle is not registered:: switch ($name) { case 'acme_something': case 'acme_other': - // set use_acme_goodbye to false in the config of acme_something and acme_other - // note that if the user manually configured use_acme_goodbye to true in the - // app/config/config.yml then the setting would in the end be true and not false + // set use_acme_goodbye to false in the config of + // acme_something and acme_other note that if the user manually + // configured use_acme_goodbye to true in the app/config/config.yml + // then the setting would in the end be true and not false $container->prependExtensionConfig($name, $config); break; } @@ -79,7 +80,8 @@ 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 @@ -121,11 +123,11 @@ for ``acme_hello`` is set to ``non_default``: // app/config/config.php $container->loadFromExtension('acme_something', array( - ..., + // ... 'use_acme_goodbye' => false, 'entity_manager_name' => 'non_default', )); $container->loadFromExtension('acme_other', array( - ..., + // ... 'use_acme_goodbye' => false, )); diff --git a/cookbook/configuration/configuration_organization.rst b/cookbook/configuration/configuration_organization.rst index 63bcd9704f0..62311e7c515 100644 --- a/cookbook/configuration/configuration_organization.rst +++ b/cookbook/configuration/configuration_organization.rst @@ -127,8 +127,10 @@ needed for the ``app/config/dev/config.yml`` file: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/symfony + http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> @@ -237,8 +239,10 @@ format (``.yml``, ``.xml``, ``.php``, ``.ini``): + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/symfony + http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> @@ -299,8 +303,10 @@ any other configuration file: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/symfony + http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> @@ -340,8 +346,10 @@ doesn't exist: + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/symfony + http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> diff --git a/cookbook/configuration/environments.rst b/cookbook/configuration/environments.rst index b658b16f360..751f5971ca1 100644 --- a/cookbook/configuration/environments.rst +++ b/cookbook/configuration/environments.rst @@ -107,9 +107,7 @@ activated by modifying the default value in the ``dev`` configuration file: - + .. code-block:: php @@ -309,7 +307,7 @@ should also create a front controller for it. Copy the ``web/app.php`` file to ``web/app_benchmark.php`` and edit the environment to be ``benchmark``:: // web/app_benchmark.php - + // ... // change just this line $kernel = new AppKernel('benchmark', false); diff --git a/cookbook/controller/error_pages.rst b/cookbook/controller/error_pages.rst index 3217c602017..2e28b98a9d6 100644 --- a/cookbook/controller/error_pages.rst +++ b/cookbook/controller/error_pages.rst @@ -187,8 +187,10 @@ to point to it. + xsi:schemaLocation="http://symfony.com/schema/dic/services + http://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/twig + http://symfony.com/schema/dic/twig/twig-1.0.xsd"> AppBundle:Exception:showException diff --git a/cookbook/email/cloud.rst b/cookbook/email/cloud.rst index f225b220a69..9b3677094c3 100644 --- a/cookbook/email/cloud.rst +++ b/cookbook/email/cloud.rst @@ -46,8 +46,10 @@ and complete the configuration with the provided ``username`` and ``password``: + 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"> + 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"> @@ -49,7 +50,7 @@ swiftmailer with the memory option, use the following configuration: // app/config/config.php $container->loadFromExtension('swiftmailer', array( - ..., + // ... 'spool' => array('type' => 'memory') )); @@ -75,7 +76,8 @@ In order to use the spool with a file, use the following configuration: @@ -99,7 +101,7 @@ In order to use the spool with a file, use the following configuration: .. tip:: If you want to store the spool somewhere with your project directory, - remember that you can use the `%kernel.root_dir%` parameter to reference + remember that you can use the ``%kernel.root_dir%`` parameter to reference the project's root: .. code-block:: yaml