From 7ff7c965fa43cd6dffd93d9b5474639e817c8fdf Mon Sep 17 00:00:00 2001 From: matthieu88160 Date: Tue, 7 Mar 2017 08:42:23 +0100 Subject: [PATCH 1/3] 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. --- service_container/parent_services.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/service_container/parent_services.rst b/service_container/parent_services.rst index 528b3bb8c29..c6a95b1951d 100644 --- a/service_container/parent_services.rst +++ b/service_container/parent_services.rst @@ -31,6 +31,30 @@ you may have multiple repository classes which need the // ... } +Your childs service class may look like:: + + // src/AppBundle/Repository/DoctrineUserRepository.php + namespace AppBundle\Repository; + + use AppBundle\Repository\BaseDoctrineRepository + + // ... + class DoctrineUserRepository extends BaseDoctrineRepository + { + // ... + } + + // src/AppBundle/Repository/DoctrinePostRepository.php + namespace AppBundle\Repository; + + use AppBundle\Repository\BaseDoctrineRepository + + // ... + class DoctrinePostRepository extends BaseDoctrineRepository + { + // ... + } + Just as you use PHP inheritance to avoid duplication in your PHP code, the service container allows you to extend parent services in order to avoid duplicated service definitions: From 654626393b6c586d14df423a6f5454740d6b6875 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 7 Mar 2017 11:22:01 +0100 Subject: [PATCH 2/3] Fixed a typo --- service_container/parent_services.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service_container/parent_services.rst b/service_container/parent_services.rst index c6a95b1951d..36e36c5f2bd 100644 --- a/service_container/parent_services.rst +++ b/service_container/parent_services.rst @@ -31,7 +31,7 @@ you may have multiple repository classes which need the // ... } -Your childs service class may look like:: +Your child service class may look like:: // src/AppBundle/Repository/DoctrineUserRepository.php namespace AppBundle\Repository; From c44c48f896a206e8fe96263eec1b7d9cdbac79c2 Mon Sep 17 00:00:00 2001 From: matthieu88160 Date: Tue, 7 Mar 2017 11:25:55 +0100 Subject: [PATCH 3/3] Fixed a typo Thank for typo ;) Two classes are presented. --- service_container/parent_services.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service_container/parent_services.rst b/service_container/parent_services.rst index 36e36c5f2bd..64155fe64a5 100644 --- a/service_container/parent_services.rst +++ b/service_container/parent_services.rst @@ -31,7 +31,7 @@ you may have multiple repository classes which need the // ... } -Your child service class may look like:: +Your child service classes may look like:: // src/AppBundle/Repository/DoctrineUserRepository.php namespace AppBundle\Repository;