Answer the question
In order to leave comments, you need to log in
Do you get heavy constructors with a large number of parameter injections?
public function __construct(
Request $request,
$router,
Storage $storage,
$user,
Session $session,
TranslatorInterface $translator,
DocumentRepository $documentRepository,
\Swift_Mailer $mailer,
EngineInterface $templating,
$checkout_email,
WishlistOrderManager $wishlistOrderManager
)
{
$this->request = $request;
$this->router = $router;
$this->storage = $storage;
$this->user = $user;
$this->session = $session;
$this->translator = $translator;
$this->documentRepository = $documentRepository;
$this->mailer = $mailer;
$this->templating = $templating;
$this->checkout_email = $checkout_email;
$this->wishlistOrderManager = $wishlistOrderManager;
}
Answer the question
In order to leave comments, you need to log in
The point is not only independence from the container, but the obviousness of the presence of dependencies. And in minimizing class responsibility. Why does he need to know about the existence of something that he does not need?
is it really necessary to be container independent?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question