I have a CActiveDataProvider and i would like to obtain the value of one TITLE,
in my CDetailView
But i don’t know how to do it i tried
$is_serviceRecords->getData()
$is_serviceRecords->getData()->‘TITLE’
but don’t know how to use it
I would like to have this in my view
<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,//model show the list of Applications
'attributes'=>array(
'APPLICATION_ID',
'CURRENT_RELEASE_INST',
array(
'label'=>'IS Service Name',
'value'=>$is_serviceRecords->getData()->TITLE //is_serviceRecord is a CactiveDataProvider and should use the IS_SERVICE_ID foreign key to access to it's TITLE
),
),
));
CActiveDataProvider::getData() returns an array of model objects, not a single object.
But, um, it looks strange to me that you are using a CActiveDataProvider here. We usually use it for CGridView or CListView to display multiple records of data.
I think you could do it much more simple without using CActiveDataProvider.
Could you show us your table schema of ‘Application’ and ‘IsService’? (I don’t know the exact names, but something like those, I guess)
I’m sorry if I’m wrong, but I’m afraid that you are handling a simple BELONGS_TO relation with a very complicated wrong approach.