From 32963c28534279701cae3313b9e634b21b89baad Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 20 May 2013 00:35:50 -0400 Subject: [PATCH] CRM_Utils_Migrate_Import - Extract runXmlElement() for use with dynamic XML. Add docs. --- CRM/Utils/Migrate/Import.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/CRM/Utils/Migrate/Import.php b/CRM/Utils/Migrate/Import.php index 35990fc723..b43c38a6d5 100644 --- a/CRM/Utils/Migrate/Import.php +++ b/CRM/Utils/Migrate/Import.php @@ -36,8 +36,14 @@ class CRM_Utils_Migrate_Import { function __construct() { } + /** + * Import custom-data from an XML file + * + * @param string $file path to an XML file + * @throws CRM_Core_Exception + * @return void; + */ function run($file) { - // read xml file $dom = new DomDocument(); if (! $dom->load($file)) { @@ -45,7 +51,16 @@ class CRM_Utils_Migrate_Import { } $dom->xinclude(); $xml = simplexml_import_dom($dom); + return $this->runXmlElement($xml); + } + /** + * Import custom-data from an XML element + * + * @param SimpleXMLElement $xml + * @return void + */ + function runXmlElement($xml) { $idMap = array( 'custom_group' => array(), 'option_group' => array(), -- 2.25.1