internetztube / craft-element-relations

Shows all relations of an element.
https://plugins.craftcms.com/element-relations
Other
2 stars 6 forks source link

Relations field breaking admin on multisite #31

Closed justinholtweb closed 4 months ago

justinholtweb commented 9 months ago

PHP version | 8.2.0 Craft edition & version | Craft Pro 4.7.0 Asset Usage | 3.2.0

In a Craft multisite install, occasionally entries in the admin will get an error when trying to render the data from the Relations field type when present. It doesn't happen all the time, but when it does it breaks the entry editing and page formatting heavily.

`Error: Call to a member function setTimezone() on bool in /home/forge/rogc.websitepreview.dev/vendor/internetztube/craft-element-relations/src/controllers/ElementRelationsController.php:29 Stack trace:

0 [internal function]: internetztube\elementRelations\controllers\ElementRelationsController->actionGetByElementId()

1 /home/forge/rogc.websitepreview.dev/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()

2 /home/forge/rogc.websitepreview.dev/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()

3 /home/forge/rogc.websitepreview.dev/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()

4 /home/forge/rogc.websitepreview.dev/vendor/craftcms/cms/src/web/Application.php(305): yii\base\Module->runAction()

5 /home/forge/rogc.websitepreview.dev/vendor/craftcms/cms/src/web/Application.php(606): craft\web\Application->runAction()

6 /home/forge/rogc.websitepreview.dev/vendor/craftcms/cms/src/web/Application.php(284): craft\web\Application->_processActionRequest()

7 /home/forge/rogc.websitepreview.dev/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()

8 /home/forge/rogc.websitepreview.dev/web/index.php(12): yii\base\Application->run()

9 {main}`

Screen Shot 2024-01-25 at 10 57 08 AM

internetztube commented 9 months ago

Thanks for Reporting! I'll take a look ASAP!

justinholtweb commented 9 months ago

@internetztube thank you. We are still in dev on the site so we haven't purchased the license for the plugin yet but will be in the next week or so before launch.

Note, I use this plugin on pretty much all the sites I have developed over the last year and this only looks to have happened on this multisite one. Its a very very handy plugin so thank you a bunch for developing and maintaining.

internetztube commented 9 months ago

I fixed this particular exception, but I'll need to do some more work on preventing those errors. I'll move this whole relation gathering onto the queue to make things more robust. Could you check if this fix solves your issue? Thanks!

internetztube commented 4 months ago

This should be fixed with the latest release. Thank you!