8000 minor #7585 Update parent_services for tip consistency (matthieu88160… · symfony/symfony-docs@ca71481 · GitHub
[go: up one dir, main page]

Skip to content

Commit ca71481

Browse files
committed
minor #7585 Update parent_services for tip consistency (matthieu88160, javiereguiluz)
This PR was submitted for the 3.2 branch but it was merged into the 2.7 branch instead (closes #7585). Discussion ---------- 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. Commits ------- 45a44f3 Fixed a typo 977142c Fixed a typo 6855572 Update parent_services for tip consistency
2 parents 7afd581 + 45a44f3 commit ca71481

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

service_container/parent_services.rst

Lines changed: 24 additions & 0 deletions
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 child service classes 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)
0