Add proxy services to Zend\Reader and Zend\Writer for better DX

Created on 22 June 2013, over 11 years ago
Updated 20 July 2023, over 1 year ago

Updated: Comment #29

Problem/Motivation

Using the Zend Reader/Writer added in #1839468: [Followup] Replace aggregator rss parsing with Zend Feed β†’ is non-obvious unless you look at the implementation in Aggregator. It's also ugly.

Reader::setExtensionManager(\Drupal::service('feed.bridge.reader'));
$channel = Reader::importString($feed->source_string);

There are other problems with this. Only a subset of methods from \Zend\Feed\Reader\Reader can actually be used. Some require dependencies that we don't have.

Proposed resolution

Create a Reader and Writer class that wraps \Zend\Feed\Reader\Reader, and \Zend\Feed\Writer\Writer and provide it as a service. This will take care of setting the extension manager, and provides a handy place to document the parts that we support.

The above code becomes:

\Drupal::service('feed.reader')->importString($feed->source_string);

Remaining tasks

This probably needs a change notice, since it's adding a new API.

User interface changes

None

API changes

This is an API addition. Using \Zend\Feed\Reader and Zend\Feed\Writer directly still works fine.

Related Issues

#1839468: [Followup] Replace aggregator rss parsing with Zend Feed β†’
#2003108: Switch Views RSS to use Serializer/Zend β†’

πŸ“Œ Task
Status

Closed: outdated

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated 1 day ago

Created by

πŸ‡ΊπŸ‡ΈUnited States twistor

Live updates comments and jobs are added and updated live.
  • API addition

    Enhances an existing API or introduces a new subsystem. Depending on the size and impact, possibly backportable to earlier major versions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024