[TYPO3-mvc] Enumeration

dennis ahrens dennis.ahrens at googlemail.com
Wed Apr 28 14:02:09 CEST 2010


Hi Felix,

an enumeration is something like a datatype.

e.g.: you have the property

/**
 * @var string
 */
protected $type;

only the values

string
int
date

are valid in this case.

PHP does not ship any support for enumerations like java does. I'm
interested in the "best practice" to realize this with PHP
respectively extbase.

regards
dennis

2010/4/28 Felix Oertel <mehl at foertel.com>:
> hi,
>
> Am 28.04.10 12:55, schrieb dennis ahrens:
>>
>> 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?
>
> I don't really understand, what you're trying to do. ;-) Do you have an
> usecase / example at hand?
>
> I implemented an enumerator as fluid-viewHelper:
>
> <f:for each="{myObject.images}" as="image">
>        <f:enumerator as="counter" offset="1">
>                <this:image photo="{image}" id="pic-{counter}" />
>        </f:enumerator>
> </f:for>
>
> this will count up $counter (starting with 1) on every run through f:for.
>
> regards, foertel
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>


More information about the TYPO3-project-typo3v4mvc mailing list