Please help, how i can add dynamic varible in Yii CFormModel?
private function magic($name, $value) {
$this->$name = $value;
}
or
$form = new FormGenerate($attributes);
$form->temp = '1';
Show me Exception "Undetermined property" =(
Please help, how i can add dynamic varible in Yii CFormModel?
private function magic($name, $value) {
$this->$name = $value;
}
or
$form = new FormGenerate($attributes);
$form->temp = '1';
Show me Exception "Undetermined property" =(
In your class try something like this
class Test
{
public function __construct($x)
{
$this->{$x} = "dynamic";
}
}
$a = new Test("bar");
print $a->bar;
try changing your
$this->$name
to
$this->{$name}
to see what happens.