diff --git a/doctrine/associations.rst b/doctrine/associations.rst index 517eacf2735..80f305fffff 100644 --- a/doctrine/associations.rst +++ b/doctrine/associations.rst @@ -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, @@ -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(); @@ -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); diff --git a/doctrine/repository.rst b/doctrine/repository.rst index d92d0885c62..49acae61c96 100644 --- a/doctrine/repository.rst +++ b/doctrine/repository.rst @@ -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(); } diff --git a/http_cache/esi.rst b/http_cache/esi.rst index 512411ca57b..6276bf5110e 100644 --- a/http_cache/esi.rst +++ b/http_cache/esi.rst @@ -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 })) }} diff --git a/introduction/from_flat_php_to_symfony2.rst b/introduction/from_flat_php_to_symfony2.rst index 23a541ea46e..2fa6fef5c8e 100644 --- a/introduction/from_flat_php_to_symfony2.rst +++ b/introduction/from_flat_php_to_symfony2.rst @@ -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)); diff --git a/security/entity_provider.rst b/security/entity_provider.rst index 033f8da9ec1..a14c07efcfd 100644 --- a/security/entity_provider.rst +++ b/security/entity_provider.rst @@ -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: @@ -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 property: username # if you're using multiple entity managers # manager_name: customer @@ -225,7 +225,7 @@ the username and then check the password (more on passwords in a moment): .. code-block:: xml - + - + @@ -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( @@ -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', ), ), @@ -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. @@ -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 - + - + .. 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, ), ), ), diff --git a/security/guard_authentication.rst b/security/guard_authentication.rst index b09dbfbcd46..f197cb7797a 100644 --- a/security/guard_authentication.rst +++ b/security/guard_authentication.rst @@ -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 - + - + @@ -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, ), ), ), diff --git a/service_container.rst b/service_container.rst index 95812ec3930..12e0705ae32 100644 --- a/service_container.rst +++ b/service_container.rst @@ -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 @@ -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 @@ -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 `, +you're :ref:`loading all services from src/ `, you can use the service immediately:: use App\Updates\SiteUpdateManager; @@ -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. @@ -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 `, + If you do *not* create the alias and are :ref:`loading all services from src/ `, 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.