I am looking for the best pattern to apply in my problem. I have an interface that defines my service class functionality
interface NegotiationInterface {
abstract public function resetNegotiation(Negotiation $negotiantion);
}
A main class implements it
public class NegotiationService implements NegotiationInterface {
public function __construct(…Some Dependencies…)
{
….
}
public function resetNegotiation(Negotiation $negotiantion){
…. //All business logic
}
}
NegotiationService is registered under DI container(Symfony based) and used all over application by its service id.
$negotiationService = $this->container->get(“negotiation_service”);
$negotiationService->resetNegotiation($negotiation);
However some of our clients(negotiation contains the client info), require an additional step after calling resetNegotiation, for example our common business logic + calling a webservice. I reached at decorator pattern but I am not sure if it would be the best approach while using DI. If so how would I apply together with DI. I would like to have those extra steps loaded dynamically according to client.
Aucun commentaire:
Enregistrer un commentaire