-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Lots of automated migrations to Symfony Flex structure #8569
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -364,8 +364,7 @@ routes with UTF-8 characters: | |
|
||
.. code-block:: php-annotations | ||
|
||
// src/AppBundle/Controller/DefaultController.php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be possible to keep such comments? We can probably automatically just strip the AppBundle directory. The new one would be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I changed it everywhere, but we're in the components section, we shouldn't talk about framework conventions here. (probably, this needs to be extracted to its own subguide). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, makes sense. |
||
namespace AppBundle\Controller; | ||
namespace App\Controller; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
|
@@ -375,45 +374,42 @@ routes with UTF-8 characters: | |
/** | ||
* @Route("/category/{name}", name="route1", options={"utf8": true}) | ||
*/ | ||
public function categoryAction() | ||
public function category() | ||
{ | ||
// ... | ||
} | ||
|
||
.. code-block:: yaml | ||
|
||
# app/config/routing.yml | ||
route1: | ||
path: /category/{name} | ||
defaults: { _controller: 'AppBundle:Default:category' } | ||
defaults: { _controller: 'App\Controller\DefaultController::category' } | ||
options: | ||
utf8: true | ||
|
||
.. code-block:: xml | ||
|
||
<!-- app/config/routing.xml --> | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<routes xmlns="http://symfony.com/schema/routing" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://symfony.com/schema/routing | ||
http://symfony.com/schema/routing/routing-1.0.xsd"> | ||
|
||
<route id="route1" path="/category/{name}"> | ||
<default key="_controller">AppBundle:Default:category</default> | ||
<default key="_controller">App\Controller\DefaultController::category</default> | ||
<option key="utf8">true</option> | ||
</route> | ||
</routes> | ||
|
||
.. code-block:: php | ||
|
||
// app/config/routing.php | ||
use Symfony\Component\Routing\RouteCollection; | ||
use Symfony\Component\Routing\Route; | ||
|
||
$collection = new RouteCollection(); | ||
$collection->add('route1', new Route('/category/{name}', | ||
array( | ||
'_controller' => 'AppBundle:Default:category', | ||
'_controller' => 'App\Controller\DefaultController::category', | ||
), | ||
array(), | ||
array( | ||
|
@@ -438,8 +434,7 @@ You can also include UTF-8 strings as routing requirements: | |
|
||
.. code-block:: php-annotations | ||
|
||
// src/AppBundle/Controller/DefaultController.php | ||
namespace AppBundle\Controller; | ||
namespace App\Controller; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | ||
use Symfony\Component\Routing\Annotation\Route; | ||
|
@@ -454,48 +449,45 @@ You can also include UTF-8 strings as routing requirements: | |
* options={"utf8": true} | ||
* ) | ||
*/ | ||
public function defaultAction() | ||
public function default() | ||
{ | ||
// ... | ||
} | ||
|
||
.. code-block:: yaml | ||
|
||
# app/config/routing.yml | ||
route2: | ||
path: /default/{default} | ||
defaults: { _controller: 'AppBundle:Default:default' } | ||
defaults: { _controller: 'App\Controller\DefaultController::default' } | ||
requirements: | ||
default: "한국어" | ||
options: | ||
utf8: true | ||
|
||
.. code-block:: xml | ||
|
||
<!-- app/config/routing.xml --> | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<routes xmlns="http://symfony.com/schema/routing" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://symfony.com/schema/routing | ||
http://symfony.com/schema/routing/routing-1.0.xsd"> | ||
|
||
<route id="route2" path="/default/{default}"> | ||
<default key="_controller">AppBundle:Default:default</default> | ||
<default key="_controller">App\Controller\DefaultController::default</default> | ||
<requirement key="default">한국어</requirement> | ||
<option key="utf8">true</option> | ||
</route> | ||
</routes> | ||
|
||
.. code-block:: php | ||
|
||
// app/config/routing.php | ||
use Symfony\Component\Routing\RouteCollection; | ||
use Symfony\Component\Routing\Route; | ||
|
||
$collection = new RouteCollection(); | ||
$collection->add('route2', new Route('/default/{default}', | ||
array( | ||
'_controller' => 'AppBundle:Default:default', | ||
'_controller' => 'App\Controller\DefaultController::default', | ||
), | ||
array( | ||
'default' => '한국어', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,14 +12,12 @@ use it to create your own commands. | |
Creating a Command | ||
------------------ | ||
|
||
Commands are defined in classes which should be created in the ``Command`` namespace | ||
of your bundle (e.g. ``AppBundle\Command``) and their names should end with the | ||
``Command`` suffix. | ||
Commands are defined in classes extending | ||
:class:`Symfony\\Component\\Console\\Command\\Command`. For example, you may | ||
want a command to create a user:: | ||
|
||
For example, you may want a command to create a user:: | ||
|
||
// src/AppBundle/Command/CreateUserCommand.php | ||
namespace AppBundle\Command; | ||
// src/Command/CreateUserCommand.php | ||
namespace App\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
|
@@ -74,7 +72,7 @@ terminal: | |
|
||
.. note:: | ||
|
||
If you're using the :ref:`default services.yml configuration <service-container-services-load-example>`, | ||
If you're using the :ref:`default services.yaml configuration <service-container-services-load-example>`, | ||
your command classes are automatically registered as services. | ||
|
||
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 | |
console:: | ||
|
||
// tests/AppBundle/Command/CreateUserCommandTest.php | ||
namespace Tests\AppBundle\Command; | ||
namespace Tests\App\Command; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed (every other occurence of this as well) |
||
|
||
use AppBundle\Command\CreateUserCommand; | ||
use App\Command\CreateUserCommand; | ||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config/routes.yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted this change, the whole paragraph needs to be rewritten (and thus done in a non-automatic PR).