Custom data handlers¶
It is possible to use a custom data handler instead of the standard
\Cobweb\ExternalImport\Importer::handleXML(). The value declared
as a custom data handler:
$GLOBALS['TCA']['some_table']['ctrl']['external']['data'] = Foo\MyExtension\DataHandler\CustomDataHandler::class;
is a class name.
The class itself must implement the
\Cobweb\ExternalImport\DataHandlerInterface interface, which contains only
handleData() method. This method will receive two
- an array containing the raw data returned by the connector service
- a reference to the calling
The method is expected to return a simple PHP array, with indexed
entries, like the standard methods (
This was not tested by myself (the extension author). It was introduced to answer the particular need to parse large arrays using methods similar to XPath. This would have relied on a library which was not considered stable enough. Having custom data handlers makes it possible.