sulu / SuluArticleBundle

Bundle for managing localized content-rich entities like blog-posts in the Sulu content management system
MIT License
57 stars 77 forks source link

Better error message then "Notice: Undefined index: type" when forgetting translation for types #612

Open alexander-schranz opened 2 years ago

alexander-schranz commented 2 years ago
Q A
Bug? no
New Feature? no
SuluArticleBundle Version Specific version or SHA of a commit
Sulu Version Specific version or SHA of a commit

Actual Behavior

Currently if you define a new type and forget to configure it in the sulu_article configuration. The following error appears:

Notice: Undefined index: type

This is confusing developer as they don't know what they did wrong

Expected Behavior

A better error message should be shown so the know they forget to define the type translation in sulu_article config.

Steps to Reproduce

Create a template with a new type but do not configure it in sulu_article.

Possible Solutions

For people running into this issue the solution is always to configure the article type translation. See https://github.com/sulu/SuluArticleBundle/blob/2.x/Resources/doc/article-types.md#sulu-admin-translations

For the issue the solution is add better checking for type and created configuration. Best would be to fail already in a compilerpass.

This issue appeared in slack and so I want to make sure other can find it here.