Note that there are some explanatory texts on larger screens.

plurals
  1. POCActiveRecord and "Trying to get property of non-object" error
    primarykey
    data
    text
    <p>In Yii Framework with a CGridView i need to read a value from CActiveRecord</p> <p>the columns definition in CGridView is for columns:</p> <pre><code>'columns'=&gt;array( .... array( 'name'=&gt;'rel_CustomerCampain.event_comment', 'header'=&gt;'Commenti Camp.', 'value'=&gt;'print_r($data-&gt;rel_CustomerCampain,false)' ), ..... </code></pre> <p>I have this object $data->rel_CustomerCampain and I need to have the value in event_comment under the "_attributes:CActiveRecord:private" the value: <strong><em>*</em></strong><em>IneedOfThisValue</em><strong>**</strong></p> <p>when I try 'value'=>'$data->rel_CustomerCampain->event_comment'</p> <p>I have this error: <strong>"Trying to get property of non-object"</strong></p> <p>anyone has idea? thanks in advance....</p> <pre><code>[0] =&gt; customerCampain Object ( [_md:CActiveRecord:private] =&gt; CActiveRecordMetaData Object ( [tableSchema] =&gt; CMysqlTableSchema Object ( [schemaName] =&gt; [name] =&gt; tbl_customer_campain [rawName] =&gt; `tbl_customer_campain` [primaryKey] =&gt; id [sequenceName] =&gt; [foreignKeys] =&gt; Array ( [id_campain] =&gt; Array ( [0] =&gt; tbl_campain [1] =&gt; id ) [id_customer] =&gt; Array ( [0] =&gt; tbl_customer [1] =&gt; id ) ) [columns] =&gt; Array ( [id] =&gt; CMysqlColumnSchema Object ( [name] =&gt; id [rawName] =&gt; `id` [allowNull] =&gt; [dbType] =&gt; int(10) unsigned [type] =&gt; string [defaultValue] =&gt; [size] =&gt; 10 [precision] =&gt; 10 [scale] =&gt; [isPrimaryKey] =&gt; 1 [isForeignKey] =&gt; [autoIncrement] =&gt; 1 [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [id_campain] =&gt; CMysqlColumnSchema Object ( [name] =&gt; id_campain [rawName] =&gt; `id_campain` [allowNull] =&gt; [dbType] =&gt; int(10) unsigned [type] =&gt; string [defaultValue] =&gt; [size] =&gt; 10 [precision] =&gt; 10 [scale] =&gt; [isPrimaryKey] =&gt; [isForeignKey] =&gt; 1 [autoIncrement] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [id_customer] =&gt; CMysqlColumnSchema Object ( [name] =&gt; id_customer [rawName] =&gt; `id_customer` [allowNull] =&gt; [dbType] =&gt; int(10) unsigned [type] =&gt; string [defaultValue] =&gt; [size] =&gt; 10 [precision] =&gt; 10 [scale] =&gt; [isPrimaryKey] =&gt; [isForeignKey] =&gt; 1 [autoIncrement] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [event_datetime] =&gt; CMysqlColumnSchema Object ( [name] =&gt; event_datetime [rawName] =&gt; `event_datetime` [allowNull] =&gt; 1 [dbType] =&gt; datetime [type] =&gt; string [defaultValue] =&gt; [size] =&gt; [precision] =&gt; [scale] =&gt; [isPrimaryKey] =&gt; [isForeignKey] =&gt; [autoIncrement] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [event_type] =&gt; CMysqlColumnSchema Object ( [name] =&gt; event_type [rawName] =&gt; `event_type` [allowNull] =&gt; 1 [dbType] =&gt; varchar(200) [type] =&gt; string [defaultValue] =&gt; [size] =&gt; 200 [precision] =&gt; 200 [scale] =&gt; [isPrimaryKey] =&gt; [isForeignKey] =&gt; [autoIncrement] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [event_status] =&gt; CMysqlColumnSchema Object ( [name] =&gt; event_status [rawName] =&gt; `event_status` [allowNull] =&gt; 1 [dbType] =&gt; varchar(200) [type] =&gt; string [defaultValue] =&gt; [size] =&gt; 200 [precision] =&gt; 200 [scale] =&gt; [isPrimaryKey] =&gt; [isForeignKey] =&gt; [autoIncrement] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [event_comment] =&gt; CMysqlColumnSchema Object ( [name] =&gt; event_comment [rawName] =&gt; `event_comment` [allowNull] =&gt; 1 [dbType] =&gt; text [type] =&gt; string [defaultValue] =&gt; [size] =&gt; [precision] =&gt; [scale] =&gt; [isPrimaryKey] =&gt; [isForeignKey] =&gt; [autoIncrement] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) ) [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [columns] =&gt; Array ( [id] =&gt; CMysqlColumnSchema Object ( [name] =&gt; id [rawName] =&gt; `id` [allowNull] =&gt; [dbType] =&gt; int(10) unsigned [type] =&gt; string [defaultValue] =&gt; [size] =&gt; 10 [precision] =&gt; 10 [scale] =&gt; [isPrimaryKey] =&gt; 1 [isForeignKey] =&gt; [autoIncrement] =&gt; 1 [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [id_campain] =&gt; CMysqlColumnSchema Object ( [name] =&gt; id_campain [rawName] =&gt; `id_campain` [allowNull] =&gt; [dbType] =&gt; int(10) unsigned [type] =&gt; string [defaultValue] =&gt; [size] =&gt; 10 [precision] =&gt; 10 [scale] =&gt; [isPrimaryKey] =&gt; [isForeignKey] =&gt; 1 [autoIncrement] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [id_customer] =&gt; CMysqlColumnSchema Object ( [name] =&gt; id_customer [rawName] =&gt; `id_customer` [allowNull] =&gt; [dbType] =&gt; int(10) unsigned [type] =&gt; string [defaultValue] =&gt; [size] =&gt; 10 [precision] =&gt; 10 [scale] =&gt; [isPrimaryKey] =&gt; [isForeignKey] =&gt; 1 [autoIncrement] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [event_datetime] =&gt; CMysqlColumnSchema Object ( [name] =&gt; event_datetime [rawName] =&gt; `event_datetime` [allowNull] =&gt; 1 [dbType] =&gt; datetime [type] =&gt; string [defaultValue] =&gt; [size] =&gt; [precision] =&gt; [scale] =&gt; [isPrimaryKey] =&gt; [isForeignKey] =&gt; [autoIncrement] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [event_type] =&gt; CMysqlColumnSchema Object ( [name] =&gt; event_type [rawName] =&gt; `event_type` [allowNull] =&gt; 1 [dbType] =&gt; varchar(200) [type] =&gt; string [defaultValue] =&gt; [size] =&gt; 200 [precision] =&gt; 200 [scale] =&gt; [isPrimaryKey] =&gt; [isForeignKey] =&gt; [autoIncrement] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [event_status] =&gt; CMysqlColumnSchema Object ( [name] =&gt; event_status [rawName] =&gt; `event_status` [allowNull] =&gt; 1 [dbType] =&gt; varchar(200) [type] =&gt; string [defaultValue] =&gt; [size] =&gt; 200 [precision] =&gt; 200 [scale] =&gt; [isPrimaryKey] =&gt; [isForeignKey] =&gt; [autoIncrement] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [event_comment] =&gt; CMysqlColumnSchema Object ( [name] =&gt; event_comment [rawName] =&gt; `event_comment` [allowNull] =&gt; 1 [dbType] =&gt; text [type] =&gt; string [defaultValue] =&gt; [size] =&gt; [precision] =&gt; [scale] =&gt; [isPrimaryKey] =&gt; [isForeignKey] =&gt; [autoIncrement] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) ) [relations] =&gt; Array ( [relCustomer] =&gt; CBelongsToRelation Object ( [joinType] =&gt; LEFT OUTER JOIN [on] =&gt; [alias] =&gt; [with] =&gt; Array ( ) [together] =&gt; [scopes] =&gt; [name] =&gt; relCustomer [className] =&gt; customer [foreignKey] =&gt; id_customer [select] =&gt; * [condition] =&gt; [params] =&gt; Array ( ) [group] =&gt; [join] =&gt; [having] =&gt; [order] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) [idCampain] =&gt; CBelongsToRelation Object ( [joinType] =&gt; LEFT OUTER JOIN [on] =&gt; [alias] =&gt; [with] =&gt; Array ( ) [together] =&gt; [scopes] =&gt; [name] =&gt; idCampain [className] =&gt; TblCampain [foreignKey] =&gt; id_campain [select] =&gt; * [condition] =&gt; [params] =&gt; Array ( ) [group] =&gt; [join] =&gt; [having] =&gt; [order] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) ) [attributeDefaults] =&gt; Array ( ) [_model:CActiveRecordMetaData:private] =&gt; customerCampain Object ( [_md:CActiveRecord:private] =&gt; CActiveRecordMetaData Object *RECURSION* [_new:CActiveRecord:private] =&gt; [_attributes:CActiveRecord:private] =&gt; Array ( ) [_related:CActiveRecord:private] =&gt; Array ( ) [_c:CActiveRecord:private] =&gt; [_pk:CActiveRecord:private] =&gt; [_alias:CActiveRecord:private] =&gt; t [_errors:CModel:private] =&gt; Array ( ) [_validators:CModel:private] =&gt; [_scenario:CModel:private] =&gt; [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) ) [_new:CActiveRecord:private] =&gt; [_attributes:CActiveRecord:private] =&gt; Array ( [id] =&gt; 2155 [id_campain] =&gt; 4 [id_customer] =&gt; 109 [event_datetime] =&gt; [event_type] =&gt; [event_status] =&gt; [event_comment] =&gt; ******IneedOfThisValue***** ) [_related:CActiveRecord:private] =&gt; Array ( ) [_c:CActiveRecord:private] =&gt; [_pk:CActiveRecord:private] =&gt; 2155 [_alias:CActiveRecord:private] =&gt; t [_errors:CModel:private] =&gt; Array ( ) [_validators:CModel:private] =&gt; [_scenario:CModel:private] =&gt; update [_e:CComponent:private] =&gt; [_m:CComponent:private] =&gt; ) ) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload