<p>The upcoming Craft 2.2 release added a getConstants() method to the <a href="http://buildwithcraft.com/classreference/enums/BaseEnum" rel="nofollow">BaseEnum</a> class so you'd be able to do:</p>

<pre><code>EnumClass::getConstants()
</code></pre>

<p>to get an array of all of the options in an enum.</p>

CC BY-SA 3.0
2014-08-29T17:44:16.983Z
Any info when it'll be available ?
maxx
CC BY-SA 3.0
2014-08-29T18:17:56.633Z
Very soon now...
Brad Bell
CC BY-SA 3.0
2014-08-29T17:30:59.130Z
2014-08-29T17:30:59.130Z
Brad Bell
<p>So I have a model with an Enum and I want a selectField for that Enum. Is there a DRY way to do that ? And if yes does it work with the translation-filter ?</p>

<templating><plugin-development><models>
From AttributeType::Enum in Model to a matching selectField?
# From AttributeType::Enum in Model to a matching selectField?

(Asked by: username_0 on 2014-08-29)

So I have a model with an Enum and I want a selectField for that Enum. Is there a DRY way to do that ? And if yes does it work with the translation-filter ?

**Tags:** templating, plugin-development, models


---

## 1 answers

### Answer by username_1 on 2014-08-29. Score: 1 | Accepted answer

The upcoming Craft 2.2 release added a getConstants() method to the BaseEnum class so you'd be able to do:
EnumClass::getConstants()

to get an array of all of the options in an enum.

> **Comments:**
> **username_0**: Any info when it'll be available ?  
> **username_1**: Very soon now...  

---

