Skip to content

Commit

Permalink
Use "delete_empty" option only if we're using Symofny 2.5.0 or higher
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Feb 23, 2015
1 parent 84e6d37 commit a1a6afc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,11 @@ protected function createEditForm($entity, array $entityProperties)
$formFieldOptions = array(
'allow_add' => true,
'allow_delete' => true,
'delete_empty' => true,
);

if (version_compare(\Symfony\Component\HttpKernel\Kernel::VERSION, '2.5.0', '>=')) {
$formFieldOptions['delete_empty'] = true;
}
}

$form->add($name, $metadata['type'], $formFieldOptions);
Expand Down

0 comments on commit a1a6afc

Please sign in to comment.