Answer the question
In order to leave comments, you need to log in
Is it correct to pass the required objects as method arguments?
There are classes Controller and Saver. The controller in the method creates an EntrySaver by passing it to the constructor from its Request and Response properties. Then it pulls various saver methods, after which (if the methods returned the desired values) it runs the $saver->save() method...
But! To save the data (they are passed in the Request object), the saver needs two more objects - ObjectFacroty and Assembler. Is it okay to pass these objects to the ->save() method, or should we pass them at the very beginning - to the saver constructor?
class Controller
{
...
public function add()
{
...
$saver = new Saver($this->request, $this->response);
...
$saver->check();
...
$saver->save($this->p_factory->getObjectFactory(), $this->factory->getAssembler());
...
}
...
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question