Active
Project:
Drupal core
Version:
main
Component:
entity system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
30 Nov 2012 at 10:39 UTC
Updated:
13 May 2026 at 18:06 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
damiankloip commentedNot sure how this would have an impact on that...
Comment #3
damiankloip commentedd8.typed-array-list-methods.patch queued for re-testing.
Comment #5
damiankloip commentedWell, that's a different failure... :)
Comment #6
damiankloip commentedd8.typed-array-list-methods.patch queued for re-testing.
Comment #8
damiankloip commentedDifferent fail yes again, and the EntityTranslation fail again.
Comment #9
dawehnerNeeds reroll. This method should be required in way more places now.
Comment #10
David Hernández commentedThis looks like an API addition and I think it needs to be approved first.
Comment #11
David Hernández commentedOops, removed the other tag...
Comment #12
pwolanin commentedshould be tpArray() ?
Comment #13
alansaviolobo commentedI think the following classes also need to implement the methods once they are added to the interface.
DateTimeFIeldItemList
EntityReferenceFIeldItemList
FieldItemList
ItemList
Sequence
Comment #14
rpayanmPatch to review it :)
Comment #16
rpayanmfixing...
Comment #19
berdirYeah, sorry, should be toArray().
Comment #20
rpayanmComment #21
rpayanmUps... It's .patch :)
Comment #22
yched commentedComing from #2354485: Harmonize toArray() / getValue() on Entity / FieldItemList / FieldItem.
- setArray() looks fine as a use case, but it would better be named setItems() ?
(aligns with appendItem() & clearItems() added in #2164601: Stop auto-creating FieldItems on mere reading of $entity->field[N])
- in the interfaces where it currently exists, toArray() returns a fully-arrayified structure, safe for dsm(), and is thus what we advertise for easy debug output:
dsm($entity->toArray());
dsm($entity->field[0]->toArray());
That is not what the ItemList::toArray() method added here does : $entity->field->toArray(), being an array of FieldItem objects, would make dsm() die.
--> maybe getItems() for "return the Items as an array" ?
Comment #23
jhedstromCan this not be done now?
Comment #26
tstoecklerIMO instead of adding
toArray()toListInterfacewe should move it up fromComplexDataInterfacetoTraversableTypedDataInterface. With this patch we have identical methods onComplexDataInterfaceandListInterface, which is pointless and makes it harder for code that generically works with traversables.See also #2298687: Sequence and Mapping implement interfaces incorrectly, make them honest about what they support.
Comment #27
jose reyero commentedThis is good and will simplify many other patches.
Fully agree with @yched #22 @tstoeckler #26
About the patch, instead of implementing it for sequence, we could just rename the existing getElements() to the new method (getItems?), we don't need to have both.
If no one else is working on this I may try a re-roll incorporating these latest comments...
Comment #28
tstoecklerKnock yourself out! :-)
Like I did in #2298687: Sequence and Mapping implement interfaces incorrectly, make them honest about what they support #22-2 should be easy with
iterator_to_array().Comment #42
smustgrave commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #43
smustgrave commentedwanted to bump this 1 more time.
Comment #45
smustgrave commentedNot comfortable closing but seems like consensus was "something" can be done just not clear what.