I desperately try to call a simple setter method which seems to not exist.
Here is my modeldefinition:
var Process = Sequelize.MySql.define('Process',{
name: Sequelize.STRING,
description: Sequelize.TEXT,
duration: Sequelize.BIGINT,
status: {
type: Sequelize.ENUM(pstatus.unassigned,pstatus.assigned,pstatus.inprocess,pstatus.stopped,pstatus.finished),
defaultValue: pstatus.unassigned,
set: function(v){
console.log('Prozess status updated')
if(!pstatus.hasOwnProperty(v)){
return
}
this.setDataValue('status',v)
}
}
}
Every call of process.setStatus(pStatus.inprocess) returns in a TypeError
Possibly unhandled TypeError: Object [object SequelizeInstance] has no method 'setStatus'
What am I missing here?
Setters are implemented as javascript setters
This means that the setter will be invoked when you assign to the property
process.status = 'done' // this invokes the setter
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.