[TYPO3-mvc] Enumeration
Jochen Rau
jochen.rau at typoplanet.de
Thu Apr 29 09:44:16 CEST 2010
Hi Dennis.
On 28.04.10 12:55, dennis ahrens wrote:
> Hi list,
>
> has anyone implemented an enumeration as property for an entity or value object?
> What do you think about an exception throwing setter which just
> accepts the allowed values?
> Or do you prefer a own class, that represents the enumeration?
If you want to force the value of a property to be an item of an
enumeration, you can
- write your own property validator (only checked at reconstitution time
by now)
- check this in your setter (throw an exception or "normalize" the input)
- encapsulate the enumeration in a lightweight value object (with a set
of static constants)
- do some other workaround
(http://www.php.net/manual/de/language.oop5.php#87942)
- write a feature request to the php community ;-)
Regards
Jochen
More information about the TYPO3-project-typo3v4mvc
mailing list