2012-09-07 4 views
0

내 호스트에서 이러한 유형의 오류가 발생하지만 내 localhost에는 오류가 없습니다. 관계 이름을 사용하여 값을 표시 할 때 호스트에서 오류가 사라집니다 (예 : model.attribute). 무엇이 문제 일 수 있습니까?Yii 비 객체의 속성을 얻으려고 시도합니다.

<h1>Управление операциями</h1> 

<?php $this->widget('bootstrap.widgets.BootGridView',array(
    'id'=>'operations-grid', 
    'type'=>'striped bordered', 
    'dataProvider'=>$model->search(), 
    //'filter'=>$model, 
    'columns'=>array(
     array(
      'name'=>'operationType', 
      'value'=>'$data->operationType->name', 
      'header'=>'Операция' 
     ), 
     array(
      'name'=>'creation_date', 
      'type'=>'datetime', 
      'header'=>'Дата создания' 
     ), 
     'ammount_usd:raw:Сумма', 
     'comment:text:Комментарий', 
     array(
      'name'=>'currency', 
      'value'=>'$data->currency->short', 
      'header'=>'Валюта', 
     ), 
     array(
      'name'=>'client', 
      'value'=>'$data->client->fio', 
      'header'=>'Клиент', 
     ), 
     array(
      'name'=>'organization', 
      'value'=>'$data->organization->name', 
      'header'=>'Организация', 
     ), 

     array(
      'class'=>'bootstrap.widgets.BootButtonColumn', 
      'header'=>'Action' 
     ), 
    ), 
)); ?> 

감사 :

여기
public function rules() 
{ 
    // NOTE: you should only define rules for those attributes that 
    // will receive user inputs. 
    return array(
     array('ammount, currency_id, operation_type', 'required'), 
     array('currency_id, operation_type, client_id, organization_id', 'numerical', 'integerOnly'=>true), 
     array('creation_date, modification_date, ammount, ammount_usd', 'length', 'max'=>10), 
    //array('ammount, currency_id, operation_type, client_id, organization_id,comment', 'safe'), 

     array('ammount, ammount_usd, currency_id, operation_type, client_id, organization_id, currency,comment, 
     operationType ,client, organization', 'safe', 'on'=>'search'), 
    ); 
} 

/** 
* @return array relational rules. 
*/ 
public function relations() 
{ 
    // NOTE: you may need to adjust the relation name and the related 
    // class name for the relations automatically generated below. 
    return array(
     'client' => array(self::BELONGS_TO, 'Client', 'client_id'), 
     'currency' => array(self::BELONGS_TO, 'Currencies', 'currency_id'), 
     'organization' => array(self::BELONGS_TO, 'Organizations', 'organization_id'), 
     'operationType' => array(self::BELONGS_TO, 'OperationType', 'operation_type'), 
     'operationsMeta' => array(self::HAS_MANY, 'OperationsMeta', 'operation_id'), 
    ); 
} 

보기 파일입니다

은 여기 내 모델입니다.

+0

오류 발생 줄은 무엇입니까? – Stu

+0

추적하는 동안 $ data-> client-> fio 라인에서 실패했음을 알게되었습니다. fio는 클라이언트 모델에 공용 getter가있는 가상 필드입니다. 이 코드가 로컬에서는 작동하지만 호스트 서버 –

+0

에서는 $ data-> client가 비어 있거나 특정 모델에 대한 레코드가 없다는 것을 알지 못한다는 이상이 있습니까? – Stu

답변

2

모델 클래스의 파일 이름을 확인해야한다고 생각합니다. Windows에서 응용 프로그램을 실행할 때 모든 파일 이름은 대소 문자를 구별하지 않으므로, Linux 기반 시스템에서는 Yii가 해당 파일을 찾지 못합니다.

+0

힌트를 thx, 아침에 그것을 시도하고 알려 드리겠습니다. –

관련 문제