8000 minor #7113 A few minor improvements (bocharsky-bw) · matthieu88160/symfony-docs@cda1757 · GitHub
[go: up one dir, main page]

Skip to content

Commit cda1757

Browse files
committed
minor symfony#7113 A few minor improvements (bocharsky-bw)
This PR was merged into the 2.7 branch. Discussion ---------- A few minor improvements Commits ------- 0226bbc Rename 'Entity' to 'Repository' in namespaces for repository classes 68a6ff4 A few minor improvements
2 parents ab7b82c + 0226bbc commit cda1757

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

doctrine/associations.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ You can also query in the other direction::
316316

317317
In this case, the same things occur: you first query out for a single ``Category``
318318
object, and then Doctrine makes a second query to retrieve the related ``Product``
319-
objects, but only once/if you ask for them (i.e. when you call ``->getProducts()``).
319+
objects, but only once/if you ask for them (i.e. when you call ``getProducts()``).
320320
The ``$products`` variable is an array of all ``Product`` objects that relate
321321
to the given ``Category`` object via their ``category_id`` value.
322322

@@ -365,7 +365,7 @@ Of course, if you know up front that you'll need to access both objects, you
365365
can avoid the second query by issuing a join in the original query. Add the
366366
following method to the ``ProductRepository`` class::
367367

