Feels like it should be easy...
function flattenTags($t) {
return ($t['name']);
}
$tags = array($Fan->getTags());
$flat_tags = array_map('self::flattenTags', $tags);
$string_tags = join(', ', $flat_tags);
where tags is an array of objects each with multiple properties.
Error:
Cannot use object of type yii\\db\\ActiveQuery as array
In JS this is a simple array.map().join(). Can't get it to work with PHP. Please help!
EDIT: do I need some kind of await like JS?
asArray()?Call to a member function asArray() on array. So I cannot callasArray()because it is already an array, but when passing it to map it's not an array. Any ideas?