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: Conflict with Visitor (on Transfer Member Data process) since Publisher update (2.8.3)

Status Resolved
Add-on / Version Publisher 2.8.3 build c996c438
Severity
EE Version 3.5.16

pixi

Jul 10, 2018

Hi Brian,

Here I come with another one : since I updated Publisher (for the past resolved bug) I have an error on Transfer Member Data process (this method is used to transfer existing members into Visitor channel) within Visitor (from DevDemon).

I got this :


Exception Caught
No such method getEntryId.

ee/EllisLab/ExpressionEngine/Library/Mixin/Manager.php:143
Stack Trace: hide details

  #0 ee/EllisLab/ExpressionEngine/Library/Mixin/Manager.php(109): EllisLab\ExpressionEngine\Library\Mixin\Manager->runMixins(‘getEntryId’, Array)
  #1 ee/EllisLab/ExpressionEngine/Library/Data/Entity.php(83): EllisLab\ExpressionEngine\Library\Mixin\Manager->call(‘getEntryId’, Array)
  #2 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(163): EllisLab\ExpressionEngine\Library\Data\Entity->__call(‘getEntryId’, Array)
  #3 user/addons/publisher/Service/Field/Type/RelationshipType.php(33): EllisLab\ExpressionEngine\Service\Model\Model->__call(‘getEntryId’, Array)
  #4 [internal function]: BoldMinded\Publisher\Service\Field\Type\RelationshipType->afterChannelEntrySave(Array)
  #5 user/addons/publisher/Service/Handler/FieldHandler.php(231): call_user_func_array(Array, Array)
  #6 user/addons/publisher/ext.publisher.php(441): BoldMinded\Publisher\Service\Handler\FieldHandler->call(‘afterChannelEnt…’, Array)
  #7 ee/legacy/libraries/Extensions.php(243): Publisher_ext->after_channel_entry_save(Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array)
  #8 ee/legacy/libraries/Extensions.php(138): EE_Extensions->call_class(‘Publisher_ext’, ‘after_channel_e…’, Array, Array)
  #9 [internal function]: EE_Extensions->call(‘after_channel_e…’, Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array)
  #10 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(642): call_user_func_array(Array, Array)
  #11 [internal function]: EllisLab\ExpressionEngine\Service\Model\Model->EllisLab\ExpressionEngine\Service\Model\{closure}(‘after_channel_e…’, Object(EllisLab\ExpressionEngine\Model\Channel\ChannelEntry), Array)
  #12 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(615): call_user_func_array(Object(Closure), Array)
  #13 [internal function]: EllisLab\ExpressionEngine\Service\Model\Model->EllisLab\ExpressionEngine\Service\Model\{closure}()
  #14 ee/EllisLab/ExpressionEngine/Service/Event/Emitter.php(153): call_user_func_array(Object(Closure), Array)
  #15 [internal function]: EllisLab\ExpressionEngine\Service\Event\Emitter->emit(‘afterSave’)
  #16 ee/EllisLab/ExpressionEngine/Library/Data/Entity.php(630): call_user_func_array(Array, Array)
  #17 [internal function]: EllisLab\ExpressionEngine\Library\Data\Entity->emit(‘afterSave’)
  #18 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(834): call_user_func_array(‘parent::emit’, Array)
  #19 ee/EllisLab/ExpressionEngine/Service/Model/Query/Insert.php(43): EllisLab\ExpressionEngine\Service\Model\Model->emit(‘afterSave’)
  #20 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(294): EllisLab\ExpressionEngine\Service\Model\Query\Insert->run()
  #21 ee/EllisLab/ExpressionEngine/Service/Model/DataStore.php(250): EllisLab\ExpressionEngine\Service\Model\DataStore->runQuery(‘Insert’, Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
  #22 ee/EllisLab/ExpressionEngine/Service/Model/Query/Builder.php(91): EllisLab\ExpressionEngine\Service\Model\DataStore->insertQuery(Object(EllisLab\ExpressionEngine\Service\Model\Query\Builder))
  #23 ee/EllisLab/ExpressionEngine/Service/Model/Model.php(361): EllisLab\ExpressionEngine\Service\Model\Query\Builder->insert()
  #24 ee/EllisLab/ExpressionEngine/Model/Content/ContentModel.php(198): EllisLab\ExpressionEngine\Service\Model\Model->save()
  #25 user/addons/visitor/Service/MembersSync.php(240): EllisLab\ExpressionEngine\Model\Content\ContentModel->save()
  #26 user/addons/visitor/Service/MembersSync.php(178): DevDemon\Visitor\Service\MembersSync->createMemberEntry(Array)
  #27 user/addons/visitor/mcp.visitor.php(146): DevDemon\Visitor\Service\MembersSync->syncMemberData()
  #28 [internal function]: Visitor_mcp->syncMembers()
  #29 ee/EllisLab/ExpressionEngine/Controller/Addons/Addons.php(1660): call_user_func_array(Array, Array)
  #30 ee/EllisLab/ExpressionEngine/Controller/Addons/Addons.php(920): EllisLab\ExpressionEngine\Controller\Addons\Addons->getModuleSettings(‘visitor’, ‘syncMembers’, Array)
  #31 [internal function]: EllisLab\ExpressionEngine\Controller\Addons\Addons->settings(‘visitor’, ‘sync-members’)
  #32 ee/EllisLab/ExpressionEngine/Core/Core.php(189): call_user_func_array(Array, Array)
  #33 ee/EllisLab/ExpressionEngine/Core/Core.php(94): EllisLab\ExpressionEngine\Core\Core->runController(Array)
  #34 ee/EllisLab/ExpressionEngine/Boot/boot.php(151): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))
  #35 admin_panel.php(143): require_once(’...’)
  #35 admin_panel.php(143): require_once(’...’)

