Symfony 3 DTOOneCommand changing null value to 0 after handleRequest

  dto, forms, php, symfony, symfony-3.4

I am working on a Symfony 3 project and I am facing a problem. When my form is submitted it changed the value from null to zero. But I would like that it keeps value it is sent. Because for me null is different than 0.

I have dump like (form use create form from scenarioProposalVersionModelizeCommand):

    dump($scenarioProposalVersionModelizeCommand->phaseProposalVersions[0]);
    $form->handleRequest($request);
    dump($scenarioProposalVersionModelizeCommand->phaseProposalVersions[0]);die;

Output so this 3 last values as you can see are transformed:

enter image description here

Source: Symfony Questions

LEAVE A COMMENT