Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate issue where getters, setters not being called #116

Closed
DesignByOnyx opened this issue May 19, 2017 · 1 comment
Closed

Investigate issue where getters, setters not being called #116

DesignByOnyx opened this issue May 19, 2017 · 1 comment

Comments

@DesignByOnyx
Copy link
Contributor

This has bit me before where data did not go through the defined getters/setters where I had some business rules.

Another good use case just came up with someone who wanted to save an array in MySql, which does not support arrays natively like Postgres. They had a property defined like this:

    fieldsToValidate: {
         type: Sequelize.STRING,
         get() {
             return JSON.parse(this.getDataValue('verifyChanges'));
         },
         set(val) {
             this.setDataValue('verifyChanges', JSON.stringify(val));         }
     }

Results in the following error:

Failed to load resource: the server responded with a status of 400 (Bad Request)   
Error occurred:  
    Error: string violation: verifyChanges cannot be an array or an object
@DesignByOnyx
Copy link
Contributor Author

Closing in favor of #115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant