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

Widget - PoiCollectionViewHelper #218

Closed
rasgor opened this issue May 26, 2021 · 1 comment
Closed

Widget - PoiCollectionViewHelper #218

rasgor opened this issue May 26, 2021 · 1 comment

Comments

@rasgor
Copy link

rasgor commented May 26, 2021

Hey,

I'am trying to achieve to create PoiCollections on the fly based on other records e.g. news with a given latitude and longitude. If I'am using the widget as follows <maps2:widget.poiCollection poiCollections="{poiCollections}" override="{settings: {mapWidth: '100%', mapHeight: '300'}}" /> and the type of poiCollections is ArrayObject the type requirement Traversable of the ViewHelper is met. But the following ConvertToJsonViewHelper.php checks for poicollections on line 112 if it's an array. The given type of ArrayObject doesn't satisfy this criteria.

Is it possible to extend this if statement with || $value instanceof \Traversable ??

Thx in advance :)

@froemken
Copy link
Contributor

froemken commented Mar 2, 2022

Hello @rasgor

I just see that PHP 8.1 has deprecated the use of objects for reset() and current(). So I can't implement your solution.
For now I have added following lines into this method:

        // With PHP 8.1 reset() and current() should not be used with objects anymore.
        // Extract the values as simple array to be compatible in the future.
        if ($value instanceof \ArrayObject) {
            $value = $value->getArrayCopy();
        }

Hope this should solve your problem.

Stefan

@froemken froemken closed this as completed Mar 2, 2022
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

No branches or pull requests

2 participants