Answer the question
In order to leave comments, you need to log in
What is better Null or empty string in ValueObject?
Which is better to use string which will be in ValueObject or null?
public function __construct(Request $request)
{
$this->fullname = $request->request->get('fullname', null);
public function __construct(Request $request)
{
$contactInfo = $request->request->get('contactInfo');
$this->fullname = $request->request->get('fullname', null);
$this->email = $contactInfo['email'] ?? null;
$this->phone = $contactInfo['phone'] ?? null;
$this->linkedInUrl = $contactInfo['linkedInUrl'] ?? null;
$this->currentCompany = $request->request->get('current_company', null);
$this->jobId = $request->request->get('job_id', null);
}
Answer the question
In order to leave comments, you need to log in
You receive and process GET parameters, a normal GET parameter is a string.
"In the right way" -
$this->fullname = $request->request->get('fullname', '');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question