Skip to content

Commit c7d6e23

Browse files
authored
Merge pull request #43 from symphonycms/fix_issue-37-mixing-formats
Handle multiple transformers on the same request
2 parents b8907d7 + fc9e6d6 commit c7d6e23

File tree

2 files changed

+66
-63
lines changed

2 files changed

+66
-63
lines changed

data-sources/datasource.remote.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class RemoteDatasource extends DataSource implements iDatasource
77
{
88

9-
private static $transformer = null;
9+
private static $transformer = array();
1010
private static $url_result = null;
1111
private static $cacheable = null;
1212

@@ -1089,14 +1089,14 @@ public static function getTransformer($format)
10891089
{
10901090
$transformer = EXTENSIONS . '/remote_datasource/lib/class.' . strtolower($format) . '.php';
10911091

1092-
if (!isset(self::$transformer)) {
1092+
if (!isset(self::$transformer[$format])) {
10931093
if (file_exists($transformer)) {
10941094
$classname = require_once $transformer;
1095-
self::$transformer = new $classname;
1095+
self::$transformer[$format] = new $classname;
10961096
}
10971097
}
10981098

1099-
return self::$transformer;
1099+
return self::$transformer[$format];
11001100
}
11011101
}
11021102

extension.meta.xml

Lines changed: 62 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,65 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<extension id="remote_datasource" status="released" xmlns="http://getsymphony.com/schemas/extension/1.0">
3-
<name>Remote Datasource</name>
4-
<description>A datasource that consumes XML, JSON, CSV or TEXT content.</description>
5-
<repo type="github">https://github.com/symphonycms/remote_datasource</repo>
6-
<url type="issues">https://github.com/symphonycms/remote_datasource/issues</url>
7-
<url type="discuss">https://www.getsymphony.com/discuss/thread/110527/</url>
8-
<authors>
9-
<author>
10-
<name github="symphonycms" symphony="team">Symphony Team</name>
11-
</author>
12-
</authors>
13-
<releases>
14-
<release version="2.3.0" date="2017-07-12" min="2.4" max="3.x.x">
15-
- Bug fixes
16-
- Added compatibility with Symphony 2.7.x and 3.x.x
17-
</release>
18-
<release version="2.2.1" date="2015-12-01" min="2.4" max="2.6.x">
19-
- Fix for php 5.3 compat
20-
</release>
21-
<release version="2.2.0" date="2015-06-24" min="2.4" max="2.6.x">
22-
- Make CSV style configurable.
23-
- Fix `{$workspace}` path
24-
</release>
25-
<release version="2.1.3" date="2015-05-13" min="2.4" max="2.6.x">
26-
- Fix a bug with late static binding on PHP 5.3.
27-
</release>
28-
<release version="2.1.2" date="2014-12-17" min="2.4" max="2.6.x">
29-
- Fix the first cache of a result always resulting in an error
30-
- Abstract the transformers for better extensibility
31-
</release>
32-
<release version="2.1.1" date="2014-09-28" min="2.4">
33-
- Expose the CURL error via `httpError()`
34-
- Fix error with CSV importing
35-
</release>
36-
<release version="2.1.0" date="2014-06-25" min="2.4">
37-
- Add support for text format (a copy of the html response body)
38-
- Add some documentation
39-
</release>
40-
<release version="2.0.1" date="2014-06-24" min="2.4">
41-
- Clean-up
42-
</release>
43-
<release version="2.0.0" date="2014-05-06" min="2.4">
44-
- Add support for Symphony 2.4
45-
- Support CSV data format
46-
- Allow `$gateway` to be manipulated and `$data` to previewed
47-
- When the Datasource fails, data is added to the `?debug` page to assist in debugging
48-
- Allow no cache to be set
49-
- Sanitize XPath to allow for more complex queries
50-
</release>
51-
<release version="1.1.0" date="2013-02-19" min="2.3" max="2.4">
52-
- Officially release the extension
53-
- Add `url` to the resulting XML result so you can see what URL was actually fetched
54-
- Fix bug where a result would always be `stale`
55-
- Allow timeout to be user configurable in the Data Source Editor
56-
- Various PHP E_NOTICE fixes
57-
</release>
58-
<release version="1.0.0" date="2012-03-11" min="2.3">
59-
- Initial release
60-
</release>
61-
</releases>
3+
<name>Remote Datasource</name>
4+
<description>A datasource that consumes XML, JSON, CSV or TEXT content.</description>
5+
<repo type="github">https://github.com/symphonycms/remote_datasource</repo>
6+
<url type="issues">https://github.com/symphonycms/remote_datasource/issues</url>
7+
<url type="discuss">https://www.getsymphony.com/discuss/thread/110527/</url>
8+
<authors>
9+
<author>
10+
<name github="symphonycms" symphony="team">Symphony Team</name>
11+
</author>
12+
</authors>
13+
<releases>
14+
<release version="2.3.1" date="2019-01-16" min="2.4" max="3.x.x">
15+
- [#37](https://github.com/symphonycms/remote_datasource/issues/37) Fix error when multiple datasources are added to the same page with different formats.
16+
</release>
17+
<release version="2.3.0" date="2017-07-12" min="2.4" max="3.x.x">
18+
- Bug fixes
19+
- Added compatibility with Symphony 2.7.x and 3.x.x
20+
</release>
21+
<release version="2.2.1" date="2015-12-01" min="2.4" max="2.6.x">
22+
- Fix for php 5.3 compat
23+
</release>
24+
<release version="2.2.0" date="2015-06-24" min="2.4" max="2.6.x">
25+
- Make CSV style configurable.
26+
- Fix `{$workspace}` path
27+
</release>
28+
<release version="2.1.3" date="2015-05-13" min="2.4" max="2.6.x">
29+
- Fix a bug with late static binding on PHP 5.3.
30+
</release>
31+
<release version="2.1.2" date="2014-12-17" min="2.4" max="2.6.x">
32+
- Fix the first cache of a result always resulting in an error
33+
- Abstract the transformers for better extensibility
34+
</release>
35+
<release version="2.1.1" date="2014-09-28" min="2.4">
36+
- Expose the CURL error via `httpError()`
37+
- Fix error with CSV importing
38+
</release>
39+
<release version="2.1.0" date="2014-06-25" min="2.4">
40+
- Add support for text format (a copy of the html response body)
41+
- Add some documentation
42+
</release>
43+
<release version="2.0.1" date="2014-06-24" min="2.4">
44+
- Clean-up
45+
</release>
46+
<release version="2.0.0" date="2014-05-06" min="2.4">
47+
- Add support for Symphony 2.4
48+
- Support CSV data format
49+
- Allow `$gateway` to be manipulated and `$data` to previewed
50+
- When the Datasource fails, data is added to the `?debug` page to assist in debugging
51+
- Allow no cache to be set
52+
- Sanitize XPath to allow for more complex queries
53+
</release>
54+
<release version="1.1.0" date="2013-02-19" min="2.3" max="2.4">
55+
- Officially release the extension
56+
- Add `url` to the resulting XML result so you can see what URL was actually fetched
57+
- Fix bug where a result would always be `stale`
58+
- Allow timeout to be user configurable in the Data Source Editor
59+
- Various PHP E_NOTICE fixes
60+
</release>
61+
<release version="1.0.0" date="2012-03-11" min="2.3">
62+
- Initial release
63+
</release>
64+
</releases>
6265
</extension>

0 commit comments

Comments
 (0)