Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Call to a member function getAtomDefinitions() on null after saving entry

Status Resolved
Add-on / Version Bloqs 4.3.2
Severity
EE Version 6.0.0-b.2

Michael Coogan

Oct 28, 2020
Call to a member function getAtomDefinitions() on null
user/addons/bloqs/Controller/PublishController.php:862

Stack Trace: Please include when reporting this error
#0 user/addons/bloqs/Controller/PublishController.php(554): BoldMinded\Bloqs\Controller\PublishController->processFieldData(Array, Array, 'save', Array, 3)
#1 user/addons/bloqs/ft.bloqs.php(445): BoldMinded\Bloqs\Controller\PublishController->save(Array, 3, false)
#2 ee/legacy/libraries/api/Api_channel_fields.php(410): Bloqs_ft->post_save(' ')
#3 ee/ExpressionEngine/Model/Content/FieldFacade.php(220): Api_channel_fields->apply('post_save', Array)
#4 ee/ExpressionEngine/Model/Content/ContentModel.php(76): ExpressionEngine\Model\Content\FieldFacade->postSave()
#5 ee/ExpressionEngine/Model/Channel/ChannelEntry.php(412): ExpressionEngine\Model\Content\ContentModel->onAfterSave()
#6 [internal function]: ExpressionEngine\Model\Channel\ChannelEntry->onAfterSave()
#7 ee/ExpressionEngine/Service/Model/Model.php(855): call_user_func_array(Array, Array)
#8 ee/ExpressionEngine/Service/Model/Query/Update.php(51): ExpressionEngine\Service\Model\Model->emit('afterSave')
#9 ee/ExpressionEngine/Service/Model/DataStore.php(282): ExpressionEngine\Service\Model\Query\Update->run()
#10 ee/ExpressionEngine/Service/Model/DataStore.php(248): ExpressionEngine\Service\Model\DataStore->runQuery('Update', Object(ExpressionEngine\Service\Model\Query\Builder))
#11 ee/ExpressionEngine/Service/Model/Query/Builder.php(71): ExpressionEngine\Service\Model\DataStore->updateQuery(Object(ExpressionEngine\Service\Model\Query\Builder))
#12 ee/ExpressionEngine/Service/Model/Model.php(366): ExpressionEngine\Service\Model\Query\Builder->update()
#13 ee/ExpressionEngine/Model/Content/ContentModel.php(225): ExpressionEngine\Service\Model\Model->save()
#14 ee/ExpressionEngine/Controller/Publish/AbstractPublish.php(394): ExpressionEngine\Model\Content\ContentModel->save()
#15 ee/ExpressionEngine/Controller/Publish/Edit.php(508): ExpressionEngine\Controller\Publish\AbstractPublish->saveEntryAndRedirect(Object(ExpressionEngine\Model\Channel\ChannelEntry))
#16 [internal function]: ExpressionEngine\Controller\Publish\Edit->entry('3')
#17 ee/ExpressionEngine/Core/Core.php(268): call_user_func_array(Array, Array)
#18 ee/ExpressionEngine/Core/Core.php(118): ExpressionEngine\Core\Core->runController(Array)
#19 ee/ExpressionEngine/Boot/boot.php(160): ExpressionEngine\Core\Core->run(Object(ExpressionEngine\Core\Request))
#20 manage.php(154): require_once('...')
#20 manage.php(154): require_once('...')
#1

BoldMinded (Brian)

I’m going to take a guess and say you’re editing a page that has a block on it, but the block was either deleted from EE entirely, or it was removed from the field assignment list when editing the Bloqs custom field (not the block definition)?

#2

BoldMinded (Brian)

Or maybe editing a revision that contains information for a block, but that block definition was deleted? Regardless, it can’t find a requested block definition b/c it isn’t in the database anymore. Are you able to provide more information on this? E.g. the history of this field and its assigned blocks?

#3

Michael Coogan

Comment has been marked private.

#4

BoldMinded (Brian)

Name of the Bloqs field, a block, or an atom in a block? (screenshot maybe)

#5

BoldMinded (Brian)

Edit the PublishController.php file and you’ll see on line 821 the following conditional

if (is_null($block)) {
                $blockDefinitionId = intval($blockData['blockdefinitionid']);
                $blockDefinition = $this->findBlockDefinition($blockDefinitions, $blockDefinitionId);
            } else {
                $blockDefinition = $this->findBlockDefinition($blockDefinitions, $block->definition->id);
            }

Add this after it

if ($blockDefinition === null) { var_dump($blockDefinitionId, $block->definition->id); die; }

Then share a screenshot of your exp_blocks_blockdefinition table so we can see if the ID it’s requesting exists.

#6

BoldMinded (Brian)

Possible case of deprecated blocks: https://boldminded.com/support/ticket/2158

Block was assigned to an field, an entry was created using said block, then unassigned from the field so it does not appear as a selectable option in the Add Block menu, but since it is still assigned to the entry, the save action fails b/c the getBlockDefinitionsForField() method does not return a valid/current block id that is assigned to the field.

Login to reply