1.2releasedUnion Datasource
The Union Datasource extension allows you to combine multiple Data Sources to output as a single Data Source for the primary purpose of a unified pagination.
Clone URLhttps://github.com/brendo/uniondatasource.git
Add as a submodulegit submodule add https://github.com/brendo/uniondatasource.git extensions/uniondatasource --recursive
Compatibility
2.x.x | 2.1.x | 2.2.x | 2.3.x | 2.4.x | 2.5.x | 2.6.x | 2.7.0 | 2.7.1 | 2.7.2 | 2.7.3 | 2.7.4 | 2.7.5 | 2.7.6 | 2.7.7 | 2.7.8 | 2.7.9 | 2.7.10 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
No | No | 0.6 | 1.0.3 | No | 1.2 | No | No | No | No | No | No | No | No | No | No | No | No. Soon? |
Readme
Union Datasource
The Union Datasource extension allows you to combine multiple Data Sources to output as a single Data Source for the primary purpose of a unified pagination.
How do I use it?
Install this extension by copying
/uniondatasource
folder to your/extensions
folder. Then navigation to the System > Extensions page in the Symphony backend page, select the Union Datasource extension and then apply the "Enable/Install".Create your Data Sources as usual through the Datasource Editor
To Create your Union Datasource, create a new Datasource via the Datasource Editor, but choose Union Datasource as the Source. You can now add the datasources you created in Step 2.
Add the resulting Union Datasource to your frontend pages as you normally would
Dance!
Use case
You may have two sections, News and Tweets that you'd like to display as a single stream on the frontend. At the moment, this is difficult as the pagination for both these datasources is different and will start to lead to unpredictable results as you paginate through. Not to mention the complexity in XSLT to merge the two datasources together and sort the result.
This extension allows you to create your two datasources as you normally would, say 'Read News by Date' and 'Read Tweets by Date' complete with their own Filtering and Included Elements and then combine the two datasources together. A third datasource, which is the Union Datasource, is created which will control your Pagination and use it's name as the datasource root element in your XML.
Caveats
- Grouping doesn't work, and it's probably a long way off too
- Output parameters work, but are named according to the original datasource,
not the Union Datasource. For example, a Union DS called
read-all-news
that usesread-news
andread-twitter
would have output params ofread-news-*
andread-twitter-*
Credits
Credit to Nick Dunn as I pretty much extended his README.
Version history
Requires Symphony 2.5
- Support for Symphony 2.5+
- #35 Ensure values are actually added to the parameter pool
- Fix issues when using two datasources from the same section
- Support Forbidden/Required parameters
Requires Symphony 2.3
- #25 Fix Fatal error with Symphony 2.3.1
Requires Symphony 2.3
- Updated to use Symphony 2.3 Providers
- Support redirecting to a 404 page when no results are found
- Support required parameters
Symphony 2.2 to 2.2.x
Symphony 2.2 to 2.2.x
- Add
extension.meta.xml
file - Prevent some warnings from occurring
Symphony 2.2 to 2.2.x
- Preemptive support for Symphony 2.2.2's new ordering syntax
- Store Union Datasource alongside the version number
Symphony 2.2 to 2.2.x
- Support Required URL Parameter
- Support Redirect to 404 page when no results are found
Symphony 2.2 to 2.2.x
- Fix
RAND()
sorting bug - Ensure only valid Datasources are includable
Symphony 2.2 to 2.2.x
- Implemented an interface to build Union Datasources without having to hack modify any PHP
- Implement
DatasourceEntriesBuilt
delegate - Support RAND() ordering
- Add support for Associated Entry Counts
- Display correct XML result when there are no entries found
- Sorting by
system:id
andsystem:date
should work correctly
Symphony 2.2 to 2.2.x
- Don't
$process_param
in the backend context, fixes issue with required parameters - Ensure SectionManager and FieldManager classes are included
Symphony 2.2 to 2.2.x
- Fixed a critical bug that rendered the extension near useless. Thanks @tonyarnold for discovering and help debug.
Symphony 2.2 to 2.2.x
- Near complete rewrite to move all pagination and sorting into the SQL instead of using PHP.
Symphony 2.2 to 2.2.x
- Initial release