Ticket #174 (closed enhancement: fixed)

Opened 18 months ago

Last modified 3 weeks ago

Provide RSS annotations for more automated way to produce feeds

Reported by: prema Owned by: mikey
Priority: major Milestone: 0.11.0
Component: RSS Version: SVN-trunk
Keywords: Cc:

Description

It would be helpful to annotate Entity/ or plain php objects with typically rss elements, to automate rss generation by a RSS generator:

  • title
  • description
  • author
  • publish date
  • link

Attachments

rss_annotation.patch (9.6 kB) - added by mikey 18 months ago.
Initial rough draft of implementation

Change History

Changed 18 months ago by prema

  • summary changed from Provide RSS annotations for more automated way to produce rss feeds to Provide RSS annotations for more automated way to produce feeds

Changed 18 months ago by mikey

  • status changed from new to assigned
  • component changed from Other to RSS
  • milestone set to 0.11.0

Changed 18 months ago by mikey

Initial rough draft of implementation

Changed 18 months ago by mikey

Attached is a rough and untested initial draft of how an implementation may look like. Usage is as follows:

$rssFeedGenerator->addEntity($entity);

This will do all the work to create a net::stubbles::xml::rss::stubRSSFeedItem instance from $entity and adds it to the feed generator instance. The method will return the instance as well, so the user may change some of their properties after this step as well.

The entity must be annotated as follows:

/**
 * An example entity.
 *
 * @RSSFeedItem
 */
class MyExampleEntity
{
    // methods here
}

This will assume the entity offers default methods to return the necessary values. It is possible to change the default methods:

/**
 * An example entity.
 *
 * @RSSFeedItem(titleMethod='getExampleTitle',
 *              linkMethod='getExampleLink',
 *              descriptionMethod='getExampleDescription',
 *              authorMethod='getExampleAuthor',
 *              pubDateMethod='getExampleDate'
 */
class MyExampleEntity
{
    // methods here
}

Default values for those methods are getTitle(), getLink(), getDescription(), getAuthor(), getPubDate(). It is mandatory that the entity has methods to supply the title, link and description. Any other properties are optional.

The patch supports the properties named above. If accepted, all other properties currently implemented by net::stubbles::xml::rss::stubRSSFeedItem will be supported as well.

Changed 18 months ago by mikey

  • status changed from assigned to closed
  • resolution set to fixed

Implemented with r1827.

Note: See TracTickets for help on using tickets.