fuel/orm — Issue #136: Observer Typing: Enum now returns an array?
Author: lukearmstrong
Created: 2012-02-14 11:14:20+00:00
State: open

I recently updated Fuel Core and Packages for an existing site, and have noticed that model properties that use the data_type enum are now returning an array instead of a string.

**Relevant code from my model**

```php
protected static $_properties = array(
'visibility' => array(
'data_type' => 'enum',
'label' => 'Visibility',
'default' => 'All',
'options' => array(
'All',
'Logged In',
'VIP Only',
'Admin Only',
),
),
);

protected static $_observers = array(
'Orm\\Observer_Validation' => array(
'events'	=> array('before_save', 'validate'),
),
'Orm\\Observer_Typing' => array(
'events'	=> array('after_load', 'before_save', 'after_save'),
),
'Orm\\Observer_CreatedAt' => array(
'events'	=> array('before_insert'),
'property'	=> 'created_at',
),
'Orm\\Observer_UpdatedAt' => array(
'events'	=> array('before_save'),
'property'	=> 'updated_at',
),
'Orm\\Observer_Self' => array(
'events'	=> array('after_insert', 'after_update', 'after_delete'),
),
);
```

**What happens:**

```php
var_dump($product->visibility)
#>	array
#>	0 => string 'All' (length=3)
```

**What used to happen:**

```php
var_dump($product->visibility)
#>	string 'All' (length=3)
```

Setting the datatype to tinytext "fixes" it.

Is this a bug, or is enum supposed to do this? I quickly glanced at the latest commit and this may have introduced this behaviour?

I will test again on a fresh install at 1pm, and hopefully can come up with a fix if it is indeed a bug.