sminnee / silverstripe-staticsiteconnector

Connector plugin for the SilverStripe External Content module that uses web scraping to import content.
8 stars 12 forks source link

Allow saving into relations #10

Open sminnee opened 11 years ago

sminnee commented 11 years ago

Right now, the connector lets you save the result of CSS selectors into fields on your database. I would like to extend that to allow saving into relations.

These might be single-item relations or multiple-item relations, but in both cases, there are two broad parts:

In principle, you could have further relations hanging off the back of those sub-selectors.

From a UI/data-model perspective, a simple change would be to introduce a dot-syntax - so one selector rule was called "Comments" and then the sub-selector was called "Comments.Name". However, it might be better to have a more rigorous data model, with a has_one ParentImportRule on the ImportRule object.

With this feature added, the DOM tree for a single page could be mapped to a tree of objects in the ORM in a number of quite flexible ways. First off the rank, it would allow the importing of comments.