Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This commit ensures that the "property_path" option is respected #43

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

bresam
Copy link
Contributor

@bresam bresam commented Jan 4, 2024

This commit ensures that the "property_path" option is respected in the DoctrineORM manipulator.
If no property_path is specified, the form name is used as before.

When using TranslationFormBundle, we noticed that the "property_path" option is only partially/incompletely taken into account.
Here we sometimes use several translation sections in one Sonata Admin. This already worked in the older TranslationFormBundle version.

The Structure is like:

  • An entity called Domain
  • A translation entity called DomainTranslation with a lot of translations (property_name translations)
  • A Sonata DomainAdmin with multiple sections which show parts of all translations

Below is a small code example of the form:

$form->add('translations', TranslationsType::class,
    [
        'property_path' => 'translations', // not required cause already defined by form name
        'locales' => $this->getLocales(),
        'label' => false,
        'fields' => [
            'text1' => ['field_type' => TextareaType::class, ...],
            'text2' => ['field_type' => TextareaType::class, ...],
         ],
         'excluded_fields' => ['text3', 'text4']),
    ]
)
->add('translations_not_existing_property_name', TranslationsType::class,
    [
        'property_path' => 'translations', // required (used form name doesn't exist anyway)
        'locales' => $this->getLocales(),
        'label' => false,
        'fields' => [
            'text3' => ['field_type' => TextareaType::class, ...],
            'text4' => ['field_type' => TextareaType::class, ...],
         ],
         'excluded_fields' => ['text1', 'text2']),
    ]
)
->end();

…he DoctrineORM manipulator. If no property_path is specified, the form name is used as before.
@bresam
Copy link
Contributor Author

bresam commented Jan 9, 2024

@webda2l it seems the failing check has nothing todo with my change. Right?
Do you have any further comments on this feature?

@webda2l webda2l merged commit 0c2f541 into a2lix:master Jan 9, 2024
7 of 8 checks passed
@webda2l
Copy link
Member

webda2l commented Jan 9, 2024

Sound good, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants