I have this code:
$node = new Node();
Now I want to make the ‘Node’ object dynamic
I get the dynamic name from my config class, this works:
$var = Config::instance('modules/activities/config')->get('className');
$node = new $var();
But how can I write this in 1 line?
This doensn’t work:
$node = new Config::instance('modules/activities/config')->get('className')();
My colleague helped my out, I made a static function in my helper class:
now this is my code (looks a bit messy maybe):