-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Use ArrayAccess interface instead of Doctrine Collection #7539
Conversation
Fixes sonata-project#7538. Instead of using the Collection interface an easy switch to ArrayAccess interface can be used.
Check if it's ArrayAccess or array. Fixes sonata-project#7538.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does a unit test would be possible ?
@@ -240,10 +240,10 @@ public function appendFormFieldElement(AdminInterface $admin, $subject, $element | |||
|
|||
$collection = $this->propertyAccessor->getValue($subject, $path); | |||
|
|||
if (!($collection instanceof Collection)) { | |||
if (!($collection instanceof \ArrayAccess) && !is_array($collection)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the () around instanceof are unnecesary.
I just realized that this would not fix the other issue in #7538. It's also about Nested Collections. When I add a nested collection in level 2 I get this error:
|
Hi, can you rebase ? |
I found one case where we use this strategy too, so this Pr makes sense to me. (the case is located at the appenParentObject of the on AbstractAdmin) |
Do you have the time to finish the PR @TheFox ? :) |
Subject
I am targeting this branch, because it's a fix for version 3.
Closes #7538.
Changelog