368-
// src/AppBundle/Entity/ProductRepository.php
368+
// src/AppBundle/Repository/ProductRepository.php
369369
public function findOneByIdJoinedToCategory($productId)
370370
{
371371
$query = $this->getEntityManager()
@@ -407,7 +407,7 @@ Doctrine's `Association Mapping Documentation`_.
407407
.. note::
408408

409409
If you're using annotations, you'll need to prepend all annotations with
410-
``ORM\`` (e.g. ``ORM\OneToMany``), which is not reflected in Doctrine's
410+
``@ORM\`` (e.g. ``@ORM\OneToMany``), which is not reflected in Doctrine's
411411
documentation. You'll also need to include the ``use Doctrine\ORM\Mapping as ORM;``
412412
statement, which *imports* the ``ORM`` annotations prefix.
413413

doctrine/repository.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ To do this, add the repository class name to your entity's mapping definition:
2121
use Doctrine\ORM\Mapping as ORM;
2222
2323
/**
24-
* @ORM\Entity(repositoryClass="AppBundle\Entity\ProductRepository")
24+
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductRepository")
2525
*/
2626
class Product
2727
{
@@ -33,7 +33,7 @@ To do this, add the repository class name to your entity's mapping definition:
3333
# src/AppBundle/Resources/config/doctrine/Product.orm.yml
3434
AppBundle\Entity\Product:
3535
type: entity
36-
repositoryClass: AppBundle\Entity\ProductRepository
36+
repositoryClass: AppBundle\Repository\ProductRepository
3737
# ...
3838
3939
.. code-block:: xml
@@ -47,7 +47,7 @@ To do this, add the repository class name to your entity's mapping definition:
4747
4848
<entity
4949
name="AppBundle\Entity\Product"
50-
repository-class="AppBundle\Entity\ProductRepository">
50+
repository-class="AppBundle\Repository\ProductRepository">
5151
5252
<!-- ... -->
5353
</entity>
@@ -72,8 +72,8 @@ entities, ordered alphabetically by name.
7272

7373
.. code-block:: php
7474
75-
// src/AppBundle/Entity/ProductRepository.php
76-
namespace AppBundle\Entity;
75+
// src/AppBundle/Repository/ProductRepository.php
76+
namespace AppBundle\Repository;
7777
7878
use Doctrine\ORM\EntityRepository;
7979

security/entity_provider.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ For this entry, suppose that you already have a ``User`` entity inside an
5050
5151
/**
5252
* @ORM\Table(name="app_users")
53-
* @ORM\Entity(repositoryClass="AppBundle\Entity\UserRepository")
53+
* @ORM\Entity(repositoryClass="AppBundle\Repository\UserRepository")
5454
*/
5555
class User implements UserInterface, \Serializable
5656
{
@@ -428,8 +428,8 @@ To do this, make your ``UserRepository`` implement a special
428428
interface requires three methods: ``loadUserByUsername($username)``,
429429
``refreshUser(UserInterface $user)``, and ``supportsClass($class)``::
430430

431-
// src/AppBundle/Entity/UserRepository.php
432-
namespace AppBundle\Entity;
431+
// src/AppBundle/Repository/UserRepository.php
432+
namespace AppBundle\Repository;
433433

434434
use Symfony\Component\Security\Core\User\UserInterface;
435435
use Symfony\Component\Security\Core\User\UserProviderInterface;

service_container/parent_services.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ have related classes that share some of the same dependencies. For example,
99
you may have multiple repository classes which need the
1010
``doctrine.entity_manager`` service and an optional ``logger`` service::
1111

12-
// src/AppBundle/Doctrine/BaseDoctrineRepository.php
13-
namespace AppBundle\Doctrine;
12+
// src/AppBundle/Repository/BaseDoctrineRepository.php
13+
namespace AppBundle\Repository;
1414

1515
// ...
1616
abstract class BaseDoctrineRepository
@@ -48,12 +48,12 @@ duplicated service definitions:
4848
- [setLogger, ['@logger']]
4949
5050
app.user_repository:
51-
class: AppBundle\Doctrine\DoctrineUserRepository
51+
class: AppBundle\Repository\DoctrineUserRepository
5252
# extend the app.base_doctrine_repository service
5353
parent: app.base_doctrine_repository
5454
5555
app.post_repository:
56-
class: AppBundle\Doctrine\DoctrinePostRepository
56+
class: AppBundle\Repository\DoctrinePostRepository
57< F438 /code>57
parent: app.base_doctrine_repository
5858
5959
# ...
@@ -77,12 +77,12 @@ duplicated service definitions:
7777
7878
<!-- extends the app.base_doctrine_repository service -->
7979
<service id="app.user_repository"
80-
class="AppBundle\Doctrine\DoctrineUserRepository"
80+
class="AppBundle\Repository\DoctrineUserRepository"
8181
parent="app.base_doctrine_repository"
8282
/>
8383
8484
<service id="app.post_repository"
85-
class="AppBundle\Doctrine\DoctrineUserRepository"
85+
class="AppBundle\Repository\DoctrineUserRepository"
8686
parent="app.base_doctrine_repository"
8787
/>
8888
@@ -103,11 +103,11 @@ duplicated service definitions:
103103
104104
// extend the app.base_doctrine_repository service
105105
$definition = new DefinitionDecorator('app.base_doctrine_repository');
106-
$definition->setClass('AppBundle\Doctrine\DoctrineUserRepository');
106+
$definition->setClass('AppBundle\Repository\DoctrineUserRepository');
107107
$container->setDefinition('app.user_repository', $definition);
108108
109109
$definition = new DefinitionDecorator('app.base_doctrine_repository');
110-
$definition->setClass('AppBundle\Doctrine\DoctrinePostRepository');
110+
$definition->setClass('AppBundle\Repository\DoctrinePostRepository');
111111
$container->setDefinition('app.post_repository', $definition);
112112
113113
// ...
@@ -144,7 +144,7 @@ in the child class:
144144
# ...
145145
146146
app.user_repository:
147-
class: AppBundle\Doctrine\DoctrineUserRepository
147+
class: AppBundle\Repository\DoctrineUserRepository
148148
parent: app.base_doctrine_repository
149149
150150
# overrides the public setting of the parent service
@@ -155,7 +155,7 @@ in the child class:
155155
arguments: ['@app.username_checker']
156156
157157
app.post_repository:
158-
class: AppBundle\Doctrine\DoctrinePostRepository
158+
class: AppBundle\Repository\DoctrinePostRepository
159159
parent: app.base_doctrine_repository
160160
161161
# overrides the first argument (using the special index_N key)
@@ -174,7 +174,7 @@ in the child class:
174174
175175
<!-- overrides the public setting of the parent service -->
176176
<service id="app.user_repository"
177-
class="AppBundle\Doctrine\DoctrineUserRepository"
177+
class="AppBundle\Repository\DoctrineUserRepository"
178178
parent="app.base_doctrine_repository"
179179
public="false"
180180
>
@@ -184,7 +184,7 @@ in the child class:
184184
</service>
185185
186186
<service id="app.post_repository"
187-
class="AppBundle\Doctrine\DoctrineUserRepository"
187+
class="AppBundle\Repository\DoctrineUserRepository"
188188
parent="app.base_doctrine_repository"
189189
>
190190
<!-- overrides the first argument (using the index attribute) -->
@@ -202,15 +202,15 @@ in the child class:
202202
// ...
203203
204204
$definition = new DefinitionDecorator('app.base_doctrine_repository');
205-
$definition->setClass('AppBundle\Doctrine\DoctrineUserRepository');
205+
$definition->setClass('AppBundle\Repository\DoctrineUserRepository');
206206
// overrides the public setting of the parent service
207207
$definition->setPublic(false);
208208
// appends the '@app.username_checker' argument to the parent argument list
209209
$definition->addArgument(new Reference('app.username_checker'));
210210
$container->setDefinition('app.user_repository', $definition);
211211
212212
$definition = new DefinitionDecorator('app.base_doctrine_repository');
213-
$definition->setClass('AppBundle\Doctrine\DoctrinePostRepository');
213+
$definition->setClass('AppBundle\Repository\DoctrinePostRepository');
214214
// overrides the first argument
215215
$definition->replaceArgument(0, new Reference('doctrine.custom_entity_manager'));
216216
$container->setDefinition('app.post_repository', $definition);

testing/doctrine.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ If you need to actually execute a query, you will need to boot the kernel
1818
to get a valid connection. In this case, you'll extend the ``KernelTestCase``,
1919
which makes all of this quite easy::
2020

21-
// src/AppBundle/Tests/Entity/ProductRepositoryFunctionalTest.php
22-
namespace AppBundle\Tests\Entity;
21+
// src/AppBundle/Tests/Repository/ProductRepositoryFunctionalTest.php
22+
namespace AppBundle\Tests\Repository;
2323

2424
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
2525

0 commit comments

Comments
 (0)
0