When I dump all variables of a model in controller, I can see:
[CActiveRecord:_attributes] => array
(
'id' => '524'
'version' => '0'
'created' => '2015-06-24 12:37:27'
'documents_id' => '528'
)
How can I get for example 'documents_id' element and use it in that controller?
You have two ways:
1- Convert the Object to array
2- Use
Yii::app()->db->createCommand
instead of$this->loadModel($ID)
like the followings: