Skip to content
Closed
Changes from 1 commit
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
Next Next commit
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.
  • Loading branch information
matthieu88160 authored Mar 7, 2017
commit 7ff7c965fa43cd6dffd93d9b5474639e817c8fdf
24 changes: 24 additions & 0 deletions service_container/parent_services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down