-
-
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
Nested CollectionTypes #7538
Comments
It seems the right way to me to always expose the Collection. Especially for something called a CollectionType. |
@VincentLanglet Depends on who you ask. If you ask the SensioLabs guys the collection should not be exposed. In my opinion it shouldn't matter. But who am I, right? It shouldn't matter if you want to use Instead of calling
you could easily change it to
This would be compatible and easy to change. You could even remove the check
Edit: you have to remove
Native array is not an instanceof \ArrayAccess. |
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.
@jordisala1991 @VincentLanglet Thank you for the support for ArrayAccess. I just wondered if all the locations in the code where Collection is used is now supposed to be supported by ArrayAccess, or only this one case in AdminHelper. For example here it is still only Collection, no ArrayAccess:
|
I have a similar problem to #6777. In the latest version 3.105.3 in AdminHelper, the line
$childFormBuilder = $this->getChildFormBuilder($formBuilder, $elementId);
in is returning null when I am using nested
Sonata\Form\Type\CollectionType
.In my Entity I have to expose the Collection
instead of only the array
Otherwise it will not work because the else block is reached in the AdminHelper class.
In the loop of
getChildFormBuilder
the value for$elementId
iss616839720b0e2_questions_0_answers
. But there is only as616839720b0e2_questions
in the array (iterator). Not sure if this is the case of the problem.The text was updated successfully, but these errors were encountered: