Closed (fixed)
Project:
Webform Entity
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Feb 2012 at 21:37 UTC
Updated:
16 Dec 2014 at 16:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tim.plunkettThe results array is keyed by entity_id, in the order dictated by sort. Building a new array with numeric keys will ignore the order.
Comment #2
amitaibuI tried sorting by title, and it worked for me. Can you explain your scenario when it doesn't work?
Comment #3
damien tournoud commentedThis has only one effect if you entity controller is broken and doesn't respect the order of the loaded IDs. Which one is it?
Comment #4
tim.plunkettIn this case,
$results[$entity_type]contains an array with 4 items, in the order 2, 1, 4, 3.Before the patch, $options is an empty array, and as it's built, the keys go into numerical order, resulting in 1, 2, 3, 4.
By not building a new array, and just assigning the labels to the existing properly order keys, it works.
That said, I'm using http://drupal.org/project/webform_entity, which has resulted in me filing other bogus bugs...
But I do know that the efq returns a properly ordered set, and after this loop, they aren't ordered correctly anymore.
Comment #5
damien tournoud commentedEven if it is not properly documented, DrupalEntityControllerInterface::load() needs to return entities in the same order as passed in $ids. This is a bug in Webform Entity.
Comment #6
tim.plunkettThanks for your help, and patience with the misfiled bug reports :)
Comment #7
tim.plunkettComment #8
drewish commented@Damien Tournoud, is it just the order that's important or should all keys be returned? What about duplicates? Meaning if I request loading items array(3, 2, -99, 2, 4) what should come back?
Comment #9
drewish commentedComment #11
tizzo commentedCommitted (2 years later) thanks!.