XF 2.0 User Activity Details with Array Keys?

Jaxel

Well-known member
In my entity, my primary key is an array, not a single column.

As such, I have made my activity details function as follows:
Code:
    public static function getActivityDetails(array $activities)
    {
        return self::getActivityDetailsForContent(
            $activities,
            \XF::phrase('EWRrio_viewing_stream_library'),
            ['service_id','stream_value1','stream_value2'],
            function(array $ids)
            {
                $streams = \XF::em()->findByIds(
                    'EWR\Rio:Stream',
                    $ids
                );

                $router = \XF::app()->router('public');
                $data = [];

                foreach ($streams AS $id => $stream)
                {
                    $data[$id] = [
                        'title' => $stream->stream_title,
                        'url' => $router->buildLink('ewr-rio/streams', $streams)
                    ];
                }

                return $data;
            }
        );
    }

Unfortunately, this returns an error:
ErrorException: [E_WARNING] Illegal offset type in isset or empty in src/XF/Entity/SessionActivity.php at line 53


How do I fix this?
 
pluckParam() only supports fetching a single parameter at a time, so you'd have to implement your own version of getActivityDetailsForContent() to do what you need.
 
Back
Top Bottom