在带有 CGridView 的 Yii 框架中,我需要从 CActiveRecord 读取一个值
CGridView 中的列定义用于列:
'columns'=>array(
....
array(
'name'=>'rel_CustomerCampain.event_comment',
'header'=>'Commenti Camp.',
'value'=>'print_r($data->rel_CustomerCampain,false)'
),
.....
我有这个对象 $data->rel_CustomerCampain 并且我需要在“_attributes:CActiveRecord:private”下的 event_comment 中有值: * IneedOfThisValue **
当我尝试 'value'=>'$data->rel_CustomerCampain->event_comment'
我有这个错误: “试图获取非对象的属性”
有人知道吗?提前致谢....
[0] => customerCampain Object
(
[_md:CActiveRecord:private] => CActiveRecordMetaData Object
(
[tableSchema] => CMysqlTableSchema Object
(
[schemaName] =>
[name] => tbl_customer_campain
[rawName] => `tbl_customer_campain`
[primaryKey] => id
[sequenceName] =>
[foreignKeys] => Array
(
[id_campain] => Array
(
[0] => tbl_campain
[1] => id
)
[id_customer] => Array
(
[0] => tbl_customer
[1] => id
)
)
[columns] => Array
(
[id] => CMysqlColumnSchema Object
(
[name] => id
[rawName] => `id`
[allowNull] =>
[dbType] => int(10) unsigned
[type] => string
[defaultValue] =>
[size] => 10
[precision] => 10
[scale] =>
[isPrimaryKey] => 1
[isForeignKey] =>
[autoIncrement] => 1
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[id_campain] => CMysqlColumnSchema Object
(
[name] => id_campain
[rawName] => `id_campain`
[allowNull] =>
[dbType] => int(10) unsigned
[type] => string
[defaultValue] =>
[size] => 10
[precision] => 10
[scale] =>
[isPrimaryKey] =>
[isForeignKey] => 1
[autoIncrement] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[id_customer] => CMysqlColumnSchema Object
(
[name] => id_customer
[rawName] => `id_customer`
[allowNull] =>
[dbType] => int(10) unsigned
[type] => string
[defaultValue] =>
[size] => 10
[precision] => 10
[scale] =>
[isPrimaryKey] =>
[isForeignKey] => 1
[autoIncrement] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[event_datetime] => CMysqlColumnSchema Object
(
[name] => event_datetime
[rawName] => `event_datetime`
[allowNull] => 1
[dbType] => datetime
[type] => string
[defaultValue] =>
[size] =>
[precision] =>
[scale] =>
[isPrimaryKey] =>
[isForeignKey] =>
[autoIncrement] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[event_type] => CMysqlColumnSchema Object
(
[name] => event_type
[rawName] => `event_type`
[allowNull] => 1
[dbType] => varchar(200)
[type] => string
[defaultValue] =>
[size] => 200
[precision] => 200
[scale] =>
[isPrimaryKey] =>
[isForeignKey] =>
[autoIncrement] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[event_status] => CMysqlColumnSchema Object
(
[name] => event_status
[rawName] => `event_status`
[allowNull] => 1
[dbType] => varchar(200)
[type] => string
[defaultValue] =>
[size] => 200
[precision] => 200
[scale] =>
[isPrimaryKey] =>
[isForeignKey] =>
[autoIncrement] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[event_comment] => CMysqlColumnSchema Object
(
[name] => event_comment
[rawName] => `event_comment`
[allowNull] => 1
[dbType] => text
[type] => string
[defaultValue] =>
[size] =>
[precision] =>
[scale] =>
[isPrimaryKey] =>
[isForeignKey] =>
[autoIncrement] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
)
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[columns] => Array
(
[id] => CMysqlColumnSchema Object
(
[name] => id
[rawName] => `id`
[allowNull] =>
[dbType] => int(10) unsigned
[type] => string
[defaultValue] =>
[size] => 10
[precision] => 10
[scale] =>
[isPrimaryKey] => 1
[isForeignKey] =>
[autoIncrement] => 1
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[id_campain] => CMysqlColumnSchema Object
(
[name] => id_campain
[rawName] => `id_campain`
[allowNull] =>
[dbType] => int(10) unsigned
[type] => string
[defaultValue] =>
[size] => 10
[precision] => 10
[scale] =>
[isPrimaryKey] =>
[isForeignKey] => 1
[autoIncrement] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[id_customer] => CMysqlColumnSchema Object
(
[name] => id_customer
[rawName] => `id_customer`
[allowNull] =>
[dbType] => int(10) unsigned
[type] => string
[defaultValue] =>
[size] => 10
[precision] => 10
[scale] =>
[isPrimaryKey] =>
[isForeignKey] => 1
[autoIncrement] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[event_datetime] => CMysqlColumnSchema Object
(
[name] => event_datetime
[rawName] => `event_datetime`
[allowNull] => 1
[dbType] => datetime
[type] => string
[defaultValue] =>
[size] =>
[precision] =>
[scale] =>
[isPrimaryKey] =>
[isForeignKey] =>
[autoIncrement] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[event_type] => CMysqlColumnSchema Object
(
[name] => event_type
[rawName] => `event_type`
[allowNull] => 1
[dbType] => varchar(200)
[type] => string
[defaultValue] =>
[size] => 200
[precision] => 200
[scale] =>
[isPrimaryKey] =>
[isForeignKey] =>
[autoIncrement] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[event_status] => CMysqlColumnSchema Object
(
[name] => event_status
[rawName] => `event_status`
[allowNull] => 1
[dbType] => varchar(200)
[type] => string
[defaultValue] =>
[size] => 200
[precision] => 200
[scale] =>
[isPrimaryKey] =>
[isForeignKey] =>
[autoIncrement] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[event_comment] => CMysqlColumnSchema Object
(
[name] => event_comment
[rawName] => `event_comment`
[allowNull] => 1
[dbType] => text
[type] => string
[defaultValue] =>
[size] =>
[precision] =>
[scale] =>
[isPrimaryKey] =>
[isForeignKey] =>
[autoIncrement] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
)
[relations] => Array
(
[relCustomer] => CBelongsToRelation Object
(
[joinType] => LEFT OUTER JOIN
[on] =>
[alias] =>
[with] => Array
(
)
[together] =>
[scopes] =>
[name] => relCustomer
[className] => customer
[foreignKey] => id_customer
[select] => *
[condition] =>
[params] => Array
(
)
[group] =>
[join] =>
[having] =>
[order] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
[idCampain] => CBelongsToRelation Object
(
[joinType] => LEFT OUTER JOIN
[on] =>
[alias] =>
[with] => Array
(
)
[together] =>
[scopes] =>
[name] => idCampain
[className] => TblCampain
[foreignKey] => id_campain
[select] => *
[condition] =>
[params] => Array
(
)
[group] =>
[join] =>
[having] =>
[order] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
)
[attributeDefaults] => Array
(
)
[_model:CActiveRecordMetaData:private] => customerCampain Object
(
[_md:CActiveRecord:private] => CActiveRecordMetaData Object
*RECURSION*
[_new:CActiveRecord:private] =>
[_attributes:CActiveRecord:private] => Array
(
)
[_related:CActiveRecord:private] => Array
(
)
[_c:CActiveRecord:private] =>
[_pk:CActiveRecord:private] =>
[_alias:CActiveRecord:private] => t
[_errors:CModel:private] => Array
(
)
[_validators:CModel:private] =>
[_scenario:CModel:private] =>
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
)
[_new:CActiveRecord:private] =>
[_attributes:CActiveRecord:private] => Array
(
[id] => 2155
[id_campain] => 4
[id_customer] => 109
[event_datetime] =>
[event_type] =>
[event_status] =>
[event_comment] => ******IneedOfThisValue*****
)
[_related:CActiveRecord:private] => Array
(
)
[_c:CActiveRecord:private] =>
[_pk:CActiveRecord:private] => 2155
[_alias:CActiveRecord:private] => t
[_errors:CModel:private] => Array
(
)
[_validators:CModel:private] =>
[_scenario:CModel:private] => update
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
)