diff --git a/bundles/best_practices.rst b/bundles/best_practices.rst index 3daade32f62..bab8e818705 100644 --- a/bundles/best_practices.rst +++ b/bundles/best_practices.rst @@ -454,7 +454,7 @@ Resources If the bundle references any resources (config files, translation files, etc.), don't use physical paths (e.g. ``__DIR__/config/services.xml``) but logical -paths (e.g. ``@AppBundle/Resources/config/services.xml``). +paths (e.g. ``@FooBundle/Resources/config/services.xml``). The logical paths are required because of the bundle overriding mechanism that lets you override any resource/file of any bundle. See :ref:`http-kernel-resource-locator` @@ -462,7 +462,7 @@ for more details about transforming physical paths into logical paths. Beware that templates use a simplified version of the logical path shown above. For example, an ``index.html.twig`` template located in the ``Resources/views/Default/`` -directory of the AppBundle, is referenced as ``@App/Default/index.html.twig``. +directory of the FooBundle, is referenced as ``@Foo/Default/index.html.twig``. Learn more ---------- diff --git a/bundles/override.rst b/bundles/override.rst index 7dc8446fc78..0e69c2b832f 100644 --- a/bundles/override.rst +++ b/bundles/override.rst @@ -12,7 +12,7 @@ features of a bundle. The bundle overriding mechanism means that you cannot use physical paths to refer to bundle's resources (e.g. ``__DIR__/config/services.xml``). Always - use logical paths in your bundles (e.g. ``@AppBundle/Resources/config/services.xml``) + use logical paths in your bundles (e.g. ``@FooBundle/Resources/config/services.xml``) and call the :ref:`locateResource() method ` to turn them into physical paths when needed. diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index 69b6ee74ac8..f212612f0d2 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -247,7 +247,7 @@ method:: // ... $helper = $this->getHelper('question'); - $question = new Question('Please enter the name of the bundle', 'AppBundle'); + $question = new Question('Please enter the name of the bundle', 'AcmeDemoBundle'); $question->setNormalizer(function ($value) { // $value can be null here return $value ? trim($value) : ''; diff --git a/components/http_kernel.rst b/components/http_kernel.rst index 5dea91c8447..4d517e51477 100644 --- a/components/http_kernel.rst +++ b/components/http_kernel.rst @@ -258,8 +258,8 @@ on the request's information. a) If the ``_controller`` key doesn't follow the recommended PHP namespace format (e.g. ``App\Controller\DefaultController::index``) its format is - transformed into it. For example, the legacy ``AppBundle:Default:index`` - format would be changed to ``Acme\AppBundle\Controller\DefaultController::indexAction``. + transformed into it. For example, the legacy ``FooBundle:Default:index`` + format would be changed to ``Acme\FooBundle\Controller\DefaultController::indexAction``. This transformation is specific to the :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver` sub-class used by the Symfony Framework. @@ -742,10 +742,10 @@ translation files, etc.) This overriding mechanism works because resources are referenced not by their physical path but by their logical path. For example, the ``services.xml`` file -stored in the ``Resources/config/`` directory of a bundle called AppBundle is -referenced as ``@AppBundle/Resources/config/services.xml``. This logical path +stored in the ``Resources/config/`` directory of a bundle called FooBundle is +referenced as ``@FooBundle/Resources/config/services.xml``. This logical path will work when the application overrides that file and even if you change the -directory of AppBundle. +directory of FooBundle. The HttpKernel component provides a method called :method:`Symfony\\Component\\HttpKernel\\Kernel::locateResource` which can be used to transform logical paths into physical paths:: @@ -754,7 +754,7 @@ which can be used to transform logical paths into physical paths:: // ... $kernel = new HttpKernel($dispatcher, $resolver); - $path = $kernel->locateResource('@AppBundle/Resources/config/services.xml'); + $path = $kernel->locateResource('@FooBundle/Resources/config/services.xml'); Learn more ---------- diff --git a/contributing/documentation/standards.rst b/contributing/documentation/standards.rst index 5145b037438..afad92c7521 100644 --- a/contributing/documentation/standards.rst +++ b/contributing/documentation/standards.rst @@ -54,8 +54,6 @@ Code Examples * The code examples should look real for a web application context. Avoid abstract or trivial examples (``foo``, ``bar``, ``demo``, etc.); * The code should follow the :doc:`Symfony Best Practices `. - Unless the example requires a custom bundle, make sure to always use the - ``AppBundle`` bundle to store your code; * Use ``Acme`` when the code requires a vendor name; * Use ``example.com`` as the domain of sample URLs and ``example.org`` and ``example.net`` when additional domains are required. All of these domains are diff --git a/doctrine/multiple_entity_managers.rst b/doctrine/multiple_entity_managers.rst index a7fa6ce29be..d59e302b1a0 100644 --- a/doctrine/multiple_entity_managers.rst +++ b/doctrine/multiple_entity_managers.rst @@ -50,12 +50,21 @@ The following configuration code shows how you can configure two entity managers default: connection: default mappings: - AppBundle: ~ - AcmeStoreBundle: ~ + Main: + is_bundle: false + type: annotation + dir: '%kernel.project_dir%/src/Entity/Main' + prefix: 'App\Entity\Main' + alias: Main customer: connection: customer mappings: - AcmeCustomerBundle: ~ + Customer: + is_bundle: false + type: annotation + dir: '%kernel.project_dir%/src/Entity/Customer' + prefix: 'App\Entity\Customer' + alias: Customer .. code-block:: xml @@ -94,12 +103,25 @@ The following configuration code shows how you can configure two entity managers - - + - + @@ -139,14 +161,25 @@ The following configuration code shows how you can configure two entity managers 'default' => array( 'connection' => 'default', 'mappings' => array( - 'AppBundle' => null, - 'AcmeStoreBundle' => null, + 'Main' => array( + is_bundle => false, + type => 'annotation', + dir => '%kernel.project_dir%/src/Entity/Main', + prefix => 'App\Entity\Main', + alias => 'Main', + ) ), ), 'customer' => array( 'connection' => 'customer', 'mappings' => array( - 'AcmeCustomerBundle' => null, + 'Customer' => array( + is_bundle => false, + type => 'annotation', + dir => '%kernel.project_dir%/src/Entity/Customer', + prefix => 'App\Entity\Customer', + alias => 'Customer', + ) ), ), ), @@ -155,8 +188,8 @@ The following configuration code shows how you can configure two entity managers In this case, you've defined two entity managers and called them ``default`` and ``customer``. The ``default`` entity manager manages entities in the -AppBundle and AcmeStoreBundle, while the ``customer`` entity manager manages -entities in the AcmeCustomerBundle. You've also defined two connections, one +``src/Entity/Main`` directory, while the ``customer`` entity manager manages +entities in ``src/Entity/Customer``. You've also defined two connections, one for each entity manager. .. note:: diff --git a/security/entity_provider.rst b/security/entity_provider.rst index f6fd17e1c64..660b9d89139 100644 --- a/security/entity_provider.rst +++ b/security/entity_provider.rst @@ -42,8 +42,8 @@ Before you begin, first make sure you install the Security component: $ composer require security -For this entry, suppose that you already have a ``User`` entity inside an -``AppBundle`` with the following fields: ``id``, ``username``, ``password``, +For this entry, suppose that you already have a ``User`` entity +with the following fields: ``id``, ``username``, ``password``, ``email`` and ``isActive``:: // src/Entity/User.php diff --git a/service_container/tags.rst b/service_container/tags.rst index 1e587630032..b2a4c038a9c 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -479,7 +479,7 @@ application handlers. .. code-block:: php // src/HandlerCollection.php - namespace AppBundle; + namespace App; class HandlerCollection {