[Solved] How to add new column to model?

Hello

This is not my script so I can’t pinpoint every single detail and I hope that somebody here will help me with the problem. So, I need new column in the mysql that will be displayed in the admin panel. I’ve added this column to the table, then I’ve changed attributeLabels() and rules(). The problem is that $model didn’t change. It has only older columns. Is there other dir besides /protected/models/ where the model is stored? Some sort of cache or something? I know that when I add this property to the module at the constructor then everything runs fine (except that the column is displayed without any text, even when there’s something in that mysql column).

Anyway the error message says: Property "SerwisView.my_col" is not defined.

Any help will be appreciated.

Did you add the column information to the rules section? That might be the problem.




    public function rules()

    {

        return [

            [['org_id','frequency'], 'integer'],

            [['title'], 'required'],

			[['document'],'string','max' => 255],

            [['description'], 'string'],

            [['base_fee','per_unit_fee', 'discount'], 'number'],

            [['title'], 'string', 'max' => 100],

			[['attachment'], 'file', 'skipOnEmpty' => true, 'extensions' => 'pdf, doc, docx'],

            [['org_id'], 'exist', 'skipOnError' => true, 'targetClass' => Organization::className(), 'targetAttribute' => ['org_id' => 'id']],

        ];

    }



You would probably get more help though if you posted your Model code here so we can see what you’re doing.

Thanks for your reply. There were rules for this column. I am blind or something ;) I didn’t take a look at the mysql views. So, I altered the view and now everything is working fine. Sorry for the fuss.