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

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
weaverryan merged 1 commit intosymfony:masterfromyceruto:4_migration
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes fromall 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
useAppBundle\Mailer;
// config/services.php
useApp\Mailer;

$container->register('app.mailer', Mailer::class)
->addArgument('sendmail');
8 changes: 4 additions & 4 deletionsbest_practices/configuration.rst
View file
Open in desktop
Original file line numberDiff line numberDiff 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
namespaceAppBundle\Entity;
// src/Entity/Post.php
namespaceApp\Entity;

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

.. code-block:: php

namespaceAppBundle\Repository;
namespaceApp\Repository;

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

class PostRepository extends EntityRepository
{
Expand Down
6 changes: 3 additions & 3 deletionsbest_practices/templates.rst
View file
Open in desktop
Original file line numberDiff line numberDiff 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::

namespaceAppBundle\Utils;
namespaceApp\Utils;

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

.. code-block:: php

namespaceAppBundle\Twig;
namespaceApp\Twig;

useAppBundle\Utils\Markdown;
useApp\Utils\Markdown;

class AppExtension extends \Twig_Extension
{
Expand Down
2 changes: 1 addition & 1 deletioncontroller/service.rst
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsdoctrine.rst
View file
Open in desktop
Original file line numberDiff line numberDiff 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 yourAppBundle::
inside the ``Entity`` directory of your``src``::

// src/Entity/Product.php
namespace App\Entity;
Expand DownExpand 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 DownExpand Up@@ -754,7 +754,7 @@ SQL-like language, to construct a query for this scenario::

$query = $em->createQuery(
'SELECT p
FROMAppBundle:Product p
FROMApp: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 DownExpand Up@@ -794,7 +794,7 @@ DQL as you start to concatenate strings::
$repository = $this->getDoctrine()
->getRepository(Product::class);

// createQueryBuilder() automatically selects FROMAppBundle:Product
// createQueryBuilder() automatically selects FROMApp:Product
// and aliases it to "p"
$query = $repository->createQueryBuilder('p')
->where('p.price > :price')
Expand Down
2 changes: 1 addition & 1 deletionforms.rst
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsreference/constraints/All.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,8 +25,8 @@ entry in that array:

.. code-block:: php-annotations

// src/AppBundle/Entity/User.php
namespaceAppBundle\Entity;
// src/Entity/User.php
namespaceApp\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
namespaceAppBundle\Entity;
// src/Entity/User.php
namespaceApp\Entity;

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

.. code-block:: php-annotations

// src/AppBundle/Entity/Transaction.php
namespaceAppBundle\Entity;
// src/Entity/Transaction.php
namespaceApp\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
namespaceAppBundle\Entity;
// src/Entity/Transaction.php
namespaceApp\Entity;

use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints as Assert;
Expand Down
16 changes: 8 additions & 8 deletionsreference/constraints/Blank.rst
View file
Open in desktop
Original file line numberDiff line numberDiff 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
namespaceAppBundle\Entity;
// src/Entity/Author.php
namespaceApp\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
namespaceAppBundle\Entity;
// src/Entity/Author.php
namespaceApp\Entity;

use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints as Assert;
Expand Down
36 changes: 18 additions & 18 deletionsreference/constraints/Callback.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,8 +35,8 @@ Configuration

.. code-block:: php-annotations

// src/AppBundle/Entity/Author.php
namespaceAppBundle\Entity;
// src/Entity/Author.php
namespaceApp\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
namespaceAppBundle\Entity;
// src/Entity/Author.php
namespaceApp\Entity;

use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints as Assert;
Expand DownExpand 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
namespaceAppBundle\Entity;
// src/Entity/Author.php
namespaceApp\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
namespaceAppBundle\Entity;
// src/Entity/Author.php
namespaceApp\Entity;

use Acme\Validator;
use Symfony\Component\Validator\Mapping\ClassMetadata;
Expand DownExpand 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
namespaceAppBundle\Entity;
// src/Entity/Author.php
namespaceApp\Entity;

use Symfony\Component\Validator\Context\ExecutionContextInterface;

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp