Answer the question
In order to leave comments, you need to log in
Is it correct to pass the FormInterface $form to the Service, or is it better to pass a specific data type?
There is a service that is responsible for creating a new candidate and it has image uploads. Is it correct to send the form to the service?
public function manage(<b>FormInterface $form</b>, Proposition $proposition, Candidate $candidate): bool
{
<b> if ($file = $form->get('file_cv')->getData()) {
</b> $newFileName = $this->uploader->upload($file);
if (!$newFileName) {
return false;
}
$candidate->setFileCv($newFileName);
}
$this->saveCandidate($candidate, $proposition);
return true;
}
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