Skip to content

Commit 6855572

Browse files
matthieu88160xabbuh
authored andcommitted
Update parent_services for tip consistency
Currently the first page tip explain that the created service class extends the BaseDoctrineRepository but it is not represented by the code samples. Simply adding class declaration example for tip consistency and user reading improvement.
1 parent 7afd581 commit 6855572

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

service_container/parent_services.rst

+24
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,30 @@ you may have multiple repository classes which need the
3131
// ...
3232
}
3333

34+
Your childs service class may look like::
35+
36+
// src/AppBundle/Repository/DoctrineUserRepository.php
37+
namespace AppBundle\Repository;
38+
39+
use AppBundle\Repository\BaseDoctrineRepository
40+
41+
// ...
42+
class DoctrineUserRepository extends BaseDoctrineRepository
43+
{
44+
// ...
45+
}
46+
47+
// src/AppBundle/Repository/DoctrinePostRepository.php
48+
namespace AppBundle\Repository;
49+
50+
use AppBundle\Repository\BaseDoctrineRepository
51+
52+
// ...
53+
class DoctrinePostRepository extends BaseDoctrineRepository
54+
{
55+
// ...
56+
}
57+
3458
Just as you use PHP inheritance to avoid duplication in your PHP code, the
3559
service container allows you to extend parent services in order to avoid
3660
duplicated service definitions:

0 commit comments

Comments
 (0)