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.x2.1.x2.2.x2.3.x2.4.x2.5.x2.6.x2.7.0
NoNo0.61.0.3No1.2NoNo. 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?

  1. 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".

  2. Create your Data Sources as usual through the Datasource Editor

  3. 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.

  4. Add the resulting Union Datasource to your frontend pages as you normally would

  5. 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 uses read-news and read-twitter would have output params of read-news-* and read-twitter-*

Credits

Credit to Nick Dunn as I pretty much extended his README.

Version history

Requires Symphony 2.5

  • #43 Fix formatted textarea being escaped (thanks @Aonrud)
  • #42 Prevent parameters from duplicating in the output (thanks @moretaste)

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

Symphony 2.3.3 to 2.3.6

  • #30 Add support for modification date
  • #28 Handle when a datasource is renamed and causes the editor to freak out
  • Fix a bunch of E_NOTICE's and miscellaneous fixes
  • Fix typo in SQL string (thanks @iwyg)

Requires Symphony 2.3

  • #26 Fix error where validation would overwrite all Union DS settings making it impossible to create a new Union Datasource. Fixes #26
  • #23 Pagination returns wrong number of entries if duplicates exist
  • #22 Sanitize Section names

Requires Symphony 2.3

  • #25 Fix Fatal error with Symphony 2.3.1

Requires Symphony 2.3

  • #19 Link colour when ordering Data Sources
  • #18 Wrong handles for Data Source links

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

  • Add support for dependencies. Datasources included in a Union Datasource will now resolve dependencies. Resave your existing Union Datasources to unlock this achievement. Fixes #7
  • Fixed an issue where the sort order of Datasources would show incorrectly in the backend. Fixes #5

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 and system: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