diff --git a/assetic/apply_to_option.rst b/assetic/apply_to_option.rst index b7f7b151aae..a144f08172f 100644 --- a/assetic/apply_to_option.rst +++ b/assetic/apply_to_option.rst @@ -163,8 +163,9 @@ In this case you can specify that the ``coffee`` filter is applied to all name="coffee" bin="/usr/bin/coffee" node="/usr/bin/node" - apply_to="\.coffee$" /> - /usr/lib/node_modules/ + apply-to="\.coffee$"> + /usr/lib/node_modules/ + @@ -174,10 +175,10 @@ In this case you can specify that the ``coffee`` filter is applied to all $container->loadFromExtension('assetic', array( 'filters' => array( 'coffee' => array( - 'bin' => '/usr/bin/coffee', - 'node' => '/usr/bin/node', + 'bin' => '/usr/bin/coffee', + 'node' => '/usr/bin/node', 'node_paths' => array('/usr/lib/node_modules/'), - 'apply_to' => '\.coffee$', + 'apply_to' => '\.coffee$', ), ), )); diff --git a/assetic/asset_management.rst b/assetic/asset_management.rst index 4380b9fd884..cbeb22e322b 100644 --- a/assetic/asset_management.rst +++ b/assetic/asset_management.rst @@ -411,7 +411,7 @@ configuration under the ``assetic`` section. Read more in the ), ), ), - ); + )); After you have defined the named assets, you can reference them in your templates with the ``@named_asset`` notation: diff --git a/assetic/jpeg_optimize.rst b/assetic/jpeg_optimize.rst index 987924d8e5d..8e6871163d1 100644 --- a/assetic/jpeg_optimize.rst +++ b/assetic/jpeg_optimize.rst @@ -113,7 +113,7 @@ to ``true``: + strip-all="true" /> @@ -217,7 +217,7 @@ following configuration: name="jpegoptim" bin="path/to/jpegoptim" /> - @@ -234,7 +234,6 @@ following configuration: ), 'twig' => array( 'functions' => array('jpegoptim'), - ), ), )); @@ -277,7 +276,7 @@ file: name="jpegoptim" bin="path/to/jpegoptim" /> - @@ -296,7 +295,7 @@ file: 'twig' => array( 'functions' => array( 'jpegoptim' => array( - output => 'images/*.jpg' + 'output' => 'images/*.jpg', ), ), ), diff --git a/assetic/php.rst b/assetic/php.rst index 5ab5888ae9c..8571b99b0c0 100644 --- a/assetic/php.rst +++ b/assetic/php.rst @@ -99,7 +99,7 @@ First, configure a new ``scssphp`` Assetic filter: http://symfony.com/schema/dic/assetic/assetic-1.0.xsd"> - + @@ -172,7 +172,7 @@ First, configure a new ``jsqueeze`` Assetic filter as follows: http://symfony.com/schema/dic/assetic/assetic-1.0.xsd"> - + diff --git a/assetic/uglifyjs.rst b/assetic/uglifyjs.rst index 47cc886fe2d..89b39fd7b4a 100644 --- a/assetic/uglifyjs.rst +++ b/assetic/uglifyjs.rst @@ -170,11 +170,11 @@ can configure its location using the ``node`` key: // app/config/config.php $container->loadFromExtension('assetic', array( - 'node' => '/usr/bin/nodejs', + 'node' => '/usr/bin/nodejs', 'uglifyjs2' => array( - // the path to the uglifyjs executable - 'bin' => '/usr/local/bin/uglifyjs', - ), + // the path to the uglifyjs executable + 'bin' => '/usr/local/bin/uglifyjs', + ), )); Minify your Assets diff --git a/best_practices/security.rst b/best_practices/security.rst index a340c9393b6..672afeb8846 100644 --- a/best_practices/security.rst +++ b/best_practices/security.rst @@ -336,7 +336,7 @@ To enable the security voter in the application, define a new service: # app/config/services.yml services: # ... - post_voter: + app.post_voter: class: AppBundle\Security\PostVoter arguments: ['@security.access.decision_manager'] public: false diff --git a/bundles/configuration.rst b/bundles/configuration.rst index 38910ce143b..2ed74213bcb 100644 --- a/bundles/configuration.rst +++ b/bundles/configuration.rst @@ -81,8 +81,8 @@ bundle configuration would look like: - diff --git a/bundles/installation.rst b/bundles/installation.rst index b40381d1980..541e1f5ef9b 100644 --- a/bundles/installation.rst +++ b/bundles/installation.rst @@ -118,7 +118,7 @@ of the bundle's configuration: The output will look like this: -.. code-block:: text +.. code-block:: yaml assetic: debug: '%kernel.debug%' diff --git a/components/console/helpers/progressbar.rst b/components/console/helpers/progressbar.rst index 0b862831eb8..f6e8b01e43c 100644 --- a/components/console/helpers/progressbar.rst +++ b/components/console/helpers/progressbar.rst @@ -294,7 +294,7 @@ before displaying these messages, you must define your own custom format:: $progressBar->setFormat('custom'); Now, use the ``setMessage()`` method to set the value of the ``%message%`` -placeholder before displaying the progress bar: +placeholder before displaying the progress bar:: // ... $progressBar->setMessage('Start'); diff --git a/components/filesystem.rst b/components/filesystem.rst index b2799d7b922..1ab82a96035 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -53,7 +53,7 @@ endpoint for filesystem operations:: mkdir ~~~~~ -:method:`Symfony\\Component\\Filesystem\\Filesystem::mkdir` creates a directory. +:method:`Symfony\\Component\\Filesystem\\Filesystem::mkdir` creates a directory recursively. On POSIX filesystems, directories are created with a default mode value `0777`. You can use the second argument to set your own mode:: diff --git a/components/routing.rst b/components/routing.rst index f6af13d1fac..686faf31ccb 100644 --- a/components/routing.rst +++ b/components/routing.rst @@ -206,6 +206,9 @@ to find a route that fits the given request you can also build a URL from a certain route:: use Symfony\Component\Routing\Generator\UrlGenerator; + use Symfony\Component\Routing\RequestContext; + use Symfony\Component\Routing\Route; + use Symfony\Component\Routing\RouteCollection; $routes = new RouteCollection(); $routes->add('show_post', new Route('/show/{slug}')); @@ -321,7 +324,7 @@ a path to the main route definition and some other settings:: $resource, array $options = array(), RequestContext $context = null, - array $defaults = array() + LoggerInterface $logger = null ); With the ``cache_dir`` option you can enable route caching (if you provide a diff --git a/components/security/authentication.rst b/components/security/authentication.rst index 2eb521c204d..a880b740a87 100644 --- a/components/security/authentication.rst +++ b/components/security/authentication.rst @@ -71,6 +71,7 @@ The default authentication manager is an instance of :class:`Symfony\\Component\\Security\\Core\\Authentication\\AuthenticationProviderManager`:: use Symfony\Component\Security\Core\Authentication\AuthenticationProviderManager; + use Symfony\Component\Security\Core\Exception\AuthenticationException; // instances of Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface $providers = array(...); @@ -229,6 +230,7 @@ own, it just needs to follow these rules: } // ... + } } Using Password Encoders diff --git a/components/validator/resources.rst b/components/validator/resources.rst index 37581c0c2ed..e21e2db3087 100644 --- a/components/validator/resources.rst +++ b/components/validator/resources.rst @@ -172,7 +172,7 @@ method of the Validator builder:: $validator = Validation::createValidatorBuilder() // ... add loaders - ->setMetadataCache(new ApcCache('some_apc_prefix')); + ->setMetadataCache(new ApcCache('some_apc_prefix')) ->getValidator(); Using a Custom MetadataFactory @@ -193,7 +193,7 @@ this custom implementation using use Symfony\Component\Validator\Validation; $validator = Validation::createValidatorBuilder() - ->setMetadataFactory(new CustomMetadataFactory(...)); + ->setMetadataFactory(new CustomMetadataFactory(...)) ->getValidator(); .. caution:: diff --git a/configuration.rst b/configuration.rst index 96e8ff206a7..c3094570042 100644 --- a/configuration.rst +++ b/configuration.rst @@ -150,14 +150,8 @@ it *also* loads other configuration files via its ``imports`` key: + http://symfony.com/schema/dic/services/services-1.0.xsd"> @@ -216,13 +210,10 @@ key: + http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> @@ -316,7 +307,7 @@ configure DoctrineBundle and other parts of Symfony: .. code-block:: php // app/config/config.php - $configuration->loadFromExtension('doctrine', array( + $container->loadFromExtension('doctrine', array( 'dbal' => array( 'driver' => 'pdo_mysql', // ... diff --git a/configuration/apache_router.rst b/configuration/apache_router.rst index f7cbf7bb70f..0b16374db26 100644 --- a/configuration/apache_router.rst +++ b/configuration/apache_router.rst @@ -44,9 +44,7 @@ Symfony to use the ``ApacheUrlMatcher`` instead of the default one: null - - Symfony\Component\Routing\Matcher\ApacheUrlMatcher - + Symfony\Component\Routing\Matcher\ApacheUrlMatcher .. code-block:: php diff --git a/configuration/environments.rst b/configuration/environments.rst index 0caf455acb4..f89ce2d6501 100644 --- a/configuration/environments.rst +++ b/configuration/environments.rst @@ -294,10 +294,10 @@ The best way to accomplish this is via a new environment called, for example, .. code-block:: php // app/config/config_benchmark.php - $loader->import('config_prod.php') + $loader->import('config_prod.php'); $container->loadFromExtension('framework', array( - 'profiler' => array('only-exceptions' => false), + 'profiler' => array('only_exceptions' => false), )); .. include:: /components/dependency_injection/_imports-parameters-note.rst.inc diff --git a/console/input.rst b/console/input.rst index 35da1f094bc..104fef19822 100644 --- a/console/input.rst +++ b/console/input.rst @@ -79,7 +79,7 @@ To use this, just specify as many names as you want: You can access the ``names`` argument as an array:: - $names = $input->getArgument('names') + $names = $input->getArgument('names'); if (count($names) > 0) { $text .= ' '.implode(', ', $names); } diff --git a/console/request_context.rst b/console/request_context.rst index ff90b182ede..3bd7568c18a 100644 --- a/console/request_context.rst +++ b/console/request_context.rst @@ -54,7 +54,7 @@ will override the defaults. .. code-block:: php - // app/config/config_test.php + // app/config/parameters.php $container->setParameter('router.request_context.host', 'example.org'); $container->setParameter('router.request_context.scheme', 'https'); $container->setParameter('router.request_context.base_url', 'my/path'); diff --git a/contributing/documentation/format.rst b/contributing/documentation/format.rst index fafb7a21c95..f1c8031e62d 100644 --- a/contributing/documentation/format.rst +++ b/contributing/documentation/format.rst @@ -195,8 +195,8 @@ Whenever a new minor version of Symfony is released (e.g. 2.4, 2.5, etc), a new branch of the documentation is created from the ``master`` branch. At this point, all the ``versionadded`` tags for Symfony versions that have reached end-of-maintenance will be removed. For example, if Symfony 2.5 were -released today, and 2.2 had recently reached its end-of-life, the 2.2 ``versionadded`` -tags would be removed from the new ``2.5`` branch. +released today, and 2.2 had recently reached its end-of-maintenance, the 2.2 +``versionadded`` tags would be removed from the new ``2.5`` branch. .. _reStructuredText: http://docutils.sourceforge.net/rst.html .. _Sphinx: http://sphinx-doc.org/ diff --git a/controller/error_pages.rst b/controller/error_pages.rst index bfda93a2677..9801b8934cd 100644 --- a/controller/error_pages.rst +++ b/controller/error_pages.rst @@ -211,7 +211,7 @@ configuration option to point to it: # app/config/config.yml twig: - exception_controller: AppBundle:Exception:showException + exception_controller: AppBundle:Exception:showException .. code-block:: xml diff --git a/controller/service.rst b/controller/service.rst index d323957e488..05ad53c253c 100644 --- a/controller/service.rst +++ b/controller/service.rst @@ -332,7 +332,7 @@ controller: $templating = $this->templating; $callback = function () use ($templating, $view, $parameters) { $templating->stream($view, $parameters); - } + }; return new StreamedResponse($callback); diff --git a/deployment/fortrabbit.rst b/deployment/fortrabbit.rst index 30e37468cde..9ebd571f712 100644 --- a/deployment/fortrabbit.rst +++ b/deployment/fortrabbit.rst @@ -122,16 +122,16 @@ Make sure this file is imported into the main config file: .. code-block:: yaml # app/config/config_prod.yml - imports: - - { resource: config.yml } - - { resource: config_prod_secrets.php } + imports: + - { resource: config.yml } + - { resource: config_prod_secrets.php } - # .. - framework: - session: - # set handler_id to null to use default session handler from php.ini (memcached) - handler_id: ~ - # .. + # .. + framework: + session: + # set handler_id to null to use default session handler from php.ini (memcached) + handler_id: ~ + # .. .. code-block:: xml @@ -151,14 +151,14 @@ Make sure this file is imported into the main config file: - + .. code-block:: php // app/config/config_prod.php - $loader->import('config/config.php'); + $loader->import('config.php'); $loader->import('config_prod_secrets.php'); $container->loadFromExtension('framework', array( diff --git a/doctrine.rst b/doctrine.rst index edfdd01ca7c..faabea88c27 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -44,10 +44,10 @@ information. By convention, this information is usually configured in an # app/config/parameters.yml parameters: - database_host: localhost - database_name: test_project - database_user: root - database_password: password + database_host: localhost + database_name: test_project + database_user: root + database_password: password # ... @@ -95,7 +95,7 @@ information. By convention, this information is usually configured in an .. code-block:: php // app/config/config.php - $configuration->loadFromExtension('doctrine', array( + $container->loadFromExtension('doctrine', array( 'dbal' => array( 'driver' => 'pdo_mysql', 'host' => '%database_host%', diff --git a/doctrine/pdo_session_storage.rst b/doctrine/pdo_session_storage.rst index ad7b1895037..428eb5e0b99 100644 --- a/doctrine/pdo_session_storage.rst +++ b/doctrine/pdo_session_storage.rst @@ -40,7 +40,7 @@ To use it, you just need to change some parameters in the main configuration fil - mysql:dbname=mydatabase + mysql:dbname=mydatabase myuser mypassword @@ -93,7 +93,7 @@ a second array argument to ``PdoSessionHandler``: - mysql:dbname=mydatabase + mysql:dbname=mydatabase sessions myuser diff --git a/form/action_method.rst b/form/action_method.rst index 64098cfc647..bad5a91857f 100644 --- a/form/action_method.rst +++ b/form/action_method.rst @@ -47,7 +47,7 @@ to the ``form()`` or the ``form_start()`` helper functions: .. code-block:: html+php - + start($form, array( // The path() method was introduced in Symfony 2.8. Prior to 2.8, // you had to use generate(). diff --git a/form/data_transformers.rst b/form/data_transformers.rst index 8cd54e9a1c1..e5c6f5bb93e 100644 --- a/form/data_transformers.rst +++ b/form/data_transformers.rst @@ -36,7 +36,7 @@ Suppose you have a Task form with a tags ``text`` type:: { public function buildForm(FormBuilderInterface $builder, array $options) { - $builder->add('tags', TextType::class) + $builder->add('tags', TextType::class); } public function configureOptions(OptionsResolver $resolver) diff --git a/form/direct_submit.rst b/form/direct_submit.rst index 62f2df96110..8c700ccd33d 100644 --- a/form/direct_submit.rst +++ b/form/direct_submit.rst @@ -42,9 +42,6 @@ submissions:: Calling Form::submit() manually ------------------------------- -.. versionadded:: 2.3 - Before Symfony 2.3, the ``submit()`` method was known as ``bind()``. - In some cases, you want better control over when exactly your form is submitted and what data is passed to it. Instead of using the :method:`Symfony\\Component\\Form\\FormInterface::handleRequest` @@ -88,9 +85,16 @@ method, pass the submitted data directly to When submitting a form via a "PATCH" request, you may want to update only a few submitted fields. To achieve this, you may pass an optional second boolean - parameter to ``submit()``. Passing ``false`` will remove any missing fields + argument to ``submit()``. Passing ``false`` will remove any missing fields within the form object. Otherwise, the missing fields will be set to ``null``. +.. caution:: + + When the second parameter ``$clearMissing`` is ``false``, like with the + "PATCH" method, the validation extension will only handle the submitted + fields. If the underlying data needs to be validated, this should be done + manually, i.e. using the validator. + .. _form-submit-request: Passing a Request to Form::submit() (Deprecated) @@ -129,5 +133,5 @@ a convenient shortcut to the previous example:: Passing the :class:`Symfony\\Component\\HttpFoundation\\Request` directly to :method:`Symfony\\Component\\Form\\FormInterface::submit` still works, but is -deprecated and will be removed in Symfony 3.0. You should use the method +deprecated and has been removed in Symfony 3.0. You should use the method :method:`Symfony\\Component\\Form\\FormInterface::handleRequest` instead. diff --git a/form/form_collections.rst b/form/form_collections.rst index fe807d37b76..b1e37a58345 100644 --- a/form/form_collections.rst +++ b/form/form_collections.rst @@ -224,7 +224,7 @@ zero tags when first created).

