I am generating JSON objects using modRestController. Inside controller I'd like to use FileDownload-R snippet. I am calling it via runSnippet() to add the hashed download links to my JSON objects. This is failing with:
2019/02/08 16:12:06 [error] 4734#4734: *37304 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Call to a member function get() on null in /web/core/components/filedownloadr/model/filedownloadr/filedownloadr.class.php:1383
The problem is that in modRestController there is no active/current resource that could be used for makeUrl. Is it possible to add a property to define a custom resource/id to generate the link for?
I am generating JSON objects using
modRestController
. Inside controller I'd like to use FileDownload-R snippet. I am calling it viarunSnippet()
to add the hashed download links to my JSON objects. This is failing with:The error line in question is:
$url = $this->modx->makeUrl($this->modx->resource->get('id'), $ctx, @implode('&', $args));
The problem is that in
modRestController
there is no active/current resource that could be used formakeUrl
. Is it possible to add a property to define a custom resource/id to generate the link for?