symphonycms / remote_datasource

An improved datasource to fetch data from TXT, CSV, XML and JSON sources.
Other
14 stars 9 forks source link

Dependencies on datasource-parameters don't seem to work #38

Open twiro opened 6 years ago

twiro commented 6 years ago

A remote datasource doesn't seem to properly set other datasource-parameters that are used in the remote-datasource-url as dependencies.

This seems to be a bug, because the remote datasource won't work as expected if the needed datasource-parameter isn't available at the execution time of the remote-datasource.

Example

The url for my remote datasource looks like this:

 http://api.domain.com/downloads/{$ds-page.system-id}/

The datasource-parameter $ds-page.system-id is created by another datasource that's attached to the same page.

When trying to make this work I didn't get any results from the remote datasource because the parameter $ds-page.system-id wasn't available. I needed to manually add it as a dependency to the __construct-function to make the remote datasource work as expected:

public function __construct($env=NULL, $process_params=true)
{
    parent::__construct($env, $process_params);
    $this->_dependencies = array(
        '$ds-page.system-id'
    );
}

Setup:

nitriques commented 6 years ago

Thanks @twiro I agree that it would be nice to support this, since it is a "standard" feature.