I'll try to find time to add docs for it. See also http://stackoverflow.com/questions/24223329/how-do-i-create-getter-and-setter-overrides
@richardpringle Can you help to clarify this so I can document? Here are some questions I have:
<Model>.setter['myProp'] = function(val) {}; is val just the value of the property being set (that you can then manipulate)? That's what it looks like from the example in user.js but I want to confirm.@crandmck, I would talk to @raymondfeng about this. I haven't used _setters_ or _getters_ within LoopBack nor have I seen them used on a user-defined model, so I don't have an example but they are generally used to _get_ and _set_ private variables.
The code that defines them is in the model-builder in loopback-datasource-juggler if that helps at all.
@raymondfeng, would also be a good person to consult with on how much you should document and where that documentation should be located. I don't believe that using _getters/setters_ is a typical use case for models for the typical LoopBack user and could confuse people starting out with LoopBack.
@raymondfeng Please advise ^.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
@crandmck, I would talk to @raymondfeng about this. I haven't used _setters_ or _getters_ within LoopBack nor have I seen them used on a user-defined model, so I don't have an example but they are generally used to _get_ and _set_ private variables.
The code that defines them is in the model-builder in
loopback-datasource-jugglerif that helps at all.@raymondfeng, would also be a good person to consult with on how much you should document and where that documentation should be located. I don't believe that using _getters/setters_ is a typical use case for models for the typical LoopBack user and could confuse people starting out with LoopBack.