Skip to content

Removing a bit more of AppBundle everywhere #8631

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

Merged
merged 1 commit into from
Nov 14, 2017
Merged
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
6 changes: 3 additions & 3 deletions doctrine/associations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ the class for you.
.. code-block:: terminal
$ php bin/console doctrine:generate:entity --no-interaction \
--entity="AppBundle:Category" \
--entity="App:Category" \
--fields="name:string(255)"
This command generates the ``Category`` entity for you, with an ``id`` field,
Expand Down Expand Up @@ -332,7 +332,7 @@ to the given ``Category`` object via their ``category_id`` value.

$category = $product->getCategory();

// prints "Proxies\AppBundleEntityCategoryProxy"
// prints "Proxies\AppEntityCategoryProxy"
dump(get_class($category));
die();

Expand Down Expand Up @@ -370,7 +370,7 @@ following method to the ``ProductRepository`` class::
{
$query = $this->getEntityManager()
->createQuery(
'SELECT p, c FROM AppBundle:Product p
'SELECT p, c FROM App:Product p
JOIN p.category c
WHERE p.id = :id'
)->setParameter('id', $productId);
Expand Down
2 changes: 1 addition & 1 deletion doctrine/repository.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ entities, ordered alphabetically by name.
{
return $this->getEntityManager()
->createQuery(
'SELECT p FROM AppBundle:Product p ORDER BY p.name ASC'
'SELECT p FROM App:Product p ORDER BY p.name ASC'
)
->getResult();
}
Expand Down
2 changes: 1 addition & 1 deletion http_cache/esi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ matter), Symfony uses the standard ``render`` helper to configure ESI tags:
{# templates/static/about.html.twig #}
{# you can use a controller reference #}
{{ render_esi(controller('AppBundle:News:latest', { 'maxPerPage': 5 })) }}
{{ render_esi(controller('App\Controller\NewsController::latest', { 'maxPerPage': 5 })) }}
{# ... or a URL #}
{{ render_esi(url('latest_news', { 'maxPerPage': 5 })) }}
Expand Down
2 changes: 1 addition & 1 deletion introduction/from_flat_php_to_symfony2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ them for you. Here's the same sample application, now built in Symfony::
{
$posts = $this->getDoctrine()
->getManager()
->createQuery('SELECT p FROM AppBundle:Post p')
->createQuery('SELECT p FROM App:Post p')
->execute();

return $this->render('Blog/list.html.php', array('posts' => $posts));
Expand Down
28 changes: 15 additions & 13 deletions security/entity_provider.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ the username and then check the password (more on passwords in a moment):

.. code-block:: yaml
# app/config/security.yml
# config/packages/security.yaml
security:
encoders:
App\Entity\User:
Expand All @@ -210,7 +210,7 @@ the username and then check the password (more on passwords in a moment):
providers:
our_db_provider:
entity:
class: AppBundle:User
class: App\Entity\User
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

App:User ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See related discussion #8579 (comment)

property: username
# if you're using multiple entity managers
# manager_name: customer
Expand All @@ -225,7 +225,7 @@ the username and then check the password (more on passwords in a moment):
.. code-block:: xml
<!-- app/config/security.xml -->
<!-- config/packages/security.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<srv:container xmlns="http://symfony.com/schema/dic/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -241,7 +241,7 @@ the username and then check the password (more on passwords in a moment):
<provider name="our_db_provider">
<!-- if you're using multiple entity managers, add:
manager-name="customer" -->
<entity class="AppBundle:User" property="username" />
<entity class="App\Entity\User" property="username" />
</provider>
<firewall name="main" pattern="^/" provider="our_db_provider">
Expand All @@ -254,7 +254,7 @@ the username and then check the password (more on passwords in a moment):
.. code-block:: php
// app/config/security.php
// config/packages/security.php
use App\Entity\User;
$container->loadFromExtension('security', array(
Expand All @@ -269,7 +269,7 @@ the username and then check the password (more on passwords in a moment):
'providers' => array(
'our_db_provider' => array(
'entity' => array(
'class' => 'AppBundle:User',
'class' => User::class,
'property' => 'username',
),
),
Expand All @@ -288,7 +288,7 @@ the username and then check the password (more on passwords in a moment):
First, the ``encoders`` section tells Symfony to expect that the passwords
in the database will be encoded using ``bcrypt``. Second, the ``providers``
section creates a "user provider" called ``our_db_provider`` that knows to
query from your ``AppBundle:User`` entity by the ``username`` property. The
query from your ``App\Entity\User`` entity by the ``username`` property. The
name ``our_db_provider`` isn't important: it just needs to match the value
of the ``provider`` key under your firewall. Or, if you don't set the ``provider``
key under your firewall, the first "user provider" is automatically used.
Expand Down Expand Up @@ -458,18 +458,18 @@ To finish this, just remove the ``property`` key from the user provider in

.. code-block:: yaml
# app/config/security.yml
# config/packages/security.yaml
security:
# ...
providers:
our_db_provider:
entity:
class: AppBundle:User
class: App\Entity\User
.. code-block:: xml
<!-- app/config/security.xml -->
<!-- config/packages/security.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<srv:container xmlns="http://symfony.com/schema/dic/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -481,21 +481,23 @@ To finish this, just remove the ``property`` key from the user provider in
<!-- ... -->
<provider name="our_db_provider">
<entity class="AppBundle:User" />
<entity class="App\Entity\User" />
</provider>
</config>
</srv:container>
.. code-block:: php
// app/config/security.php
// config/packages/security.php
use App\Entity\User;
$container->loadFromExtension('security', array(
// ...
'providers' => array(
'our_db_provider' => array(
'entity' => array(
'class' => 'AppBundle:User',
'class' => User::class,
),
),
),
Expand Down
14 changes: 8 additions & 6 deletions security/guard_authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,21 @@ Next, make sure you've configured a "user provider" for the user:

.. code-block:: yaml
# app/config/security.yml
# config/packages/security.yaml
security:
# ...
providers:
your_db_provider:
entity:
class: AppBundle:User
class: App\Entity\User
property: apiKey
# ...
.. code-block:: xml
<!-- app/config/security.xml -->
<!-- config/packages/security.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<srv:container xmlns="http://symfony.com/schema/dic/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -109,7 +109,7 @@ Next, make sure you've configured a "user provider" for the user:
<!-- ... -->
<provider name="your_db_provider">
<entity class="AppBundle:User" />
<entity class="App\Entity\User" />
</provider>
<!-- ... -->
Expand All @@ -118,14 +118,16 @@ Next, make sure you've configured a "user provider" for the user:
.. code-block:: php
// app/config/security.php
// config/packages/security.php
use App\Entity\User;
$container->loadFromExtension('security', array(
// ...
'providers' => array(
'your_db_provider' => array(
'entity' => array(
'class' => 'AppBundle:User',
'class' => User::class,
),
),
),
Expand Down
12 changes: 6 additions & 6 deletions service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ each time you ask for it.
autoconfigure: true
public: false
# makes classes in src/AppBundle available to be used as services
# makes classes in src/ available to be used as services
App\:
resource: '../../src/*'
# you can exclude directories or files
Expand Down Expand Up @@ -231,7 +231,7 @@ each time you ask for it.
`glob pattern`_.

Thanks to this configuration, you can automatically use any classes from the
``src/AppBundle`` directory as a service, without needing to manually configure
``src/`` directory as a service, without needing to manually configure
it. Later, you'll learn more about this in :ref:`service-psr4-loader`.

If you'd prefer to manually wire your service, that's totally possible: see
Expand Down Expand Up @@ -363,7 +363,7 @@ made. To do that, you create a new class::
}

This uses the ``MessageGenerator`` *and* the ``Swift_Mailer`` service. As long as
you're :ref:`loading all services from src/AppBundle <service-container-services-load-example>`,
you're :ref:`loading all services from src/ <service-container-services-load-example>`,
you can use the service immediately::

use App\Updates\SiteUpdateManager;
Expand Down Expand Up @@ -922,11 +922,11 @@ them will not cause the container to be rebuilt.

.. note::

Wait, does this mean that *every* class in ``src/AppBundle`` is registered as
Wait, does this mean that *every* class in ``src/`` is registered as
a service? Even model or entity classes? Actually, no. As long as you have
``public: false`` under your ``_defaults`` key (or you can add it under the
specific import), all the imported services are *private*. Thanks to this, all
classes in ``src/AppBundle`` that are *not* explicitly used as services are
classes in ``src/`` that are *not* explicitly used as services are
automatically removed from the final container. In reality, the import simply
means that all classes are "available to be *used* as services" without needing
to be manually configured.
Expand Down Expand Up @@ -1036,7 +1036,7 @@ If you want to pass the second, you'll need to :ref:`manually wire the service <

.. caution::

If you do *not* create the alias and are :ref:`loading all services from src/AppBundle <service-container-services-load-example>`,
If you do *not* create the alias and are :ref:`loading all services from src/ <service-container-services-load-example>`,
then *three* services have been created (the automatic service + your two services)
and the automatically loaded service will be passed - by default - when you type-hint
``SiteUpdateManager``. That's why creating the alias is a good idea.
Expand Down