AcclaroInc / craft-translations

Easily manage your Craft CMS website translations and drive global growth with simplified translation workflows.
https://plugins.craftcms.com/translations
Other
9 stars 12 forks source link

Impossible to access an attribute ("id") on a null variable. #475

Closed RubenColpaert closed 9 months ago

RubenColpaert commented 1 year ago

I receive the following error when going to the orders overview and trying to create a new order.

Twig\Error\RuntimeError: Impossible to access an attribute ("id") on a null variable. in /var/www/html/htdocs/vendor/acclaro/translations/src/templates/orders/_detail.twig:173
Stack trace:
#0 /var/www/html/htdocs/vendor/craftcms/cms/src/helpers/Template.php(129): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), NULL, 'id', Array, 'any', false, false)
#1 /var/www/html/htdocs/storage/runtime/compiled_templates/ec/ecdb6797b833f55ce90fbe204a9e5028.php(90): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), NULL, 'id', Array)
#2 /var/www/html/htdocs/vendor/twig/twig/src/Template.php(394): __TwigTemplate_70649076f286a0fef9905717046e1c28->doDisplay(Array, Array)
#3 /var/www/html/htdocs/vendor/twig/twig/src/Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#4 /var/www/html/htdocs/vendor/twig/twig/src/Template.php(379): Twig\Template->display(Array)
#5 /var/www/html/htdocs/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\Template->render(Array, Array)
#6 /var/www/html/htdocs/vendor/twig/twig/src/Environment.php(277): Twig\TemplateWrapper->render(Array)
#7 /var/www/html/htdocs/vendor/craftcms/cms/src/web/View.php(474): Twig\Environment->render('translations/or...', Array)
#8 /var/www/html/htdocs/vendor/craftcms/cms/src/web/View.php(527): craft\web\View->renderTemplate('translations/or...', Array)
#9 /var/www/html/htdocs/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(56): craft\web\View->renderPageTemplate('translations/or...', Array, 'cp')
#10 /var/www/html/htdocs/vendor/yiisoft/yii2/web/Response.php(1100): craft\web\TemplateResponseFormatter->format(Object(craft\web\Response))
#11 /var/www/html/htdocs/vendor/craftcms/cms/src/web/Response.php(337): yii\web\Response->prepare()
#12 /var/www/html/htdocs/vendor/yiisoft/yii2/web/Response.php(340): craft\web\Response->prepare()
#13 /var/www/html/htdocs/vendor/yiisoft/yii2/base/Application.php(390): yii\web\Response->send()
#14 /var/www/html/htdocs/web/index.php(15): yii\base\Application->run()
#15 {main}

For now I overcome this with a patch by updating the line https://github.com/AcclaroInc/craft-translations/blob/master/src/templates/orders/_detail.twig#L173 with

    tagGroupId: tagGroup ? tagGroup.id : null,
shnsumit commented 1 year ago

@RubenColpaert
Thank you for bringing this issue to our attention.

It appears that this issue is related to an edge-case scenario, specifically involving the deletion of the auto-created Craft Translation Tag group, which our code relies on for the tag flow during the order creation process. Craft settings -> Content -> Tags

image

We will take steps to handle this error more effectively in our upcoming hotfix release. You can expect the issue to be addressed and resolved in the near future.

shnsumit commented 9 months ago

Resolved in Release/3.3.1