2 개의 인스턴스 메소드로 간단한 모델을 설정했습니다. 라이프 사이클 콜백에서 이러한 메서드를 어떻게 호출 할 수 있습니까?Sails/Waterline의 lifecycle 콜백에서 모델 인스턴스 메서드를 호출하려면 어떻게해야합니까?
module.exports = {
attributes: {
name: {
type: 'string',
required: true
}
// Instance methods
doSomething: function(cb) {
console.log('Lets try ' + this.doAnotherThing('this'));
cb();
},
doAnotherThing: function(input) {
console.log(input);
}
},
beforeUpdate: function(values, cb) {
// This doesn't seem to work...
this.doSomething(function() {
cb();
})
}
};
여기 어떻게 할 수 있는지 설명하지 않습니다. 그들은 내가 염려하는 한 실제로 이것을 구축해야한다. 그것은 매우 일반적인 사용 사례이다. – light24bulbs