Skip to content

Commit 9e5cd17

Browse files
committed
Lots of automated migrations to Symfony Flex structure
1 parent 72fc15d commit 9e5cd17

File tree

160 files changed

+1530
-1540
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+1530
-1540
lines changed

bundles.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@ of the most common elements of a bundle:
151151
necessary).
152152

153153
``Resources/config/``
154-
Houses configuration, including routing configuration (e.g. ``routing.yml``).
154+
Houses configuration, including routing configuration (e.g. ``routes.yaml``).
155155

156156
``Resources/views/``
157157
Holds templates organized by controller name (e.g. ``Random/index.html.twig``).
158158

159159
``Resources/public/``
160160
Contains web assets (images, stylesheets, etc) and is copied or symbolically
161-
linked into the project ``web/`` directory via the ``assets:install`` console
161+
linked into the project ``public/`` directory via the ``assets:install`` console
162162
command.
163163

164164
``Tests/``

bundles/extension.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Other available loaders are the ``YamlFileLoader``, ``PhpFileLoader`` and
116116
.. caution::
117117

118118
If you removed the default file with service definitions (i.e.
119-
``app/config/services.yml``), make sure to also remove it from the
119+
``app/config/services.yaml``), make sure to also remove it from the
120120
``imports`` key in ``app/config/config.yml``.
121121

122122
Using Configuration to Change the Services
@@ -146,8 +146,8 @@ work in the same way, but the second one is for classes that contain PHP
146146
annotations). Define the classes to compile as an array of their fully qualified
147147
class names::
148148

149-
use AppBundle\Manager\UserManager;
150-
use AppBundle\Utils\Slugger;
149+
use App\Manager\UserManager;
150+
use App\Utils\Slugger;
151151

152152
// ...
153153
public function load(array $configs, ContainerBuilder $container)
@@ -163,7 +163,7 @@ class names::
163163

164164
// add here only classes that contain PHP annotations
165165
$this->addAnnotatedClassesToCompile(array(
166-
'AppBundle\\Controller\\DefaultController',
166+
'App\\Controller\\DefaultController',
167167
// ...
168168
));
169169
}

bundles/override.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Routing
2626

2727
Routing is never automatically imported in Symfony. If you want to include
2828
the routes from any bundle, then they must be manually imported from somewhere
29-
in your application (e.g. ``app/config/routing.yml``).
29+
in your application (e.g. ``app/config/routes.yaml``).
3030

3131
The easiest way to "override" a bundle's routing is to never import it at
3232
all. Instead of importing a third-party bundle's routing, simply copy

bundles/remove.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ that refers to the bundle.
4242
~~~~~~~~~~~~~~~~~~~~~~~~~
4343

4444
*Some* bundles require you to import routing configuration. Check for references
45-
to the bundle in ``app/config/routing.yml`` and ``app/config/routing_dev.yml``.
46-
If you find any references, remove them completely.
45+
to the bundle in the routing configuration (inside ``config/routes/``). If you
46+
find any references, remove them completely.
4747

4848
2.2 Remove Bundle Configuration
4949
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -74,8 +74,8 @@ directory, and any parent directories that are now empty (e.g. ``src/Acme/``).
7474
3.1 Remove Bundle Assets
7575
~~~~~~~~~~~~~~~~~~~~~~~~
7676

77-
Remove the assets of the bundle in the web/ directory (e.g.
78-
``web/bundles/acmedemo`` for the AcmeDemoBundle).
77+
Remove the assets of the bundle in the public/ directory (e.g.
78+
``public/bundles/acmedemo`` for the AcmeDemoBundle).
7979

8080
4. Remove Integration in other Bundles
8181
--------------------------------------

components/dependency_injection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ Loading a YAML config file::
210210

211211
$container = new ContainerBuilder();
212212
$loader = new YamlFileLoader($container, new FileLocator(__DIR__));
213-
$loader->load('services.yml');
213+
$loader->load('services.yaml');
214214

215215
.. note::
216216

components/http_foundation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ represents an HTTP message. But when moving from a legacy system, adding
285285
methods or changing some default behavior might help. In that case, register a
286286
PHP callable that is able to create an instance of your ``Request`` class::
287287

288-
use AppBundle\Http\SpecialRequest;
288+
use App\Http\SpecialRequest;
289289
use Symfony\Component\HttpFoundation\Request;
290290

