在我的主机上出现此类错误,但我的localhost上没有错误。当我使用model.attribute
之类的关系名称显示值时,主机上的错误消失了。可能是什么问题?
这是我的模型:
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'),
);
}
这是视图文件:
<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'
),
),
)); ?>
感谢。
答案 0 :(得分:2)
我认为您需要检查模型类的文件名!因为当您在Windows下运行应用程序时,所有文件名都不区分大小写,但在基于Linux的系统下,Yii找不到它们。