-
Notifications
You must be signed in to change notification settings - Fork 118
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
Associative Array created in Collection Representation #190
Comments
I agree with this suggestion. |
👍 |
I think the current behaviour is fine. If you pass an associate array, you get an json object. For example, I think this will break the code of people using pomm https://github.com/chanmix51/Pomm/blob/master/Pomm/Object/BaseObject.php |
Ok, then the other way round would be to check in PagerfantaFactory: // Hateoas/Representation/Factory/PagerfantaFactory.php:40-42
if (null === $inline) {
$data = $pager->getCurrentPageResults();
if ($data instanceof \Traversable) {
$data = iterator_to_array($data, false);
}
$inline = new CollectionRepresentation($data);
} |
Has there been any progress on this issue? I'm hitting this problem at the moment. Is there a good workaround? |
Hi,
when in PagerfantaFactory::createRepresentation() a new CollectionRepresentation for the current results is created.
If the current results are a Traversabe Object then it will use the function iterator_to_array -> which used the second default parameter true to include the object keys.
whereas I expected it to return the following:
change would be fairly simple:
The text was updated successfully, but these errors were encountered: