Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As we are converting all the things to utility classes/OO it makes sense to also do the same from drupal_map_assoc. Give it a nice new home with the other utility classes.
Comment | File | Size | Author |
---|---|---|---|
#9 | 2004798-9.patch | 62.23 KB | damiankloip |
#9 | interdiff-2004798-9.txt | 1.04 KB | damiankloip |
#7 | 2004798-6.patch | 62 KB | damiankloip |
#4 | 2004798-4.patch | 58.7 KB | damiankloip |
#2 | 2004798.patch | 58.87 KB | damiankloip |
Comments
Comment #1
damiankloip CreditAttribution: damiankloip commentedWorking on this.
Comment #2
damiankloip CreditAttribution: damiankloip commentedI have created a new MapArray utility class. We also have DiffArray and NestedArray. Could this live in with one of those? or is an explicit class better? or could we consolidate with DiffArray and have Array{something} (whatever name) and include diffAssocRecursive and mapAssoc methods?
Comment #4
damiankloip CreditAttribution: damiankloip commentedComment #5
dawehnerWe have a string utility so what about just use Array here?
So what about Array::map ?
Could you find a test for this function? This would be a perfect candidate for a unit test.
Comment #7
damiankloip CreditAttribution: damiankloip commentedAlas, we can't name a class 'Array' in php... So how about DrupalArray? Also changed the method name just to 'map'.
Yeah, I don't think this is teste at all yet, so added some unit tests.
Comment #9
damiankloip CreditAttribution: damiankloip commentedSomehow that one slipped through the net, even though I changed the name with PHPStorm.... ;)
Comment #11
dawehnerIt seems to be that this is a good usecase for dataproviders.
Comment #12
ParisLiakos CreditAttribution: ParisLiakos commentedhmm #1973312: Move drupal_map_assoc to a MapArray Utility Component