lundi 21 novembre 2016

How to Bind abstract class To Implementations

i'm trying to implements Repository Pattern with some Services package which encapsulates the business layer i'm using Repository and Service abstract class to implements common behavior

interface RepositoryInterface {

     public function findAll();
              --------------------------------

abstract class Repository implements RepositoryInterface {

    public $model;

    public function __construct(Model $model)
    {
    $this->model = $model;

    }

  • many sub classes extends repository

for the package Services :

interface ServiceInterface
{
    function show($uuid);

    function store($request);

class Service implements ServiceInterface
{

    protected $repository;

    public function  __construct(Repository $repository){
        $this->repository = $repository;
    }

how i can bind service and repository sub Classes into providers ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire