jeudi 25 janvier 2018

PHP : same functionality design pattern

Hi I am using repository pattern PHP and from the controller or the service I need to call 1 after 1 to different repository function

$lists is a list of list objects that comes from DB. the repository pattern is the sample Repository pattern

like :

        $lists = $this->_listRepo->findAllX($this->config["same_config_param"]);
        $arrayToUpdate = $this->someProcess($lists , $statusA);
        $this->updateDBStatus($arrayToUpdate , $statusA);


        $lists = $this->_listRepo->findAllB($this->config["same_config_param"]);
        $arrayToUpdate = $this->someProcess($lists , $statusB);
        $this->updateDBStatus($arrayToUpdate , $statusB);


        $lists = $this->_listRepo->findAnotherCase($this->config["same_config_param"]);
        $arrayToUpdate = $this->someProcess($lists , $statusC);
        $this->updateDBStatus($arrayToUpdate , $statusC);

is there a design pattern to handle it differently and nicely? maybe should I use FACADE?

thanks

Aucun commentaire:

Enregistrer un commentaire