Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running the snippet in modRestController causing error because active resource is required #63

Open
travisbotello opened this issue Feb 8, 2019 · 0 comments

Comments

@travisbotello
Copy link

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 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 for makeUrl. Is it possible to add a property to define a custom resource/id to generate the link for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant