ryssbowh/craft-activity

Error saving eager-loading element

Closed this issue · 2 comments

We got this error when saving entry from our module which utilize eager loading to get related entries.

TypeError: Argument 1 passed to craft\fields\BaseRelationField::_all() must implement interface craft\elements\db\ElementQueryInterface, array given, called in /var/www/html/vendor/craftcms/cms/src/fields/BaseRelationField.php on line 473 and defined in /var/www/html/vendor/craftcms/cms/src/fields/BaseRelationField.php:1144 Stack trace: #0 /var/www/html/vendor/craftcms/cms/src/fields/BaseRelationField.php(473): craft\fields\BaseRelationField->_all() #1 /var/www/html/vendor/ryssbowh/craft-activity/src/traits/ElementFields.php(64): craft\fields\BaseRelationField->serializeValue() #2 /var/www/html/vendor/ryssbowh/craft-activity/src/recorders/Entries.php(115): Ryssbowh\Activity\base\recorders\ElementsRecorder->getCustomFieldValues() #3 /var/www/html/vendor/ryssbowh/craft-activity/src/base/recorders/ElementsRecorder.php(66): Ryssbowh\Activity\recorders\Entries->getFieldsValues() #4 /var/www/html/vendor/ryssbowh/craft-activity/src/recorders/Entries.php(51): Ryssbowh\Activity\base\recorders\ElementsRecorder->onSaved() #5 [internal function]: Ryssbowh\Activity\recorders\Entries->Ryssbowh\Activity\recorders\{closure}() #6 /var/www/html/vendor/yiisoft/yii2/base/Event.php(312): call_user_func() #7 /var/www/html/vendor/yiisoft/yii2/base/Component.php(642): yii\base\Event::trigger() #8 /var/www/html/vendor/craftcms/cms/src/base/Element.php(4211): yii\base\Component->trigger() #9 /var/www/html/vendor/craftcms/cms/src/elements/Entry.php(1712): craft\base\Element->afterSave() #10 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(2732): craft\elements\Entry->afterSave() #11 /var/www/html/vendor/craftcms/cms/src/services/Elements.php(785): craft\services\Elements->_saveElementInternal() #12 /var/www/html/modules/gac/src/controllers/IntegrationController.php(767): craft\services\Elements->saveElement() #13 /var/www/html/modules/gac/src/controllers/IntegrationController.php(242): modules\gac\controllers\IntegrationController->saveEntry() #14 [internal function]: modules\gac\controllers\IntegrationController->actionService() #15 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array() #16 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams() #17 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction() #18 /var/www/html/vendor/craftcms/cms/src/web/Application.php(295): yii\base\Module->runAction() #19 /var/www/html/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction() #20 /var/www/html/vendor/craftcms/cms/src/web/Application.php(280): yii\web\Application->handleRequest() #21 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest() #22 /var/www/html/web/index.php(22): yii\base\Application->run() #23 {main}

Application Info
PHP version 7.4.3
OS version Linux 5.10.104-linuxkit
Database driver & version MySQL 5.7.43
Image driver & version GD 7.4.3
Craft edition & version Craft Pro 3.9.1
Yii version 2.0.48.1
Twig version v2.15.5
Guzzle version 7.8.0

Plugins
Azure Blob Storage 1.0.1
Blitz 3.12.10
Cloudflare 1.1.0
CodeMirror 1.0.3
Colour Swatches 1.7.0
Control Panel CSS 2.4.0
Control Panel Nav 3.1.0
Embedded Assets 2.11.4
Field Manager 2.2.5
Fragments 1.1.4
Navigation 1.4.33
Neo 2.13.19
Page Builder 1.0.7
Redactor 2.10.12
Retour 3.2.11
SEOmatic 3.4.59
Stamp 2.1.0
Super Table 2.7.5.1
Typed link field 1.0.25
User Activity 1.3.10
vCard 1.2.1

Screenshot 2023-09-12 at 11 05 21 AM

Thanks for reporting, this has been fixed in 1.3.11

Hi @ryssbowh , thank you for the fix 👌🏼 I will close this one.