Skip to content

Removing more AppBundle #8799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bundles/best_practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -454,15 +454,15 @@ 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`
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
----------
Expand Down
2 changes: 1 addition & 1 deletion bundles/override.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <http-kernel-resource-locator>`
to turn them into physical paths when needed.

Expand Down
2 changes: 1 addition & 1 deletion components/console/helpers/questionhelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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) : '';
Expand Down
12 changes: 6 additions & 6 deletions components/http_kernel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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::
Expand All @@ -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
----------
Expand Down
2 changes: 0 additions & 2 deletions contributing/documentation/standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 </best_practices/introduction>`.
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
Expand Down
55 changes: 44 additions & 11 deletions doctrine/multiple_entity_managers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -94,12 +103,25 @@ The following configuration code shows how you can configure two entity managers

<doctrine:orm default-entity-manager="default">
<doctrine:entity-manager name="default" connection="default">
<doctrine:mapping name="AppBundle" />
<doctrine:mapping name="AcmeStoreBundle" />
<doctrine:mapping
name="Main"
is_bundle="false"
type="annotation"
dir="%kernel.project_dir%/src/Entity/Main"
prefix="App\Entity\Main"
alias="Main"
/>
</doctrine:entity-manager>

<doctrine:entity-manager name="customer" connection="customer">
<doctrine:mapping name="AcmeCustomerBundle" />
<doctrine:mapping
name="Customer"
is_bundle="false"
type="annotation"
dir="%kernel.project_dir%/src/Entity/Customer"
prefix="App\Entity\Customer"
alias="Customer"
/>
</doctrine:entity-manager>
</doctrine:orm>
</doctrine:config>
Expand Down Expand Up @@ -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',
)
),
),
),
Expand All @@ -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::
Expand Down
4 changes: 2 additions & 2 deletions security/entity_provider.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion service_container/tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ application handlers.
.. code-block:: php

// src/HandlerCollection.php
namespace AppBundle;
namespace App;

class HandlerCollection
{
Expand Down