Tags

    - +
  • row($tag['name']) ?>
diff --git a/form/form_customization.rst b/form/form_customization.rst index 45cc247255a..2eb670c79a4 100644 --- a/form/form_customization.rst +++ b/form/form_customization.rst @@ -569,7 +569,7 @@ form is rendered. - AppBundle:Form + AppBundle:Form diff --git a/form/without_class.rst b/form/without_class.rst index 3029a16a824..ec5bfa6cf08 100644 --- a/form/without_class.rst +++ b/form/without_class.rst @@ -105,4 +105,4 @@ but here's a short example: .. code-block:: php - new NotBlank(array('groups' => array('create', 'update'))) + new NotBlank(array('groups' => array('create', 'update'))); diff --git a/http_cache/cache_invalidation.rst b/http_cache/cache_invalidation.rst index 9c649d4df85..a67adb470c4 100644 --- a/http_cache/cache_invalidation.rst +++ b/http_cache/cache_invalidation.rst @@ -74,9 +74,9 @@ Here is how you can configure the Symfony reverse proxy to support the $response = new Response(); if ($this->getStore()->purge($request->getUri())) { - $response->setStatusCode(200, 'Purged'); + $response->setStatusCode(Response::HTTP_OK, 'Purged'); } else { - $response->setStatusCode(404, 'Not found'); + $response->setStatusCode(Response::HTTP_NOT_FOUND, 'Not found'); } return $response; diff --git a/http_cache/esi.rst b/http_cache/esi.rst index 447372e80b1..4fdec87e9a7 100644 --- a/http_cache/esi.rst +++ b/http_cache/esi.rst @@ -155,7 +155,7 @@ matter), Symfony uses the standard ``render`` helper to configure ESI tags: 'latest_news', array('maxPerPage' => 5) ), - array('strategy' => 'esi'), + array('strategy' => 'esi') ) ?> By using the ``esi`` renderer (via the ``render_esi()`` Twig function), you @@ -233,7 +233,7 @@ that must be enabled in your configuration: +
diff --git a/http_cache/expiration.rst b/http_cache/expiration.rst index 9d1169a79a8..d25b92de40b 100644 --- a/http_cache/expiration.rst +++ b/http_cache/expiration.rst @@ -36,7 +36,7 @@ Most of the time, you will use the ``Cache-Control`` header. Recall that the ``Cache-Control`` header is used to specify many different cache directives:: // Sets the number of seconds after which the response - // should no longer be considered fresh + // should no longer be considered fresh by shared caches $response->setSharedMaxAge(600); The ``Cache-Control`` header would take on the following format (it may have diff --git a/logging.rst b/logging.rst index f81bef52b3a..bfabf722e54 100644 --- a/logging.rst +++ b/logging.rst @@ -287,7 +287,7 @@ option of your handler to ``rotating_file``: type="rotating_file" path="%kernel.logs_dir%/%kernel.environment%.log" level="debug" - max_files="10" + max-files="10" />
diff --git a/logging/disable_microsecond_precision.rst b/logging/disable_microsecond_precision.rst index b0f7aa36326..4858a7f0d85 100644 --- a/logging/disable_microsecond_precision.rst +++ b/logging/disable_microsecond_precision.rst @@ -35,7 +35,7 @@ log generation. This is recommended for systems that generate a large number of http://symfony.com/schema/dic/monolog http://symfony.com/schema/dic/monolog/monolog-1.0.xsd"> - + - + + + @@ -184,6 +186,8 @@ profiler to use this service as the matcher: $container->loadFromExtension('framework', array( // ... 'profiler' => array( - 'service' => 'app.super_admin_matcher', + 'matcher' => array( + 'service' => 'app.super_admin_matcher', + ) ), )); diff --git a/reference/configuration/assetic.rst b/reference/configuration/assetic.rst index 14f7b9a1d4e..b0a9f40993a 100644 --- a/reference/configuration/assetic.rst +++ b/reference/configuration/assetic.rst @@ -13,6 +13,7 @@ Full Default Configuration .. code-block:: yaml + # app/config/config.yml assetic: debug: '%kernel.debug%' use_controller: @@ -63,6 +64,7 @@ Full Default Configuration .. code-block:: xml + loadFromExtension('debug', array( 'dump_destination' => 'php://stderr', )); diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index 14205735946..fa94fa6e177 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -12,6 +12,7 @@ Full Default Configuration .. code-block:: yaml + # app/config/config.yml doctrine: dbal: default_connection: default @@ -183,6 +184,7 @@ Full Default Configuration .. code-block:: xml + array('example.com', 'example.org'), )); -Hosts can also be configured using regular expressions (e.g. ``.*\.?example.com$``), +Hosts can also be configured using regular expressions (e.g. ``^(.+\.)?example.com$``), which make it easier to respond to any subdomain. In addition, you can also set the trusted hosts in the front controller using the ``Request::setTrustedHosts()`` method:: // web/app.php - Request::setTrustedHosts(array('.*\.?example.com$', '.*\.?example.org$')); + Request::setTrustedHosts(array('^(.+\.)?example.com$', '^(.+\.)?example.org$')); The default value for this option is an empty array, meaning that the application can respond to any given host. @@ -900,7 +900,7 @@ This option allows you to define a base path to be used for assets: http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - + diff --git a/reference/configuration/monolog.rst b/reference/configuration/monolog.rst index 1e4b0b0650b..6c69c07e31a 100644 --- a/reference/configuration/monolog.rst +++ b/reference/configuration/monolog.rst @@ -14,6 +14,7 @@ Full Default Configuration .. code-block:: yaml + # app/config/config.yml monolog: handlers: @@ -76,6 +77,7 @@ Full Default Configuration .. code-block:: xml + - - - - - - + + + + + + .. code-block:: php @@ -682,9 +682,9 @@ To use HTTP-Digest authentication you need to provide a realm and a secret: - - - + + + .. code-block:: php diff --git a/reference/configuration/swiftmailer.rst b/reference/configuration/swiftmailer.rst index 1d6a1a81150..330ff291499 100644 --- a/reference/configuration/swiftmailer.rst +++ b/reference/configuration/swiftmailer.rst @@ -233,9 +233,9 @@ Full Default Configuration host="localhost" port="false" encryption="" - auth_mode="" - sender_address="" - disable_delivery="" + auth-mode="" + sender-address="" + disable-delivery="" logging="%kernel.debug%" > loadFromExtension('twig', array( 'form_themes' => array( 'form_div_layout.html.twig', // Default diff --git a/reference/configuration/web_profiler.rst b/reference/configuration/web_profiler.rst index fc9e9ee8a0c..ebc0f35695d 100644 --- a/reference/configuration/web_profiler.rst +++ b/reference/configuration/web_profiler.rst @@ -11,6 +11,7 @@ Full Default Configuration .. code-block:: yaml + # app/config/config.yml web_profiler: # DEPRECATED, it is not useful anymore and can be removed @@ -31,9 +32,10 @@ Full Default Configuration .. code-block:: xml + diff --git a/reference/constraints/CardScheme.rst b/reference/constraints/CardScheme.rst index 7e9d4cd6eee..ce074945557 100644 --- a/reference/constraints/CardScheme.rst +++ b/reference/constraints/CardScheme.rst @@ -28,7 +28,7 @@ on an object that will contain a credit card number. .. code-block:: php-annotations // src/AppBundle/Entity/Transaction.php - namespace AppBundle\Entity\Transaction; + namespace AppBundle\Entity; use Symfony\Component\Validator\Constraints as Assert; @@ -76,7 +76,7 @@ on an object that will contain a credit card number. .. code-block:: php // src/AppBundle/Entity/Transaction.php - namespace AppBundle\Entity\Transaction; + namespace AppBundle\Entity; use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Constraints as Assert; diff --git a/reference/constraints/Choice.rst b/reference/constraints/Choice.rst index d36f94fc20a..be0aa3eb650 100644 --- a/reference/constraints/Choice.rst +++ b/reference/constraints/Choice.rst @@ -62,7 +62,8 @@ If your valid choice list is simple, you can pass them in directly via the # src/AppBundle/Resources/config/validation.yml AppBundle\Entity\Author: properties: - city: [New York, Berlin, Tokyo] + city: + - Choice: [New York, Berlin, Tokyo] gender: - Choice: choices: [male, female] @@ -258,7 +259,7 @@ you can pass the class name and the method as an array. .. code-block:: php - // src/AppBundle/EntityAuthor.php + // src/AppBundle/Entity/Author.php namespace AppBundle\Entity; use Symfony\Component\Validator\Mapping\ClassMetadata; diff --git a/reference/constraints/Collection.rst b/reference/constraints/Collection.rst index 733b3b9144b..810aa2546b4 100644 --- a/reference/constraints/Collection.rst +++ b/reference/constraints/Collection.rst @@ -38,8 +38,8 @@ of a collection individually. Take the following example:: class Author { protected $profileData = array( - 'personal_email', - 'short_bio', + 'personal_email' => '...', + 'short_bio' => '...', ); public function setProfileData($key, $value) @@ -80,8 +80,8 @@ following: * ) */ protected $profileData = array( - 'personal_email', - 'short_bio', + 'personal_email' => '...', + 'short_bio' => '...', ); } diff --git a/reference/constraints/Image.rst b/reference/constraints/Image.rst index fb792878276..6928eb18428 100644 --- a/reference/constraints/Image.rst +++ b/reference/constraints/Image.rst @@ -179,7 +179,7 @@ following code: .. code-block:: yaml # src/AppBundle/Resources/config/validation.yml - AppBundle\Entity\Author + AppBundle\Entity\Author: properties: headshot: - Image: diff --git a/reference/constraints/IsFalse.rst b/reference/constraints/IsFalse.rst index 8f849af4d23..7cdc7a5c5d4 100644 --- a/reference/constraints/IsFalse.rst +++ b/reference/constraints/IsFalse.rst @@ -63,7 +63,7 @@ method returns **false**: .. code-block:: yaml # src/AppBundle/Resources/config/validation.yml - AppBundle\Entity\Author + AppBundle\Entity\Author: getters: stateInvalid: - 'IsFalse': diff --git a/reference/constraints/UniqueEntity.rst b/reference/constraints/UniqueEntity.rst index b1a8b95291b..12df4196338 100644 --- a/reference/constraints/UniqueEntity.rst +++ b/reference/constraints/UniqueEntity.rst @@ -89,7 +89,7 @@ your user table: .. code-block:: php - // src/AppBundle/Entity/User.php + // src/AppBundle/Entity/Author.php namespace AppBundle\Entity; use Symfony\Component\Validator\Constraints as Assert; diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index deb924005a0..41b5abb2a69 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -1431,7 +1431,7 @@ If you do need to use this tag, just make a new class that implements the :class:`Symfony\\Component\\Validator\\ObjectInitializerInterface` interface. Then, tag it with the ``validator.initializer`` tag (it has no options). -For an example, see the ``EntityInitializer`` class inside the Doctrine +For an example, see the ``DoctrineInitializer`` class inside the Doctrine Bridge. .. _`Twig's documentation`: http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension diff --git a/request/load_balancer_reverse_proxy.rst b/request/load_balancer_reverse_proxy.rst index 76c3f79da1c..8bf9b294d07 100644 --- a/request/load_balancer_reverse_proxy.rst +++ b/request/load_balancer_reverse_proxy.rst @@ -82,15 +82,17 @@ In this case, you'll need to - *very carefully* - trust *all* proxies. #. Once you've guaranteed that traffic will only come from your trusted reverse proxies, configure Symfony to *always* trust incoming request. This is - done inside of your front controller:: + done inside of your front controller: - // web/app.php + .. code-block:: diff - // ... - Request::setTrustedProxies(array('127.0.0.1', $request->server->get('REMOTE_ADDR'))); + // web/app.php - $response = $kernel->handle($request); - // ... + // ... + $request = Request::createFromGlobals(); + + Request::setTrustedProxies(array('127.0.0.1', $request->server->get('REMOTE_ADDR'))); + + // ... #. Ensure that the trusted_proxies setting in your ``app/config/config.yml`` is not set or it will overwrite the ``setTrustedProxies()`` call above. diff --git a/routing.rst b/routing.rst index aa023ba84f6..8beadc8e045 100644 --- a/routing.rst +++ b/routing.rst @@ -72,12 +72,12 @@ The route is simple: # app/config/routing.yml blog_list: - path: /blog - defaults: { _controller: AppBundle:Blog:list } + path: /blog + defaults: { _controller: AppBundle:Blog:list } blog_show: - path: /blog/{slug} - defaults: { _controller: AppBundle:Blog:show } + path: /blog/{slug} + defaults: { _controller: AppBundle:Blog:show } .. code-block:: xml diff --git a/routing/hostname_pattern.rst b/routing/hostname_pattern.rst index 4c49199fcaa..ce59fd6cb0d 100644 --- a/routing/hostname_pattern.rst +++ b/routing/hostname_pattern.rst @@ -193,7 +193,8 @@ instance, if you want to match both ``m.example.com`` and + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> AcmeDemoBundle:Main:mobileHomepage @@ -251,17 +252,16 @@ You can also set the host option on imported routes: + xsi:schemaLocation="http://symfony.com/schema/routing + http://symfony.com/schema/routing/routing-1.0.xsd"> .. code-block:: php - use Symfony\Component\Routing\RouteCollection; - - $collection = new RouteCollection(); - $collection->addCollection($loader->import("@AcmeHelloBundle/Resources/config/routing.php"), '', array(), array(), array(), 'hello.example.com'); + $collection = $loader->import("@AcmeHelloBundle/Resources/config/routing.php"); + $collection->setHost('hello.example.com'); return $collection; diff --git a/routing/requirements.rst b/routing/requirements.rst index 1cf881203e8..d51ed7163ba 100644 --- a/routing/requirements.rst +++ b/routing/requirements.rst @@ -184,7 +184,7 @@ accomplished with the following route configuration: .. code-block:: php-annotations - // src/AppBundle/Controller/MainController.php + // src/AppBundle/Controller/BlogApiController.php namespace AppBundle\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; diff --git a/security.rst b/security.rst index c68ee937e6f..d3021e30cc6 100644 --- a/security.rst +++ b/security.rst @@ -86,11 +86,11 @@ configuration looks like this: ), 'firewalls' => array( 'dev' => array( - 'pattern' => '^/(_(profiler|wdt)|css|images|js)/', - 'security' => false, + 'pattern' => '^/(_(profiler|wdt)|css|images|js)/', + 'security' => false, ), 'default' => array( - 'anonymous' => null, + 'anonymous' => null, ), ), )); @@ -257,7 +257,7 @@ user to be logged in to access this URL: ), 'access_control' => array( // require ROLE_ADMIN for /admin* - array('path' => '^/admin', 'role' => 'ROLE_ADMIN'), + array('path' => '^/admin', 'roles' => 'ROLE_ADMIN'), ), )); diff --git a/security/acl.rst b/security/acl.rst index a4d8b6c27ea..43af8a9da18 100644 --- a/security/acl.rst +++ b/security/acl.rst @@ -77,10 +77,12 @@ First, you need to configure the connection the ACL system is supposed to use: .. code-block:: php // app/config/security.php - $container->loadFromExtension('security', 'acl', array( + $container->loadFromExtension('security', array( // ... - 'connection' => 'default', + 'acl' => array( + 'connection' => 'default', + ), )); .. note:: diff --git a/security/api_key_authentication.rst b/security/api_key_authentication.rst index edc052fdbd7..e2a5877d04e 100644 --- a/security/api_key_authentication.rst +++ b/security/api_key_authentication.rst @@ -460,8 +460,9 @@ If you have defined ``access_control``, make sure to add a new entry: xmlns:srv="http://symfony.com/schema/dic/services" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - - + + + .. code-block:: php diff --git a/security/custom_authentication_provider.rst b/security/custom_authentication_provider.rst index 3890c9ed3ea..615709f07bd 100644 --- a/security/custom_authentication_provider.rst +++ b/security/custom_authentication_provider.rst @@ -143,9 +143,9 @@ set an authenticated token in the token storage if successful. $token = new WsseUserToken(); $token->setUser($matches[1]); - $token->digest = $matches[2]; - $token->nonce = $matches[3]; - $token->created = $matches[4]; + $token->digest = $matches[2]; + $token->nonce = $matches[3]; + $token->created = $matches[4]; try { $authToken = $this->authenticationManager->authenticate($token); diff --git a/security/impersonating_user.rst b/security/impersonating_user.rst index 40f17d001fc..6df1e214195 100644 --- a/security/impersonating_user.rst +++ b/security/impersonating_user.rst @@ -98,7 +98,7 @@ to show a link to exit impersonation: had to use generate(). --> + )) ?>"> Exit impersonation diff --git a/security/pre_authenticated.rst b/security/pre_authenticated.rst index 582cd4f63d5..966b657d52d 100644 --- a/security/pre_authenticated.rst +++ b/security/pre_authenticated.rst @@ -139,7 +139,7 @@ corresponding firewall in your security configuration: $container->loadFromExtension('security', array( 'firewalls' => array( 'secured_area' => array( - 'pattern' => '^/' + 'pattern' => '^/', 'remote_user' => array( 'provider' => 'your_user_provider', ), diff --git a/security/voters.rst b/security/voters.rst index d73cdc8d210..a6cda0e2cac 100644 --- a/security/voters.rst +++ b/security/voters.rst @@ -221,7 +221,7 @@ and tag it with ``security.voter``: # app/config/services.yml services: app.post_voter: - class: AppBundle\Security\PostVoter + class: AppBundle\Security\PostVoter tags: - { name: security.voter } # small performance boost @@ -414,7 +414,7 @@ security configuration: > - + diff --git a/serializer.rst b/serializer.rst index fdcebafd111..e13bc0c9c64 100644 --- a/serializer.rst +++ b/serializer.rst @@ -139,7 +139,7 @@ Here is an example on how to load the use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer; $container->register('get_set_method_normalizer', GetSetMethodNormalizer::class) - ->setPublic(false); + ->setPublic(false) ->addTag('serializer.normalizer') ; diff --git a/service_container.rst b/service_container.rst index 1003fe2dc4a..907941592b9 100644 --- a/service_container.rst +++ b/service_container.rst @@ -172,8 +172,8 @@ straightforward. Parameters make defining services more organized and flexible: services: app.mailer: - class: AppBundle\Mailer - arguments: ['%app.mailer.transport%'] + class: AppBundle\Mailer + arguments: ['%app.mailer.transport%'] .. code-block:: xml @@ -409,7 +409,7 @@ Injecting the dependency by the setter method just needs a change of syntax: # ... app.newsletter_manager: - class: AppBundle\Newsletter\NewsletterManager + class: AppBundle\Newsletter\NewsletterManager calls: - [setMailer, ['@app.mailer']] @@ -444,7 +444,7 @@ Injecting the dependency by the setter method just needs a change of syntax: $container->setDefinition('app.mailer', ...); - $definition = new Definition(NewsletterManager::class) + $definition = new Definition(NewsletterManager::class); $definition->addMethodCall('setMailer', array( new Reference('app.mailer'), )); diff --git a/service_container/configurators.rst b/service_container/configurators.rst index dd8f7f00f31..f2d16cbdcc9 100644 --- a/service_container/configurators.rst +++ b/service_container/configurators.rst @@ -185,7 +185,7 @@ You can configure the service configurator using the ``configurator`` option: ->setConfigurator(array(new Reference('app.email_configurator'), 'configure')) ; - $container->register('app.greeting_card_manager', GreetingCardManager::class); + $container->register('app.greeting_card_manager', GreetingCardManager::class) ->addArgument(new Reference('mailer')) ->setConfigurator(array(new Reference('app.email_configurator'), 'configure')) ; diff --git a/service_container/definitions.rst b/service_container/definitions.rst index fd8d442c438..cb894ad3b2d 100644 --- a/service_container/definitions.rst +++ b/service_container/definitions.rst @@ -75,6 +75,7 @@ fetched from the container:: use AppBundle\Config\DoctrineConfigManager; use Symfony\Component\DependencyInjection\Definition; + use Symfony\Component\DependencyInjection\Reference; $definition = new Definition(DoctrineConfigManager::class, array( new Reference('doctrine'), // a reference to another service diff --git a/service_container/expression_language.rst b/service_container/expression_language.rst index 8184c8166b9..1b66fd6c672 100644 --- a/service_container/expression_language.rst +++ b/service_container/expression_language.rst @@ -27,8 +27,8 @@ of the new ``mailer_configuration`` service? One way is to use an expression: # app/config/config.yml services: my_mailer: - class: AppBundle\Mailer - arguments: ["@=service('mailer_configuration').getMailerMethod()"] + class: AppBundle\Mailer + arguments: ["@=service('mailer_configuration').getMailerMethod()"] .. code-block:: xml diff --git a/service_container/import.rst b/service_container/import.rst index 04839945117..28e1fc10196 100644 --- a/service_container/import.rst +++ b/service_container/import.rst @@ -49,8 +49,8 @@ service files: services: app.mailer: - class: AppBundle\Mailer - arguments: ['%app.mailer.transport%'] + class: AppBundle\Mailer + arguments: ['%app.mailer.transport%'] .. code-block:: xml diff --git a/service_container/optional_dependencies.rst b/service_container/optional_dependencies.rst index 5bc9e9b2ec3..a5525b5dbb1 100644 --- a/service_container/optional_dependencies.rst +++ b/service_container/optional_dependencies.rst @@ -76,7 +76,7 @@ call if the service exists and remove the method call if it does not: # app/config/services.yml services: app.newsletter_manager: - class: AppBundle\Newsletter\NewsletterManager + class: AppBundle\Newsletter\NewsletterManager calls: - [setMailer, ['@?app.mailer']] diff --git a/service_container/parent_services.rst b/service_container/parent_services.rst index 7ddd99788fe..914da6ccab8 100644 --- a/service_container/parent_services.rst +++ b/service_container/parent_services.rst @@ -68,7 +68,7 @@ duplicated service definitions: - + diff --git a/service_container/service_decoration.rst b/service_container/service_decoration.rst index 4e9d08f04a7..d754c5fe97f 100644 --- a/service_container/service_decoration.rst +++ b/service_container/service_decoration.rst @@ -35,7 +35,7 @@ the original service is lost: one, the old definition is lost --> - + .. code-block:: php @@ -86,7 +86,7 @@ a reference of the old one as ``app.decorating_mailer.inner``: - + .. code-block:: php @@ -151,7 +151,7 @@ convention, the old ``app.mailer`` service is renamed to - + .. code-block:: php diff --git a/service_container/synthetic_services.rst b/service_container/synthetic_services.rst index 38da855d56c..301e6cae18b 100644 --- a/service_container/synthetic_services.rst +++ b/service_container/synthetic_services.rst @@ -38,7 +38,7 @@ configuration: services: - // synthetic services don't specify a class + # synthetic services don't specify a class app.synthetic_service: synthetic: true diff --git a/session/php_bridge.rst b/session/php_bridge.rst index 50ee2a15ddf..c122337c0c8 100644 --- a/session/php_bridge.rst +++ b/session/php_bridge.rst @@ -42,6 +42,7 @@ for the ``handler_id``: 'session' => array( 'storage_id' => 'session.storage.php_bridge', 'handler_id' => null, + ), )); Otherwise, if the problem is simply that you cannot avoid the application @@ -77,6 +78,7 @@ the example below: 'session' => array( 'storage_id' => 'session.storage.php_bridge', 'handler_id' => 'session.storage.native_file', + ), )); .. note:: diff --git a/setup/web_server_configuration.rst b/setup/web_server_configuration.rst index 22a375d3cac..6958c30ac15 100644 --- a/setup/web_server_configuration.rst +++ b/setup/web_server_configuration.rst @@ -310,7 +310,7 @@ The **minimum configuration** to get your application running under Nginx is: # return 404 for all other php files not matching the front controller # this prevents access to other php files you don't want to be accessible. location ~ \.php$ { - return 404; + return 404; } error_log /var/log/nginx/project_error.log; diff --git a/templating.rst b/templating.rst index 44145826d82..494feab71eb 100644 --- a/templating.rst +++ b/templating.rst @@ -727,7 +727,7 @@ correctly: .. code-block:: html+php - + diff --git a/templating/hinclude.rst b/templating/hinclude.rst index dfdf6f7bc55..60c2e53d264 100644 --- a/templating/hinclude.rst +++ b/templating/hinclude.rst @@ -61,7 +61,7 @@ tags: - + diff --git a/templating/namespaced_paths.rst b/templating/namespaced_paths.rst index 0548714939d..f3da711362b 100644 --- a/templating/namespaced_paths.rst +++ b/templating/namespaced_paths.rst @@ -68,7 +68,7 @@ directory: $container->loadFromExtension('twig', array( 'paths' => array( '%kernel.root_dir%/../vendor/acme/foo-bar/templates' => 'foo_bar', - ); + ), )); The registered namespace is called ``foo_bar``, which refers to the diff --git a/testing.rst b/testing.rst index 32ef1fb62cf..6cb646a1184 100644 --- a/testing.rst +++ b/testing.rst @@ -727,7 +727,7 @@ add the values to the raw data array:: $values['task']['tags'][1]['name'] = 'bar'; // Submit the form with the existing and new values. - $crawler = $this->client->request($form->getMethod(), $form->getUri(), $values, + $crawler = $client->request($form->getMethod(), $form->getUri(), $values, $form->getPhpFiles()); // The 2 tags have been added to the collection. diff --git a/testing/database.rst b/testing/database.rst index 6ea86ec45c6..82abbc12125 100644 --- a/testing/database.rst +++ b/testing/database.rst @@ -145,7 +145,7 @@ configuration: .. code-block:: php // app/config/config_test.php - $configuration->loadFromExtension('doctrine', array( + $container->loadFromExtension('doctrine', array( 'dbal' => array( 'host' => 'localhost', 'dbname' => 'testdb', diff --git a/validation.rst b/validation.rst index f65c62e0fd8..9322197b5f4 100644 --- a/validation.rst +++ b/validation.rst @@ -155,7 +155,7 @@ message: .. code-block:: text - AppBundle\Author.name: + AppBundle\Entity\Author.name: This value should not be blank If you insert a value into the ``name`` property, the happy success message diff --git a/validation/sequence_provider.rst b/validation/sequence_provider.rst index ae1dd0e144e..bcf2f388e86 100644 --- a/validation/sequence_provider.rst +++ b/validation/sequence_provider.rst @@ -234,10 +234,10 @@ entity and a new constraint group called ``Premium``: public static function loadValidatorMetadata(ClassMetadata $metadata) { $metadata->addPropertyConstraint('name', new Assert\NotBlank()); - $metadata->addPropertyConstraint('creditCard', new Assert\CardScheme( + $metadata->addPropertyConstraint('creditCard', new Assert\CardScheme(array( 'schemes' => array('VISA'), 'groups' => array('Premium'), - )); + ))); } }