Issue Bug Closed

#106920None enum support for the scheduler api?

C. Gogolin 06/21/25, 14:53 updated 06/21/25, 19:27

Description

I have already created several tasks for the planner. In the new task, I wanted to use PHP enums (https://www.php.net/manual/en/language.types.enumerations.php).

However, I always get the following message when I try to create a new task:

Fatal error: Case NEWS_STORAGE_PAGE_ID of non-backed enum 
Cylancer\CyMailToNews\Domain\Model\ConfigurationKey must not 
have a value in /var/www/vhosts/hb49wwpk.web26.alfahosting-server.de/development.ortsfeuerwehr-letter.de/htdocs/typo3conf/ext/cy_mail_to_news/Classes/Domain/Model/ConfigurationKey.php 
on line 16

even though enum ConfigurationKey

<?php
namespace Cylancer\CyMailToNews\Domain\Model;

enum ConfigurationKey
{
case NEWS_STORAGE_PAGE_ID = 'newsStoragePageId';
case TITLE_TEMPLATE = 'titleTemplate';
...

The complete code is published at https://github.com/docmcfly/cyMailToNews/tree/develop .

I really don’t know what I’m doing wrong…

I would appreciate any helpful advice, or is it perhaps a bug?

Clemens

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 3

  1. Garvin Hicking commented and changed status New Needs Feedback 06/21/25, 16:11

    Hi! I think this is not a TYPO3 issue specifically.

    Have you tried a backed enum instead how the error message suggests?

    Try “enum ConfigurationKey: string” instead of “enum ConfigurationKey” to make it backed.

  2. C. Gogolin commented 06/21/25, 18:10

    Thank you very much… that was the right tip. I come from the Java world professionally and simply overlooked the ‘:string’. I only use PHP in my free time for volunteer projects. Thank you. Thank you, thank you…

    The ticket can be closed.

  3. Garvin Hicking commented and changed status Needs Feedback Closed 06/21/25, 19:27

    You’re welcome, no worries – and glad I could help.

    Maybe you want to check out our TYPO3 slack or talk.typo3.org – we can give good support there! :-)

    Have a nice weekend.