Pollenware/patio — pull request #41 by mbenedettini (2012-08-21 18:43:49+00:00)
Title: Custom getters

This feature allows you to put a custom getter to make some transformation to the returning value before it is actually returned. The syntax and concept is similar to custom setters.

An important decision is to use this.__values to get the values to be saved when inserting/updating instead of using getters. As I understand it, custom getters make transformations that should not be considered when saving fields to the database, as they are intended to modify or format values coming from the database. This behaviour is also consistent with setters: validate or check the value being set before sending it to the database.

Example:

```
var User = patio.addModel("user", {
instance : {
_getFirstName : function(firstName){
// First name must be always returned as uppercase
return firstName.toUpperCase();
}
}
});
```