propelorm/Propel — pull request #540 by rozwell (2012-12-22 19:15:22+00:00)
Title: Improved ENUM handling and added SQL value getters

Since ENUM values were handled only by *Query* filter methods, there was no proper way to add them to regular *Criteria* or even plain SQL.

This PR adds common method **Peer::getSqlValueForEnum($colname, $enumVal)** for later use by *Query* filters and SQL value getters (also takes care of value validation).

For example schema:
```yml
book:
id: ~
title: {type: varchar, required: true, primaryString: true}
status: {type: enum, required: true, valueSet: 'available,unavailable,sold_out', default: available}
```
There will be generated SQL method getter ```getStatusSqlValue()```:
```php
// (...)
$sqlStatus = BookPeer::getStatusSqlValue(BookPeer::STATUS_UNAVAILABLE); // returns 1 => SQL equivalent
$c = new Criteria();
$c->add(BookPeer::STATUS, $sqlStatus);
// (...)
```

TODO: tests and docs