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

FieldDescriptionInterface should not expose getParentAssociationMappings and getAssociationMappings methods or there should stop returning an array #6274

Closed
VincentLanglet opened this issue Aug 11, 2020 · 4 comments
Milestone

Comments

@VincentLanglet
Copy link
Member

Feature Request

Currently FieldDescriptionInterface::parentAssociationMappings() and associationMappings() methods are returning array.

Thanks to #6219 (comment), I discovered that the array keys are not the same for our different storage bundle. This means that these array should not be used in SonataAdminBundle.

I found two solutions

  • Exposing some methods like getParentAssociationFieldName(), getAssociationFieldName(), ... instead.
  • Exposing a new AssociationMapping interface, which will be implemented by storage bundle. And getParentAssociationMappings/getAssociationMappings should return this interface instead.

The second solution seems better, but this can't be done in a BC-way isn't it ? @sonata-project/contributors

@VincentLanglet VincentLanglet added this to the 4.0 milestone Aug 11, 2020
@kirya-dev
Copy link
Contributor

Hello!
First of all needs define global difference between getParentAssociationFieldName()
& getAssociationFieldName().

Maybe second metod name must be getChildAssociationFieldName()?

P.S. Im my opinion using array as return value no good practice - we can get any structed data

@VincentLanglet VincentLanglet modified the milestones: 4.0, 5.0 Sep 10, 2020
@github-actions
Copy link

github-actions bot commented Mar 9, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@VincentLanglet
Copy link
Member Author

VincentLanglet commented Dec 27, 2021

I think the easier would be to introduce a class

class Mapping extends ArrayAccess

with a getFieldName method and a getOption one.

I let #7677 as an example

@VincentLanglet
Copy link
Member Author

Closing due to lack of interest

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

No branches or pull requests

3 participants