291291
Request::setFactory(function (

components/routing.rst

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,7 @@ routes with UTF-8 characters:
364364

365365
.. code-block:: php-annotations
366366
367-
// src/AppBundle/Controller/DefaultController.php
368-
namespace AppBundle\Controller;
367+
namespace App\Controller;
369368
370369
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
371370
use Symfony\Component\Routing\Annotation\Route;
@@ -375,45 +374,42 @@ routes with UTF-8 characters:
375374
/**
376375
* @Route("/category/{name}", name="route1", options={"utf8": true})
377376
*/
378-
public function categoryAction()
377+
public function category()
379378
{
380379
// ...
381380
}
382381
383382
.. code-block:: yaml
384383
385-
# app/config/routing.yml
386384
route1:
387385
path: /category/{name}
388-
defaults: { _controller: 'AppBundle:Default:category' }
386+
defaults: { _controller: 'App\Controller\DefaultController::category' }
389387
options:
390388
utf8: true
391389
392390
.. code-block:: xml
393391
394-
<!-- app/config/routing.xml -->
395392
<?xml version="1.0" encoding="UTF-8" ?>
396393
<routes xmlns="http://symfony.com/schema/routing"
397394
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
398395
xsi:schemaLocation="http://symfony.com/schema/routing
399396
http://symfony.com/schema/routing/routing-1.0.xsd">
400397
401398
<route id="route1" path="/category/{name}">
402-
<default key="_controller">AppBundle:Default:category</default>
399+
<default key="_controller">App\Controller\DefaultController::category</default>
403400
<option key="utf8">true</option>
404401
</route>
405402
</routes>
406403
407404
.. code-block:: php
408405
409-
// app/config/routing.php
410406
use Symfony\Component\Routing\RouteCollection;
411407
use Symfony\Component\Routing\Route;
412408
413409
$collection = new RouteCollection();
414410
$collection->add('route1', new Route('/category/{name}',
415411
array(
416-
'_controller' => 'AppBundle:Default:category',
412+
'_controller' => 'App\Controller\DefaultController::category',
417413
),
418414
array(),
419415
array(
@@ -438,8 +434,7 @@ You can also include UTF-8 strings as routing requirements:
438434

439435
.. code-block:: php-annotations
440436
441-
// src/AppBundle/Controller/DefaultController.php
442-
namespace AppBundle\Controller;
437+
namespace App\Controller;
443438
444439
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
445440
use Symfony\Component\Routing\Annotation\Route;
@@ -454,48 +449,45 @@ You can also include UTF-8 strings as routing requirements:
454449
* options={"utf8": true}
455450
* )
456451
*/
457-
public function defaultAction()
452+
public function default()
458453
{
459454
// ...
460455
}
461456
462457
.. code-block:: yaml
463458
464-
# app/config/routing.yml
465459
route2:
466460
path: /default/{default}
467-
defaults: { _controller: 'AppBundle:Default:default' }
461+
defaults: { _controller: 'App\Controller\DefaultController::default' }
468462
requirements:
469463
default: "한국어"
470464
options:
471465
utf8: true
472466
473467
.. code-block:: xml
474468
475-
<!-- app/config/routing.xml -->
476469
<?xml version="1.0" encoding="UTF-8" ?>
477470
<routes xmlns="http://symfony.com/schema/routing"
478471
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
479472
xsi:schemaLocation="http://symfony.com/schema/routing
480473
http://symfony.com/schema/routing/routing-1.0.xsd">
481474
482475
<route id="route2" path="/default/{default}">
483-
<default key="_controller">AppBundle:Default:default</default>
476+
<default key="_controller">App\Controller\DefaultController::default</default>
484477
<requirement key="default">한국어</requirement>
485478
<option key="utf8">true</option>
486479
</route>
487480
</routes>
488481
489482
.. code-block:: php
490483
491-
// app/config/routing.php
492484
use Symfony\Component\Routing\RouteCollection;
493485
use Symfony\Component\Routing\Route;
494486
495487
$collection = new RouteCollection();
496488
$collection->add('route2', new Route('/default/{default}',
497489
array(
498-
'_controller' => 'AppBundle:Default:default',
490+
'_controller' => 'App\Controller\DefaultController::default',
499491
),
500492
array(
501493
'default' => '한국어',

configuration/front_controllers_and_kernel.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ The Front Controller
3030
The `front controller`_ is a well-known design pattern; it is a section of
3131
code that *all* requests served by an application run through.
3232

33-
In the `Symfony Standard Edition`_, this role is taken by the `app.php`_
34-
and `app_dev.php`_ files in the ``web/`` directory. These are the very
35-
first PHP scripts executed when a request is processed.
33+
In the `Symfony Standard Edition`_, this role is taken by the `index.php`_ file
34+
in the ``public/`` directory. This is the very first PHP script executed when a
35+
request is processed.
3636

3737
The main purpose of the front controller is to create an instance of the
3838
``AppKernel`` (more on that in a second), make it handle the request

console.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ use it to create your own commands.
1212
Creating a Command
1313
------------------
1414

15-
Commands are defined in classes which should be created in the ``Command`` namespace
16-
of your bundle (e.g. ``AppBundle\Command``) and their names should end with the
17-
``Command`` suffix.
15+
Commands are defined in classes extending
16+
:class:`Symfony\\Component\\Console\\Command\\Command`. For example, you may
17+
want a command to create a user::
1818

19-
For example, you may want a command to create a user::
20-
21-
// src/AppBundle/Command/CreateUserCommand.php
22-
namespace AppBundle\Command;
19+
// src/Command/CreateUserCommand.php
20+
namespace App\Command;
2321

2422
use Symfony\Component\Console\Command\Command;
2523
use Symfony\Component\Console\Input\InputInterface;
@@ -74,7 +72,7 @@ terminal:
7472
7573
.. note::
7674

77-
If you're using the :ref:`default services.yml configuration <service-container-services-load-example>`,
75+
If you're using the :ref:`default services.yaml configuration <service-container-services-load-example>`,
7876
your command classes are automatically registered as services.
7977

8078
You can also manually register your command as a service by configuring the service
@@ -229,9 +227,9 @@ class. It uses special input and output classes to ease testing without a real
229227
console::
230228

231229
// tests/AppBundle/Command/CreateUserCommandTest.php
232-
namespace Tests\AppBundle\Command;
230+
namespace Tests\App\Command;
233231

234-
use AppBundle\Command\CreateUserCommand;
232+
use App\Command\CreateUserCommand;
235233
use Symfony\Bundle\FrameworkBundle\Console\Application;
236234
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
237235
use Symfony\Component\Console\Tester\CommandTester;

console/command_in_controller.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Imagine you want to send spooled Swift Mailer messages by
2424
:doc:`using the swiftmailer:spool:send command </email/spool>`.
2525
Run this command from inside your controller via::
2626

27-
// src/AppBundle/Controller/SpoolController.php
28-
namespace AppBundle\Controller;
27+
// src/Controller/SpoolController.php
28+
namespace App\Controller;
2929

3030
use Symfony\Bundle\FrameworkBundle\Console\Application;
3131
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
@@ -76,8 +76,8 @@ First, require the package:
7676
7777
Now, use it in your controller::
7878

79-
// src/AppBundle/Controller/SpoolController.php
80-
namespace AppBundle\Controller;
79+
// src/Controller/SpoolController.php
80+
namespace App\Controller;
8181

8282
use SensioLabs\AnsiConverter\AnsiToHtmlConverter;
8383
use Symfony\Component\Console\Output\BufferedOutput;

console/commands_as_services.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
How to Define Commands as Services
55
==================================
66

7-
If you're using the :ref:`default services.yml configuration <service-container-services-load-example>`,
7+
If you're using the :ref:`default services.yaml configuration <service-container-services-load-example>`,
88
your command classes are already registered as services. Great! This is the
99
recommended setup.
1010

@@ -26,7 +26,7 @@ using normal :ref:`dependency injection <services-constructor-injection>`.
2626

2727
For example, suppose you want to log something from within your command::
2828

29-
namespace AppBundle\Command;
29+
namespace App\Command;
3030

3131
use Psr\Log\LoggerInterface;
3232
use Symfony\Component\Console\Command\Command;
@@ -59,7 +59,7 @@ For example, suppose you want to log something from within your command::
5959
}
6060
}
6161

62-
If you're using the :ref:`default services.yml configuration <service-container-services-load-example>`,
62+
If you're using the :ref:`default services.yaml configuration <service-container-services-load-example>`,
6363
the command class will automatically be registered as a service and passed the ``$logger``
6464
argument (thanks to autowiring). In other words, *just* by creating this class, everything
6565
works! You can call the ``app:sunshine`` command and start logging.
@@ -96,7 +96,7 @@ Or set the ``command`` attribute on the ``console.command`` tag in your service
9696
9797
services:
9898
99-
AppBundle\Command\SunshineCommand:
99+
App\Command\SunshineCommand:
100100
tags:
101101
- { name: 'console.command', command: 'app:sunshine' }
102102
# ...
@@ -110,7 +110,7 @@ Or set the ``command`` attribute on the ``console.command`` tag in your service
110110
111111
<services>
112112
113-
<service id="AppBundle\Command\SunshineCommand">
113+
<service id="App\Command\SunshineCommand">
114114
<tag name="console.command" command="app:sunshine" />
115115
</service>
116116
@@ -119,7 +119,7 @@ Or set the ``command`` attribute on the ``console.command`` tag in your service
119119
120120
.. code-block:: php
121121
122-
use AppBundle\Command\SunshineCommand;
122+
use App\Command\SunshineCommand;
123123
124124
//...
125125

console/hide_commands.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ executed through scheduled tasks, etc.
1111
In those cases, you can define the command as **hidden** by setting the
1212
``setHidden()`` method to ``true`` in the command configuration::
1313

14-
// src/AppBundle/Command/LegacyCommand.php
15-
namespace AppBundle\Command;
14+
// src/Command/LegacyCommand.php
15+
namespace App\Command;
1616

1717
use Symfony\Component\Console\Command\Command;
1818

console/lazy_commands.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The traditional way of adding commands to your application is to use
1616
In order to lazy-load commands, you need to register an intermediate loader
1717
which will be responsible for returning ``Command`` instances::
1818

19-
use AppBundle\Command\HeavyCommand;
19+
use App\Command\HeavyCommand;
2020
use Symfony\Component\Console\Application;
2121
use Symfony\Component\Console\CommandLoader\FactoryCommmandLoader;
2222

console/request_context.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Configuring the Request Context per Command
6565
To change it only in one command you can simply fetch the Request Context
6666
from the ``router`` service and override its settings::
6767

68-
// src/AppBundle/Command/DemoCommand.php
68+
// src/Command/DemoCommand.php
6969

7070
// ...
7171
class DemoCommand extends ContainerAwareCommand

0 commit comments

Comments
 (0)