Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Enum in model update/save is required even though it's already filled

Hi, I'm having strange issue on Phalcon 2.0.X and don't really know how should I even debug it. I've created a simple mysql table made of a few columns. One of them is item_condition column which basicly is an enum with a few options. And here is the problem:

I'm unable to update/save this model because it's constantly returning error message: item_condition is required even though it's already there and remains untouched. It works well after changing that field to varchar so I think that it's some issue with comparing strings of enums (What it says it's basicly that 'State1' from database != 'State1' in model fulfiled from database. What should I do?

edit: looks like this problem is fixed in phalcon 2.1.x

edited Apr '16

I would suggest you to avoid using ENUM. Especially with ORM. The other way around would be to fill out your Model prior to update, with actual value from ENUM field from database. From my expirience with Phalcon's ORM, that kind of errors can be solved with:

skipAttributes ()

Sets a list of attributes that must be skipped from the generated INSERT/UPDATE statement

8 Reasons Why MySQL's ENUM Data Type Is Evil

When you should and should NOT use ENUM data type