CGridView relational field not required

Hi @all

i,m go from php 5.2 to 5.3

and i get a error when use CGridView , relational fields and this fileds is not required

the field not required is "id_sector"

the error

my code

in the model

    public function relations()


        return array(

                'sector' => array(self::BELONGS_TO, 'Sector', 'id_sector'),



    public function search()


  $sort = new CSort();


  $sort->attributes = array(




      'desc'=>' desc',




      'desc'=>'sector.descripcion desc',




      'desc'=>'t.timestamp desc',



        $criteria=new CDbCriteria;


                $sort->defaultOrder = 't.timestamp DESC';






        return new CActiveDataProvider('Ticket', array(






in the view

<?php $this->widget('zii.widgets.grid.CGridView', array(




        'summaryText'=>'Mostrando {start}-{end} de {count}',











)); ?>

help !


I’m not sure I “solved” the problem

but it works!!

    public function actionAdmin()


        $model=new Ticket('search');



        error_reporting(E_ALL ^ E_NOTICE);





You have an error because if you try to access a property on a non-object you get a notice.

Is not a question of version of php, just a question of errorReporting.

I can advice you to use E_ALL and correct your code in the view:

 array('name'=>'id_sector','sortable'=>'true','value'=>'($data->sector)?$data->sector->descripcion:"no sector"'),

thanks !!!!

work fine!