lundi 1 octobre 2018

How to add a new property to Object with Reflection

For example we have an object "App". We need to get a ReflectionProperty of dynamic generated property. I try this code:

$var = 'property';
$obj->$var = new ReflectionProperty('App', $var);

But get the ReflectionException:

Property App::$property does not exist

How to add a property to App for using it as ReflectionProperty?





Aucun commentaire:

Enregistrer un commentaire