T
T
trevoga_su2016-08-29 13:50:57
Yii
trevoga_su, 2016-08-29 13:50:57

How to overcome the error "Property not defined"?

When setting the value, an error occurs <<The property "NOrderServiceTransportMedium.product_id" is not defined>>
The field was added to the table manually, through alter table, i.e. not with main generation.
Model class:

class NOrderServiceTransportMedium extends CActiveRecord
{

  public function tableName()
  {
    return 'n_OrderServiceTransportMedium';
  }

  public function rules()
  {
    return [
      ['serv_id, order_num, tr_code, patient, product_id', 'length', 'max' => 200],
      ['serv_id, order_num, tr_code, patient, product_id', 'safe']
    ];
  }

  public function relations()
  {
    return [
    ];
  }
  
  public function attributeLabels()
  {
    return [
      'id' => 'ID',
      'name' => 'Name',
      'code_1c' => 'Code 1c',
    ];
  }
  
  public static function model($className=__CLASS__)
  {
    return parent::model($className);
  }
}

What could be the reason?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Inishev, 2016-08-29
@trevoga_su

Does the table have a field?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question