I have an ActiveRecord class where I need to have some kind of dynamic variables in it.
The dynamic variable should be created for each existing variable. For example if I have a variable $test in my class, then it should also has $testDyn.
Example:
class User extends ActiveRecord
{
public $name;
public $age;
public $address;
/**
* dynamic vars
*/
public $nameDyn;
public $ageDyn;
public $addressDyn;
public function tableName()
{
return 'user';
}
...
}
There are ActiveRecords which have many variables and it would not be the best idea to do and manually create those dynamic vars for each variables. Are there any easy way / behavior which can do this?