Currently when using $pages->findRaw() to get a subfield value of a Page Reference field the returned value is always an array regardless of whether the derefAsPage setting for the field is "single page" or "multiple pages".
But in the situation shown above it would be preferable in a lot of cases if the returned value for colour.title was the string "Orange" rather than an array containing a single item. Often when I use findRaw() I have to foreach the result in order to get rid of these nested arrays and get the desired single value and it would be great if there was an option that avoided the need to do this.
Short description of the enhancement
Currently when using
$pages->findRaw()
to get a subfield value of a Page Reference field the returned value is always an array regardless of whether thederefAsPage
setting for the field is "single page" or "multiple pages".But in the situation shown above it would be preferable in a lot of cases if the returned value for
colour.title
was the string "Orange" rather than an array containing a single item. Often when I usefindRaw()
I have to foreach the result in order to get rid of these nested arrays and get the desired single value and it would be great if there was an option that avoided the need to do this.