- Issue created by @nicxvan
- π¦πΊAustralia mstrelan
I didn't look too thoroughly, but ideally we can pass around the enum itself rather than the string backed values. Is that possible or are there too many bits to untangle?
- πΊπΈUnited States nicxvan
Honestly I'm not super familiar with what you mean, if you can point to an example I'm happy to modify this approach.
- π¦πΊAustralia mstrelan
I take it back, since these are used as array keys you need to use the scalar value.
The array structure is a bit weird though, maybe it would make sense to have a value object class instead of associative arrays. Maybe enum doesn't make sense after all. Let's see what others think?
- π³π±Netherlands bbrala Netherlands
The notorius temporary class.
I kinda agree that the whole enum dance doesn't really add much. If we are to change this a value object could make sense, or, since this is really only used in this class, perhaps just have class constants with limited visibility? Then we also scope it into this class where it is used, and then can clean up the .module file?
It is used in contrib though: https://git.drupalcode.org/search?group_id=2&scope=blobs&search=-path%3A...
so Limited visibility might not be a good idea.
- πΊπΈUnited States nicxvan
Yeah it's used in contrib, what benefit does the value object have over the enum?
- πΊπΈUnited States nicxvan
Yeah I think Enum is the proper approach here, these values are constant and don't change so a value object doesn't do anything.