简体   繁体   中英

phalcon models must be modified with mysql columns' changes at the same time

if not,there will be an error:

Column 'xxxx' doesn't make part of the column map

i can't find any information to solve this problem

You have two options:

  1. You can update array with column map in method columnMap() to include changes in database table column names.

  2. You can remove the method columnMap() from Model class - this will disable checking if columns exist in database table, allowing You to ignore newly added fields. Changes to existing table columns can break existing code.

If You have control over the database schema, then use the first method, as this will prevent errors like only some of the database queries not working. Otherwise use the second method.

Here is a helpful link to Phalcon documentation on column mapping .

Phalcon comes with devtools which is a great command line tool to automate tasks like creating models and controllers. I'd recommend that you install this and generate model using command like phalcon model MODELNAME . Otherwise, you will have to manually change the model names in the columnmap located in the model class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM