0

As stated by this solution, the workaround proposed works very well on dev and test SS environments. The suggested one is to avoid the current bug related to auto-publish files managed via DataObject $owns property.

But since I uploaded my project in production - on live env - the workaround doesn't work anymore.

In my case I'm working on a DataExtension of User model. The rest of implementation follows exactly the above mentioned case - with UploadField. In production, it seems that the snippet is ignored in its condition. In particular, this is my version:

UserExtension

// AllegatiDownload: many_many File type uploaded with UploadField
public function onAfterWrite()
{
    if ($this->owner->AllegatiDownloadID) { // <- This is being ignored in live version
        $this->owner->AllegatiDownload()->publishSingle();
    }

    parent::onAfterWrite();
}

If I try to replace

$this->owner->AllegatiDownloadID

with

$this->owner->AllegatiDownload()

The condition pass, but $this->owner->AllegatiDownload()->publishSingle() returns an untraced 500 exception. Just:

There was been an error

And, as I said, this happens only in production.

Thanks in advance for support.

  • Can you set up some logging on your live site to track the error caused when you see "There has been an error"? I don't know why model relationships would be any different between dev, test or live – scrowler Oct 19 '18 at 14:18
  • Sorry but no log being generated after this error. –  Oct 22 '18 at 07:38

1 Answers1

0

Today I flushed the project DB in order to upgrade a custom front-end component that interacts with it. Seems that after that flush, the issue being solved. That's pretty strange, because I tried many /dev/build?flush=all before, and nothing happened. Server cache maybe? I don't know. But now the workaround works as expected.

Thanks anyway for the support.