Answer the question
In order to leave comments, you need to log in
Why is $this partially hidden in Yii CActiveRecord?
Good evening. Please tell me, I need to get all the properties of the model inherited from CActiveRecord. Property getting code:
class MyModel extends CActiveRecord
{
public $property1;
public $property2;
public $property3;
public function getProperties()
{
foreach($this as $key => $value)
{
// ...
}
}
}
Answer the question
In order to leave comments, you need to log in
Problem solved. Instead of foreach($this...) I use foreach(get_object_vars('MyModel')...).
Just correctly gets the public properties I need
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question