I deveoped an extra for a client that would allow them to generate PDFs from a resource and upload it to amazon S3.
This takes the form of a plugin that runs 'OnDocFormSave', it uses $modx->getChunk to generate some HTML which it then passes to DOMPDF to generate the PDF. In the rendered chunk is an image+ snippet call to get the resource's image+ TV.
Now this was all working absolutely fine, but the client asked me to make a couple of changes to the PDF (change some wording, add an extra image using Image+ and include the resource's ID in the header) and now suddenly the resource doesn't save, the save bar just gets stuck in a loop until I refresh.
If I check my error logs I see:
PHP Fatal error: Call to a member function get() on a non-object in core/cache/v3Pyu45cTiNHtyEvFo6ADOULJ3oq859K/includes/elements/modsnippet/105.include.cache.php on line 23
Snippet 105 is ImagePlus, and line 23 is:
$docid = $modx->getOption('docid', $scriptProperties, $modx->resource->get('id'), true);
So, I have worked out that if I remove the original ImagePlus snippet call (the new one I added still works fine) then the resource will save and generate its PDF (albeit without the image).
But I can't figure out why the image that has been working this whole time now suddenly won't, and why the extra ImagePlus call does work.
And just to confuse things slightly more, I checkout out an old commit from before these changes that I new to be working and reset the DB back to an old dump and
still have the same issue.
Hopefully I've explained my issue ok, because it is a somewhat confusing one (at least to me), any help anyone could give would be great, I've been pulling my hair out with this today.
Thanks.