Skip to content

Migrating to Symfony Flex structure #8593

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 10, 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
10 changes: 5 additions & 5 deletions _includes/service_container/_my_mailer.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

.. code-block:: yaml

# app/config/services.yml
# config/services.yaml
services:
app.mailer:
class: AppBundle\Mailer
class: App\Mailer
arguments: [sendmail]

.. code-block:: xml
Expand All @@ -18,16 +18,16 @@
http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="app.mailer" class="AppBundle\Mailer">
<service id="app.mailer" class="App\Mailer">
<argument>sendmail</argument>
</service>
</services>
</container>

.. code-block:: php

// app/config/services.php
use AppBundle\Mailer;
// config/services.php
use App\Mailer;

$container->register('app.mailer', Mailer::class)
->addArgument('sendmail');
8 changes: 4 additions & 4 deletions best_practices/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ option for a value that you are never going to configure just isn't necessary.
Our recommendation is to define these values as constants in your application.
You could, for example, define a ``NUM_ITEMS`` constant in the ``Post`` entity::

// src/AppBundle/Entity/Post.php
namespace AppBundle\Entity;
// src/Entity/Post.php
namespace App\Entity;

class Post
{
Expand All @@ -137,10 +137,10 @@ whereas they cannot access the container parameters:

.. code-block:: php

namespace AppBundle\Repository;
namespace App\Repository;

use App\Entity\Post;
use Doctrine\ORM\EntityRepository;
use AppBundle\Entity\Post;

class PostRepository extends EntityRepository
{
Expand Down
6 changes: 3 additions & 3 deletions best_practices/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Then, create a new ``Markdown`` class that will be used later by the Twig
extension. It just needs to define one single method to transform
Markdown content into HTML::

namespace AppBundle\Utils;
namespace App\Utils;

class Markdown
{
Expand All @@ -100,9 +100,9 @@ class in the constructor of the Twig extension:

.. code-block:: php

namespace AppBundle\Twig;
namespace App\Twig;

use AppBundle\Utils\Markdown;
use App\Utils\Markdown;

class AppExtension extends \Twig_Extension
{
Expand Down
2 changes: 1 addition & 1 deletion controller/service.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Invokable Controllers

If your controller implements the ``__invoke()`` method - popular with the
Action-Domain-Response (ADR) pattern, you can simply refer to the service id
(``AppBundle\Controller\HelloController`` or ``app.hello_controller`` for example).
(``App\Controller\HelloController`` or ``app.hello_controller`` for example).

Alternatives to base Controller Methods
---------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Creating an Entity Class
Suppose you're building an application where products need to be displayed.
Without even thinking about Doctrine or databases, you already know that
you need a ``Product`` object to represent those products. Create this class
inside the ``Entity`` directory of your AppBundle::
inside the ``Entity`` directory of your ``src``::

// src/Entity/Product.php
namespace App\Entity;
Expand Down Expand Up @@ -617,8 +617,8 @@ repository object for an entity class via::

.. note::

You can also use ``AppBundle:Product`` syntax. This string is a shortcut you can use anywhere
in Doctrine instead of the full class name of the entity (i.e. ``AppBundle\Entity\Product``).
You can also use ``App:Product`` syntax. This string is a shortcut you can use anywhere
in Doctrine instead of the full class name of the entity (i.e. ``App\Entity\Product``).
As long as your entity lives under the ``Entity`` namespace of your bundle,
this will work.

Expand Down Expand Up @@ -754,7 +754,7 @@ SQL-like language, to construct a query for this scenario::

$query = $em->createQuery(
'SELECT p
FROM AppBundle:Product p
FROM App:Product p
WHERE p.price > :price
ORDER BY p.price ASC'
)->setParameter('price', 19.99);
Expand All @@ -764,8 +764,8 @@ SQL-like language, to construct a query for this scenario::
If you're comfortable with SQL, then DQL should feel very natural. The biggest
difference is that you need to think in terms of selecting PHP objects,
instead of rows in a database. For this reason, you select *from* the
``AppBundle:Product`` *entity* (an optional shortcut for the
``AppBundle\Entity\Product`` class) and then alias it as ``p``.
``App:Product`` *entity* (an optional shortcut for the
``App\Entity\Product`` class) and then alias it as ``p``.

.. tip::

Expand Down Expand Up @@ -794,7 +794,7 @@ DQL as you start to concatenate strings::
$repository = $this->getDoctrine()
->getRepository(Product::class);

// createQueryBuilder() automatically selects FROM AppBundle:Product
// createQueryBuilder() automatically selects FROM App:Product
// and aliases it to "p"
$query = $repository->createQueryBuilder('p')
->where('p.price > :price')
Expand Down
2 changes: 1 addition & 1 deletion forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ the choice is ultimately up to you.
.. sidebar:: Setting the ``data_class``

Every form needs to know the name of the class that holds the underlying
data (e.g. ``AppBundle\Entity\Task``). Usually, this is just guessed
data (e.g. ``App\Entity\Task``). Usually, this is just guessed
based off of the object passed to the second argument to ``createForm()``
(i.e. ``$task``). Later, when you begin embedding forms, this will no
longer be sufficient. So, while not always necessary, it's generally a
Expand Down
16 changes: 8 additions & 8 deletions reference/constraints/All.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ entry in that array:

.. code-block:: php-annotations

// src/AppBundle/Entity/User.php
namespace AppBundle\Entity;
// src/Entity/User.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

Expand All @@ -43,8 +43,8 @@ entry in that array:

.. code-block:: yaml

# src/AppBundle/Resources/config/validation.yml
AppBundle\Entity\User:
# src/Resources/config/validation.yml
App\Entity\User:
properties:
favoriteColors:
- All:
Expand All @@ -54,13 +54,13 @@ entry in that array:

.. code-block:: xml

<!-- src/AppBundle/Resources/config/validation.xml -->
<!-- src/Resources/config/validation.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="AppBundle\Entity\User">
<class name="App\Entity\User">
<property name="favoriteColors">
<constraint name="All">
<option name="constraints">
Expand All @@ -76,8 +76,8 @@ entry in that array:

.. code-block:: php

// src/AppBundle/Entity/User.php
namespace AppBundle\Entity;
// src/Entity/User.php
namespace App\Entity;

use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints as Assert;
Expand Down
16 changes: 8 additions & 8 deletions reference/constraints/Bic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ will contain a Business Identifier Code (BIC).

.. code-block:: php-annotations

// src/AppBundle/Entity/Transaction.php
namespace AppBundle\Entity;
// src/Entity/Transaction.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

Expand All @@ -41,21 +41,21 @@ will contain a Business Identifier Code (BIC).

.. code-block:: yaml

# src/AppBundle/Resources/config/validation.yml
AppBundle\Entity\Transaction:
# src/Resources/config/validation.yml
App\Entity\Transaction:
properties:
businessIdentifierCode:
- Bic: ~

.. code-block:: xml

<!-- src/AppBundle/Resources/config/validation.xml -->
<!-- src/Resources/config/validation.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="AppBundle\Entity\Transaction">
<class name="App\Entity\Transaction">
<property name="businessIdentifierCode">
<constraint name="Bic" />
</property>
Expand All @@ -64,8 +64,8 @@ will contain a Business Identifier Code (BIC).

.. code-block:: php

// src/AppBundle/Entity/Transaction.php
namespace AppBundle\Entity;
// src/Entity/Transaction.php
namespace App\Entity;

use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints as Assert;
Expand Down
16 changes: 8 additions & 8 deletions reference/constraints/Blank.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ of an ``Author`` class were blank, you could do the following:

.. code-block:: php-annotations

// src/AppBundle/Entity/Author.php
namespace AppBundle\Entity;
// src/Entity/Author.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

Expand All @@ -50,21 +50,21 @@ of an ``Author`` class were blank, you could do the following:

.. code-block:: yaml

# src/AppBundle/Resources/config/validation.yml
AppBundle\Entity\Author:
# src/Resources/config/validation.yml
App\Entity\Author:
properties:
firstName:
- Blank: ~

.. code-block:: xml

<!-- src/AppBundle/Resources/config/validation.xml -->
<!-- src/Resources/config/validation.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="AppBundle\Entity\Author">
<class name="App\Entity\Author">
<property name="firstName">
<constraint name="Blank" />
</property>
Expand All @@ -73,8 +73,8 @@ of an ``Author`` class were blank, you could do the following:

.. code-block:: php

// src/AppBundle/Entity/Author.php
namespace AppBundle\Entity;
// src/Entity/Author.php
namespace App\Entity;

use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints as Assert;
Expand Down
36 changes: 18 additions & 18 deletions reference/constraints/Callback.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Configuration

.. code-block:: php-annotations

// src/AppBundle/Entity/Author.php
namespace AppBundle\Entity;
// src/Entity/Author.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
Expand All @@ -54,28 +54,28 @@ Configuration

.. code-block:: yaml

# src/AppBundle/Resources/config/validation.yml
AppBundle\Entity\Author:
# src/Resources/config/validation.yml
App\Entity\Author:
constraints:
- Callback: validate

.. code-block:: xml

<!-- src/AppBundle/Resources/config/validation.xml -->
<!-- src/Resources/config/validation.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="AppBundle\Entity\Author">
<class name="App\Entity\Author">
<constraint name="Callback">validate</constraint>
</class>
</constraint-mapping>

.. code-block:: php

// src/AppBundle/Entity/Author.php
namespace AppBundle\Entity;
// src/Entity/Author.php
namespace App\Entity;

use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints as Assert;
Expand Down Expand Up @@ -163,8 +163,8 @@ You can then use the following configuration to invoke this validator:

.. code-block:: php-annotations

// src/AppBundle/Entity/Author.php
namespace AppBundle\Entity;
// src/Entity/Author.php
namespace App\Entity;

use Symfony\Component\Validator\Constraints as Assert;

Expand All @@ -177,20 +177,20 @@ You can then use the following configuration to invoke this validator:

.. code-block:: yaml

# src/AppBundle/Resources/config/validation.yml
AppBundle\Entity\Author:
# src/Resources/config/validation.yml
App\Entity\Author:
constraints:
- Callback: [Acme\Validator, validate]

.. code-block:: xml

<!-- src/AppBundle/Resources/config/validation.xml -->
<!-- src/Resources/config/validation.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">

<class name="AppBundle\Entity\Author">
<class name="App\Entity\Author">
<constraint name="Callback">
<value>Acme\Validator</value>
<value>validate</value>
Expand All @@ -200,8 +200,8 @@ You can then use the following configuration to invoke this validator:

.. code-block:: php

// src/AppBundle/Entity/Author.php
namespace AppBundle\Entity;
// src/Entity/Author.php
namespace App\Entity;

use Acme\Validator;
use Symfony\Component\Validator\Mapping\ClassMetadata;
Expand Down Expand Up @@ -229,8 +229,8 @@ You can then use the following configuration to invoke this validator:
When configuring the constraint via PHP, you can also pass a closure to the
constructor of the Callback constraint::

// src/AppBundle/Entity/Author.php
namespace AppBundle\Entity;
// src/Entity/Author.php
namespace App\Entity;

use Symfony\Component\Validator\Context\ExecutionContextInterface;

Expand Down
Loading