And I can see on the Visitor channel that only some of the members have been transfered, but not entirely AND the publisher status appears instead of visitor ones (before it was visitor status followed by Publisher ones). I had the Ignore Settings setted for Visitor channel and visitor fields.

Do you see something you added on the last Publisher build that could cause this?

#1

BoldMinded (Brian)

This is an odd one. If you look at exp.publisher.php line 440 this is where the call stack starts in Publisher, then its calling Service/Field/Type/RelationshipType.php line 24. Usually when an error like “No such method getEntryId” or “can’t call method on null” means that the object isn’t of the expected type, or its null. So based on this info it sounds like $params[‘entry’] is not a valid ChannelEntry object, which it should be, and it looks like Visitor is responsible for passing the information along to the hook, so it may be passing something other than a ChannelEntry object. To find out, add this just before line 26 of RelationshipType.php

$logger = ee('publisher:FileLogger');
$logger->withBacktrace()->debug(get_class($params['entry']));

Then run the import and check cache/publisher/log.txt for the result and paste it here.

The beginning of that function should look like this after you add the logger lines:

public function afterChannelEntrySave(Array $params = [])
    {
        $logger = ee('publisher:FileLogger');
        $logger->withBacktrace()->debug(get_class($params['entry']));
        
        $saveStatus = $params['saveStatus'];
        $syncDrafts = $this->setting->get('sync_drafts');
        /** @var Language $language */
        $language = $params['language'];
        $languageId = $language->getId();
        /** @var EntryTranslation $entry */
        $entry = $params['entry'];
        $entryId = $entry->getEntryId();
#2

pixi

I just did what you tell me to do but don’t have a log.txt file located in the cache/piblisher folder (and his children folders)…

#3

BoldMinded (Brian)

Are you sure the cache folder is writable? It should definitely be there.

You can put those logger lines at the end of __construct in ext.publisher.php to make sure its working.

public function __construct()
    {
        if ($this->isUpdating()) {
            return;
        }

        $this->cache = ee(Cache::NAME);
        $this->channel = ee(Channel::NAME);
        $this->controlPanel = ee(ControlPanel::NAME);
        $this->entry = ee(Entry::NAME);
        $this->entryEvent = ee('publisher:EntryEvent');
        $this->entryResult = ee(EntryResult::NAME);
        $this->frontend = ee(Frontend::NAME);
        $this->helper = ee(Helper::NAME);
        $this->request = ee(Request::NAME);
        $this->requestCache = ee(RequestCache::NAME);
        $this->setting = ee(Setting::NAME);
        $this->session = ee(Session::NAME);
        $this->url = ee(Url::NAME);

        $logger = ee('publisher:FileLogger');
        $logger->withBacktrace()->debug('Testing...');
    }
#4

pixi

Yes the permission is 755. Nope, the log.txt is still not there after moving these lines from RelationshipType.php to ext.publisher.php :(

#5

BoldMinded (Brian)

Try replacing the logger lines in the RelationshipType.php file with just

var_dump($params['entry']); die;

and see what happens.

#6

pixi

It litteraly crashed my browser (by loading without ending) and my computer.

#7

BoldMinded (Brian)

Well, that is b/c its trying to dump the whole object, which is huge. Try

var_dump(get_class($params['entry''])); die;
#8

BoldMinded (Brian)

Or maybe this:

var_dump(get_class($params['entry''])); 
var_dump(get_class_methods(get_class($params['entry''])));
die;
#9

pixi

I tried this last one and got this :

string(52) "EllisLab\ExpressionEngine\Model\Channel\ChannelEntry" array(102) { [0]=> string(15) "set__entry_date" [1]=> string(8) "validate" [2]=> string(18) "validateMaxEntries" [3]=> string(16) "validateAuthorId" [4]=> string(16) "validateUrlTitle" [5]=> string(22) "validateUniqueUrlTitle" [6]=> string(12) "onBeforeSave" [7]=> string(11) "onAfterSave" [8]=> string(13) "onAfterInsert" [9]=> string(13) "onAfterUpdate" [10]=> string(14) "onBeforeDelete" [11]=> string(13) "onAfterDelete" [12]=> string(11) "saveTabData" [13]=> string(11) "saveVersion" [14]=> string(12) "getStructure" [15]=> string(10) "getDisplay" [16]=> string(23) "get__versioning_enabled" [17]=> string(15) "set__categories" [18]=> string(21) "populateAllowComments" [19]=> string(16) "populateChannels" [20]=> string(15) "populateAuthors" [21]=> string(25) "populateCommentExpiration" [22]=> string(14) "populateStatus" [23]=> string(13) "getAuthorName" [24]=> string(20) "getCustomFieldPrefix" [25]=> string(14) "hasCustomField" [26]=> string(15) "getCustomFields" [27]=> string(14) "getCustomField" [28]=> string(19) "getCustomFieldNames" [29]=> string(3) "set" [30]=> string(4) "fill" [31]=> string(4) "save" [32]=> string(11) "setProperty" [33]=> string(18) "getValidationRules" [34]=> string(19) "validateCustomField" [35]=> string(12) "fillProperty" [36]=> string(11) "hasProperty" [37]=> string(14) "getRawProperty" [38]=> string(14) "setRawProperty" [39]=> string(9) "getValues" [40]=> string(6) "__call" [41]=> string(5) "__get" [42]=> string(5) "__set" [43]=> string(7) "getName" [44]=> string(7) "setName" [45]=> string(13) "getPrimaryKey" [46]=> string(5) "getId" [47]=> string(5) "setId" [48]=> string(11) "getProperty" [49]=> string(5) "isNew" [50]=> string(11) "getModified" [51]=> string(6) "delete" [52]=> string(9) "setFacade" [53]=> string(14) "getModelFacade" [54]=> string(11) "getFrontend" [55]=> string(12) "setValidator" [56]=> string(12) "getValidator" [57]=> string(17) "getValidationData" [58]=> string(14) "validateUnique" [59]=> string(28) "validateUniqueWithinSiblings" [60]=> string(9) "typedLoad" [61]=> string(10) "typedStore" [62]=> string(8) "typedGet" [63]=> string(22) "typedSetAndForeignKeys" [64]=> string(10) "getTypeFor" [65]=> string(13) "createTypeFor" [66]=> string(16) "setSerializeData" [67]=> string(19) "getSubscribedEvents" [68]=> string(4) "emit" [69]=> string(18) "getAllAssociations" [70]=> string(24) "getAllBootedAssociations" [71]=> string(14) "hasAssociation" [72]=> string(14) "getAssociation" [73]=> string(14) "setAssociation" [74]=> string(5) "alias" [75]=> string(13) "addForeignKey" [76]=> string(10) "__toString" [77]=> string(9) "serialize" [78]=> string(11) "unserialize" [79]=> string(11) "__construct" [80]=> string(7) "__isset" [81]=> string(11) "getMetaData" [82]=> string(18) "getMetaDataByClass" [83]=> string(9) "addFilter" [84]=> string(7) "isDirty" [85]=> string(8) "getDirty" [86]=> string(11) "getOriginal" [87]=> string(11) "markAsClean" [88]=> string(7) "restore" [89]=> string(9) "getFields" [90]=> string(14) "getClassFields" [91]=> string(12) "getRawValues" [92]=> string(7) "toArray" [93]=> string(6) "toJson" [94]=> string(2) "on" [95]=> string(4) "once" [96]=> string(9) "subscribe" [97]=> string(11) "unsubscribe" [98]=> string(8) "hasMixin" [99]=> string(8) "getMixin" [100]=> string(15) "getMixinManager" [101]=> string(15) "setMixinManager" }
#10

BoldMinded (Brian)

I see what the issue is. I’ll get a new build to you today with a fix.

#11

BoldMinded (Brian)

Actually, I think this is a very easy fix. On line 33 of Service/Field/Type/RelationshipType.php change

<pre><code> $entryId = $entry->getEntryId(); <pre><code>

to

<pre><code> $entryId = $entry->getId(); <pre><code>

#12

pixi

Coooool it works! Thank you. (You changed this on the last build (2.8.3) or? Because the issue wasn’t there with the previous version…)

#13

BoldMinded (Brian)

A change I made in 2.8.3 (or maybe 2.8.2) necessitated this change. That getEntryId() line has been in the code since Publisher 2.0.

This change will be in the official 2.8.4 release.

#14

BoldMinded (Brian)

Glad this got sorted out. Sorry for the troubles and thanks for working through those var dumps with me. I should have recognized the change sooner in hindsight but the var dumps helped me get there 😊

Login to reply