propelorm/Propel — Issue #139: Setting a enum property to same value marks the object as modified.
Author: martinj
Created: 2011-10-12 14:32:24+00:00
State: open

If i try to set the same value on a enum property, the propel model->isModified() will return true.

With the following column declaration:

```xml

```

This is the generated setter in the base class:

```php
public function setOutEncoding($v)
{
if ($v !== null) {
$valueSet = DBTableFrontPeer::getValueSet(DBTableFrontPeer::OUT_ENCODING);
if (!in_array($v, $valueSet)) {
throw new PropelException(sprintf('Value "%s" is not accepted in this enumerated column', $v));
}
$v = array_search($v, $valueSet);
}

if ($this->out_encoding !== $v) {
$this->out_encoding = $v;
$this->modifiedColumns[] = DBTableFrontPeer::OUT_ENCODING;
}

return $this;
}
```

This sets $v to an int

```php
$v = array_search($v, $valueSet);
```
But $this->out_encoding is a string. (why or if this is correct i don't know)
Now it fails here since the current value is a string and we compare it to an int, thus marking this object as dirty.

```php
if ($this->out_encoding !== $v) {
```