Tracker.recordAction hook parameter not accessible


#1

Hello,

to enrich the persited action recorded before within my plugin, I need to read from the $request parameter of the Tracker.recordAction hook.
unfortunately this parameter is protected and due to that cannot be used.

As a workaround I am currently using ReflectionClass to make this param accessible:


private function getPrivateProperyFromObject($obj, $property) {
        $reflector = new \ReflectionClass($obj);
        $classProperty = $reflector->getProperty($property);
        $classProperty->setAccessible(true);

        return $classProperty->getValue($obj);
}

Is there another way to retrieve the information?
Thank’s in advance!


(Matthieu Aubry) #2

Thanks for suggestion I’ve changed it as you suggested in: change parameter to public as suggested in Platform & Plugins forum: · matomo-org/matomo@305f165 · GitHub


#3

Well…that is basically the easiest solution. thank you!
Would it be possible to change $params of Tracker\Request.php to public as well?