I had had a problem to set a Form Field DateTime (named endDate) to the Form Field DateTime (named startDate + 24h) if no data for endDate is typed into the form) The solution (thanks to the answers) was this:
$em = $this->getDoctrine()->getManager();
$task->setEndDate($form->get('startDate')->getData());
$task->getEndDate()->modify('+1 day');
$em->persist($task);
$em->flush();
But when i modify the endDate + 1 day , the startDate is modified , too.
What's the best way to fix this?