Skip to content

Improves getting of first array element#6722

Merged
OskarStark merged 1 commit into
sonata-project:3.xfrom
JanStorm:nws-jstorm-patch-unset-index
Dec 21, 2020
Merged

Improves getting of first array element#6722
OskarStark merged 1 commit into
sonata-project:3.xfrom
JanStorm:nws-jstorm-patch-unset-index

Conversation

@JanStorm

Copy link
Copy Markdown

Subject

When working with adding and removing entities from the CollectionType field, it can happen that the array index not starts with 0 but has an length > 0. This leads to an error since that index 0 is unset. So using twig first function here to handle this case.

I am targeting this branch, because this branch contains the error this patch will fix. Its backwards compatible.

Changelog

### Fixed
- Replaced 'array[0]' by 'array|first' to fix edit_many_to_many template when children index does not start with 0.

When working with adding and removing entities from the CollectionType field, it can happen that the array index not starts with 0 but has an length > 0. This leads to an error since that index 0 is unset. So using twig first function here to handle this case.
@OskarStark OskarStark merged commit 2882754 into sonata-project:3.x Dec 21, 2020
@OskarStark

Copy link
Copy Markdown
Member

Thanks!

@JanStorm JanStorm deleted the nws-jstorm-patch-unset-index branch January 19, 2021 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants