Hello guys
So, I need to set the value of a property (of a CActiveRecord model) just knowing its name, and in a first place, I thought that using reflections was the most simple method, cause with two lines is sufficient.
But, to my surprise is not possible cause a property of CActiveRecord model cannot being “set” (try it using the method canSetProperty()).
Following, the code that I use to set a property, but that as property is not accesible, it’s unseless.
$reflectionClass = new ReflectionClass('Questioner');
if($reflectionClass->hasProperty($property)){
$reflectionClass->getProperty($property)->setValue($questioner,$value);
}
[size="3"]
Why the property is not accesible?[/size]
Many Thanks
Roncone