Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit24b8c59

Browse files
committed
Remove AppBundle approach
1 parent66bb046 commit24b8c59

File tree

7 files changed

+35
-31
lines changed

7 files changed

+35
-31
lines changed

‎doctrine/associations.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ the class for you.
1515
..code-block::terminal
1616
1717
$ php bin/console doctrine:generate:entity --no-interaction \
18-
--entity="AppBundle:Category" \
18+
--entity="App:Category" \
1919
--fields="name:string(255)"
2020
2121
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.
332332

333333
$category = $product->getCategory();
334334

335-
// prints "Proxies\AppBundleEntityCategoryProxy"
335+
// prints "Proxies\AppEntityCategoryProxy"
336336
dump(get_class($category));
337337
die();
338338

@@ -370,7 +370,7 @@ following method to the ``ProductRepository`` class::
370370
{
371371
$query = $this->getEntityManager()
372372
->createQuery(
373-
'SELECT p, c FROMAppBundle:Product p
373+
'SELECT p, c FROMApp:Product p
374374
JOIN p.category c
375375
WHERE p.id = :id'
376376
)->setParameter('id', $productId);

‎doctrine/repository.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ entities, ordered alphabetically by name.
7373
{
7474
return $this->getEntityManager()
7575
->createQuery(
76-
'SELECT p FROMAppBundle:Product p ORDER BY p.name ASC'
76+
'SELECT p FROMApp:Product p ORDER BY p.name ASC'
7777
)
7878
->getResult();
7979
}

‎http_cache/esi.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ matter), Symfony uses the standard ``render`` helper to configure ESI tags:
129129
{# templates/static/about.html.twig #}
130130
131131
{# you can use a controller reference #}
132-
{{ render_esi(controller('AppBundle:News:latest', { 'maxPerPage': 5 })) }}
132+
{{ render_esi(controller('App\Controller\NewsController::latest', { 'maxPerPage': 5 })) }}
133133
134134
{# ... or a URL #}
135135
{{ render_esi(url('latest_news', { 'maxPerPage': 5 })) }}

‎introduction/from_flat_php_to_symfony2.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ them for you. Here's the same sample application, now built in Symfony::
553553
{
554554
$posts = $this->getDoctrine()
555555
->getManager()
556-
->createQuery('SELECT p FROMAppBundle:Post p')
556+
->createQuery('SELECT p FROMApp:Post p')
557557
->execute();
558558

559559
return $this->render('Blog/list.html.php', array('posts' => $posts));

‎security/entity_provider.rst‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ the username and then check the password (more on passwords in a moment):
199199

200200
..code-block::yaml
201201
202-
#app/config/security.yml
202+
# config/packages/security.yaml
203203
security:
204204
encoders:
205205
App\Entity\User:
@@ -210,7 +210,7 @@ the username and then check the password (more on passwords in a moment):
210210
providers:
211211
our_db_provider:
212212
entity:
213-
class:AppBundle:User
213+
class:App\Entity\User
214214
property:username
215215
# if you're using multiple entity managers
216216
# manager_name: customer
@@ -225,7 +225,7 @@ the username and then check the password (more on passwords in a moment):
225225
226226
..code-block::xml
227227
228-
<!--app/config/security.xml-->
228+
<!-- config/packages/security.xml-->
229229
<?xml version="1.0" encoding="UTF-8"?>
230230
<srv:containerxmlns="http://symfony.com/schema/dic/security"
231231
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -241,7 +241,7 @@ the username and then check the password (more on passwords in a moment):
241241
<providername="our_db_provider">
242242
<!-- if you're using multiple entity managers, add:
243243
manager-name="customer"-->
244-
<entityclass="AppBundle:User"property="username" />
244+
<entityclass="App\Entity\User"property="username" />
245245
</provider>
246246
247247
<firewallname="main"pattern="^/"provider="our_db_provider">
@@ -254,7 +254,7 @@ the username and then check the password (more on passwords in a moment):
254254
255255
..code-block::php
256256
257-
//app/config/security.php
257+
// config/packages/security.php
258258
use App\Entity\User;
259259
260260
$container->loadFromExtension('security', array(
@@ -269,7 +269,7 @@ the username and then check the password (more on passwords in a moment):
269269
'providers' => array(
270270
'our_db_provider' => array(
271271
'entity' => array(
272-
'class' =>'AppBundle:User',
272+
'class' => User::class,
273273
'property' => 'username',
274274
),
275275
),
@@ -288,7 +288,7 @@ the username and then check the password (more on passwords in a moment):
288288
First, the ``encoders`` section tells Symfony to expect that the passwords
289289
in the database will be encoded using ``bcrypt``. Second, the ``providers``
290290
section creates a "user provider" called ``our_db_provider`` that knows to
291-
query from your ``AppBundle:User`` entity by the ``username`` property. The
291+
query from your ``App\Entity\User`` entity by the ``username`` property. The
292292
name ``our_db_provider`` isn't important: it just needs to match the value
293293
of the ``provider`` key under your firewall. Or, if you don't set the ``provider``
294294
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
458458

459459
..code-block::yaml
460460
461-
#app/config/security.yml
461+
# config/packages/security.yaml
462462
security:
463463
# ...
464464
465465
providers:
466466
our_db_provider:
467467
entity:
468-
class:AppBundle:User
468+
class:App\Entity\User
469469
470470
..code-block::xml
471471
472-
<!--app/config/security.xml-->
472+
<!-- config/packages/security.xml-->
473473
<?xml version="1.0" encoding="UTF-8"?>
474474
<srv:containerxmlns="http://symfony.com/schema/dic/security"
475475
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -481,21 +481,23 @@ To finish this, just remove the ``property`` key from the user provider in
481481
<!-- ...-->
482482
483483
<providername="our_db_provider">
484-
<entityclass="AppBundle:User" />
484+
<entityclass="App\Entity\User" />
485485
</provider>
486486
</config>
487487
</srv:container>
488488
489489
..code-block::php
490490
491-
// app/config/security.php
491+
// config/packages/security.php
492+
use App\Entity\User;
493+
492494
$container->loadFromExtension('security', array(
493495
// ...
494496
495497
'providers' => array(
496498
'our_db_provider' => array(
497499
'entity' => array(
498-
'class' =>'AppBundle:User',
500+
'class' => User::class,
499501
),
500502
),
501503
),

‎security/guard_authentication.rst‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,21 @@ Next, make sure you've configured a "user provider" for the user:
8383

8484
..code-block::yaml
8585
86-
#app/config/security.yml
86+
# config/packages/security.yaml
8787
security:
8888
# ...
8989
9090
providers:
9191
your_db_provider:
9292
entity:
93-
class:AppBundle:User
93+
class:App\Entity\User
9494
property:apiKey
9595
9696
# ...
9797
9898
..code-block::xml
9999
100-
<!--app/config/security.xml-->
100+
<!-- config/packages/security.xml-->
101101
<?xml version="1.0" encoding="UTF-8"?>
102102
<srv:containerxmlns="http://symfony.com/schema/dic/security"
103103
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -109,7 +109,7 @@ Next, make sure you've configured a "user provider" for the user:
109109
<!-- ...-->
110110
111111
<providername="your_db_provider">
112-
<entityclass="AppBundle:User" />
112+
<entityclass="App\Entity\User" />
113113
</provider>
114114
115115
<!-- ...-->
@@ -118,14 +118,16 @@ Next, make sure you've configured a "user provider" for the user:
118118
119119
..code-block::php
120120
121-
// app/config/security.php
121+
// config/packages/security.php
122+
use App\Entity\User;
123+
122124
$container->loadFromExtension('security', array(
123125
// ...
124126
125127
'providers' => array(
126128
'your_db_provider' => array(
127129
'entity' => array(
128-
'class' =>'AppBundle:User',
130+
'class' => User::class,
129131
),
130132
),
131133
),

‎service_container.rst‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ each time you ask for it.
183183
autoconfigure:true
184184
public:false
185185
186-
# makes classes in src/AppBundle available to be used as services
186+
# makes classes in src/ available to be used as services
187187
App\:
188188
resource:'../../src/*'
189189
# you can exclude directories or files
@@ -231,7 +231,7 @@ each time you ask for it.
231231
`glob pattern`_.
232232

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

237237
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::
363363
}
364364

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

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

923923
..note::
924924

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

10371037
..caution::
10381038

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp