0

在我的主机上出现此类错误,但在我的本地主机上没有错误。当我使用关系名称(如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'
        ),
    ),
)); ?>

谢谢。

4

1 回答 1

2

我认为您需要检查模型类的文件名!因为当你在 windows 下运行你的应用程序时,所有文件名都不区分大小写,但在基于 linux 的系统下 Yii 找不到它们。

于 2012-09-07T18:04:17.850 回答