I am struggling with extending a Plugin in OctoberCMS.
I need to access a protected property, so I wanted to create a new getter, that would return the value, but it always returns NULL
Here an example code of the controller (I cannot extend it here, as this is a 3rd party plugin):
class Records extends Controller
{
protected $some_value;
}
And this is how I implement it in the boot
method of my Plugin:
Records::extend(function($controller) {
$controller->addDynamicMethod('myValue', function() use ($controller) {
return $controller->some_value;
});
});
But this does not work. When I dump the $controller I get sth like this:
MyNamespace\MyPlugin\Controllers\Records {#1616 ▼
#some_value: "1"
...
But when I want to return the value, it is null.