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.