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 result() on null” when running blocks_set_block_order hook on ignored cha
Status | Resolved |
Add-on / Version | Publisher Lite 2.7.3 |
Severity | |
EE Version | 3.5.15 |
David Clough
Jan 29, 2018We have Publisher Lite installed with Bloqs (3.3.3) and I am running against a number of problems.
We have a channel with a bloqs field. The channel in question is in the Publisher “ignored” list.
However, when we update a channel entry we first see the exception “Call to a member function result() on null” on …/system/user/addons/publisher/legacy/libraries/hooks/Publisher_bloqs_hooks.php:409. Upon refreshing the page the content of the bloqs field has been lost.
Do these hooks need to run, even for channels set as to be ignored by Publisher?
BoldMinded (Brian)
Sounds like I haven’t tested it with ignored fields or channels. Make this change to the beginning of that hook call and see what happens:
BoldMinded (Brian)
Actually, scratch that. Just a few lines down where it starts the conditional
Change it to this:
BoldMinded (Brian)
To answer your question, no I can’t just not trigger the hooks at all b/c some things do still need to execute, just not all of it.
David Clough
Adding that code block stops the error, but still clears out the bloqs in the entry after save. Making the following change allows the bloqs to be kept and updated
The exception being if the bloq has a relationship field in it’s settings, after saving the relationship is removed
BoldMinded (Brian)
Comment has been marked private.
BoldMinded (Brian)
Comment has been marked private.
David Clough
I have uploaded the provided amended file, along with the code changes described in previous comments. It is working better but bloqs with relationship fields are still an issue.
If I change the relationship value and save the entry the save completes but the relationship is lost, if I try and save the entry without changing the relationship i get the following exception:
BoldMinded (Brian)
That sounds like a fieldtype that Bloqs doesn’t recognize, or a fieldtype that might have been in a 2.x install and does not exist for EE 3, or a fieldtype was uninstalled but it didn’t remove its data from Bloqs. Add this to the file at line 329:
https://d.pr/i/ANXboI
David Clough
BoldMinded (Brian)
Change that var_dump to var_dump($blockId, $entryId, $rowId, $data);
Is this happening on every entry or one specific entry? Does it happen in non-ignored channels?
BoldMinded (Brian)
I just tested in EE4 and blocks save fine in an ignored channel. The Bloqs and Publisher codebases are the same in EE3 and 4, so I don’t expect anything there to be different. I’ll try to test on EE3 at some point today too.
David Clough
BoldMinded (Brian)
In your exp_blocks_block table do you have one with the ID of 15?
BoldMinded (Brian)
Comment has been marked private.
David Clough
Regarding your query with the exp_blocks_block table
There is no entry with the id is 15
There is one row with blockdefinition_id is 15
BoldMinded (Brian)
Can you provide CP access to a development site where the issue is occurring so I can take a look? If there is no row in the exp_blocks_block table with the id of 15, then it shouldn’t be trying to load a block with the id of 15.
BoldMinded (Brian)
Comment has been marked private.
David Clough
Comment has been marked private.
BoldMinded (Brian)
The CP login doesn’t seem to work.
David Clough
Comment has been marked private.
David Clough
Getting close to a resolution to the relationships issue with the following change
Will the change looking for the field type ‘bloqs’ instead of ‘blocks’ should be sufficient. Or is there a problem on our database end where references to ‘bloqs’ should be ‘blocks’.
BoldMinded (Brian)
David, I just stumbled upon this myself and came back to the ticket to give you an update, but it looks like you already found the fix. There is a small change in that getType method for EE4 fields not in a group, but other than that it appears to be working for me locally (I was able to replicate the issue).
BoldMinded (Brian)
Comment has been marked private.
BoldMinded (Brian)
Comment has been marked private.
David Clough
Hi Brian,
This issue has re-appeared again in the most recent build (2.8.2). Any suggestions would be greatly appreciated.
BoldMinded (Brian)
David, can you provide more information? Are you getting the exact same error reported in the original ticket? The last time I heard from you was in February… what has changed since then? Did you upgrade Publisher or Bloqs between now and then? If so what versions? What was the last version that worked correctly?
David Clough
Hi,
Using recent public builds of Publisher Lite and Bloqs (2.8.2/4.0.3) and latest Expression Engine (4.3.1).
Issue is not as initially reported, but how the issue developed across this thread. Here are the steps to recreate.
Add a relationship field to a channel. Issue occurs if field is in or outside a bloqs field.
Enable Publisher, but add channel to ignores list
Relationship does not save
Access details provided earlier in the thread should still be valid.
BoldMinded (Brian)
But it sounds like this issue was fixed, but started occurring again since Feb 17th with Publisher 2.7.5. If that is the case, you should have those previous zip files. Have you tried reverting one version at a time to see which version may have specifically broken it?
Also, access previously provided was deleted from the database when the ticket was first closed.
David Clough
I have had a quick look at the cause and it looks like the relationships are being stored in the ‘field/relationships’ request cache, but the cache is never used because the channel is ignored the afterChannelEntrySave function for the Relationship field type is never called to actually save the relationships.
I have a temporary workaround by commenting out line 433 in system/user/addons/publisher/ext.publisher.php (the after_channel_entry_save extension call). Thoughts on a more permanent solution to stop relationship data being deleted on ignored channels would be greatly appreciated.
BoldMinded (Brian)
Comment has been marked private.
BoldMinded (Brian)
Note that this fix is included in the 2.8.3 release.