Skip to content

Commit

Permalink
feature #6250 Allow fields containing null-safe property paths (alshe…
Browse files Browse the repository at this point in the history
…netsky)

This PR was merged into the 4.x branch.

Discussion
----------

Allow fields containing null-safe property paths

see #6249

Added additional field name sanitization so that symfony form does not throw an error on fields with null-safe property paths.

Commits
-------

9d07755 Allow fields containing null-safe property paths
  • Loading branch information
javiereguiluz committed Apr 16, 2024
2 parents 43cc094 + 9d07755 commit 5182566
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Form/Type/CrudFormType.php
Expand Up @@ -48,7 +48,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
// 'property_path' option to keep the original field name
if (str_contains($fieldDto->getProperty(), '.')) {
$formFieldOptions['property_path'] = $fieldDto->getProperty();
$name = str_replace(['.', '[', ']'], '_', $fieldDto->getProperty());
$name = str_replace(['.', '[', ']', '?'], '_', $fieldDto->getProperty());
} else {
$name = $fieldDto->getProperty();
}
Expand Down

0 comments on commit 5182566

Please sign in to comment.