Skip to content

Adds a fix for nested properties on association fields#7585

Draft
KDederichs wants to merge 1 commit intoEasyCorp:5.xfrom
KDederichs:fix/nasted_associations
Draft

Adds a fix for nested properties on association fields#7585
KDederichs wants to merge 1 commit intoEasyCorp:5.xfrom
KDederichs:fix/nasted_associations

Conversation

@KDederichs
Copy link
Copy Markdown
Contributor

Only merge AFTER #7500 is merged

@KDederichs KDederichs marked this pull request as draft April 28, 2026 18:42
Comment thread config/services.php
->arg(2, service('request_stack'))
->arg(3, service(ControllerFactory::class))
->arg(4, new Reference(FieldFactory::class))
->arg(5, service(EntityRepository::class))
Copy link
Copy Markdown
Contributor

@Seb33300 Seb33300 May 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @KDederichs,

Instead of adding this dependency to many field configurators (I saw you also created a similar PR for the CollectionConfigurator, and I also did the same with EntityConfigurator in my PR), maybe we can move it to the CommonPreConfigurator, so we resolve the field association once for all field configurators and avoid code duplication?

Also, this may no longer be needed:

$doctrineMetadata = [];
if (isset($entityDto->getClassMetadata()->fieldMappings[$field->getProperty()])) {
$doctrineMetadata = (array) $entityDto->getClassMetadata()->getFieldMapping($field->getProperty());
} elseif ($entityDto->getClassMetadata()->hasAssociation($field->getProperty())) {
$mappingType = $entityDto->getClassMetadata()->getAssociationMapping($field->getProperty())['type'];
$doctrineMetadata = (array) $entityDto->getClassMetadata()->getAssociationMapping($field->getProperty());
$doctrineMetadata['type'] = $mappingType;
}
$field->setDoctrineMetadata($doctrineMetadata);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a better solution to solidify it in one place when possible yeah.
Tbh I just needed it in that moment in my backend so I fixed the issue where it popped up as I implemented the things I needed (and applied them to production via Patch files).

If you want you can extend your PR with a general solution, since both of mine are dependent on your PR anyways.

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