src/Service/MelisCoreGdprService.php
public function extractSelected($idsToBeExtractedArray = [])
    {
        //created selected index
        $arrayParameters['selected'] = $idsToBeExtractedArray;

        // Sending service start event
        $arrayParameters = $this->sendEvent('melis_core_gdpr_user_extract_event', $arrayParameters);

        $xml = '';

        if (isset($arrayParameters['results']) && count($arrayParameters['results']) > 0) {
            // Generate and structure the xml
            $xmlDoc = new \DOMDocument('1.0', 'UTF-8');
            $xmlDoc->formatOutput = true;
            $root = $xmlDoc->appendChild($xmlDoc->createElement("xml"));

            $doc = new \DOMDocument();
            $doc->formatOutput = true;

            foreach ($arrayParameters['results'] as $key => $value) {
                $doc->loadXML($value);

                //remove root element xml so that we won't have multiple xml elements on the final output
                $module = $doc->documentElement->getElementsByTagName('*')->item(0);
                $doc->replaceChild($module, $doc->documentElement);

                $xml = $doc->saveXML($doc->documentElement);

                //append each modules xml to one final xml
                $fragment = $xmlDoc->createDocumentFragment();
                $fragment->appendXML($xml);
                $xmlDoc->documentElement->appendChild($fragment);
            }

            $xml = $xmlDoc->saveXML();
        }

        // Sending service end event
        //$arrayParameters = $this->sendEvent('melis_core_gdpr_user_extract_event_end', $xml);
        return $xml;
    }
public function extractSelected($idsToBeExtractedArray = [])
    {
        //created selected index
        $arrayParameters['selected'] = $idsToBeExtractedArray;

        // Sending service start event
        $arrayParameters = $this->sendEvent('melis_core_gdpr_user_extract_event', $arrayParameters);

        $xml = '';

        if (isset($arrayParameters['results']) && count($arrayParameters['results']) > 0) {
            // Generate and structure the xml
            $xmlDoc = new \DOMDocument('1.0', 'UTF-8');
            $xmlDoc->formatOutput = true;
            $root = $xmlDoc->appendChild($xmlDoc->createElement("xml"));

            $doc = new \DOMDocument();
            $doc->formatOutput = true;

            foreach ($arrayParameters['results'] as $key => $value) {
                $doc->loadXML($value);

                //remove root element xml so that we won't have multiple xml elements on the final output
                $module = $doc->documentElement->getElementsByTagName('*')->item(0);
                $doc->replaceChild($module, $doc->documentElement);

                $xml = $doc->saveXML($doc->documentElement);

                //append each modules xml to one final xml
                $fragment = $xmlDoc->createDocumentFragment();
                $fragment->appendXML($xml);
                $xmlDoc->documentElement->appendChild($fragment);
            }

            $xml = $xmlDoc->saveXML();
        }

        // Sending service end event
        //$arrayParameters = $this->sendEvent('melis_core_gdpr_user_extract_event_end', $xml);
        return $xml;
    }
public function extractSelected ( $ idsToBeExtractedArray = [ ] ) { //created selected index $ arrayParameters [ 'selected' ] = $ idsToBeExtractedArray ; // Sending service start event $ arrayParameters = $ this -> sendEvent ( 'melis_core_gdpr_user_extract_event' , $ arrayParameters ) ; $ xml = '' ; if ( isset ( $ arrayParameters [ 'results' ] ) && count ( $ arrayParameters [ 'results' ] ) > 0 ) { // Generate and structure the xml $ xmlDoc = new \ DOMDocument ( '1.0' , 'UTF-8' ) ; $ xmlDoc -> formatOutput = true ; $ root = $ xmlDoc -> appendChild ( $ xmlDoc -> createElement ( "xml" ) ) ; $ doc = new \ DOMDocument ( ) ; $ doc -> formatOutput = true ; foreach ( $ arrayParameters [ 'results' ] as $ key => $ value ) { $ doc -> loadXML ( $ value ) ; //remove root element xml so that we won't have multiple xml elements on the final output $ module = $ doc -> documentElement -> getElementsByTagName ( '*' ) -> item ( 0 ) ; $ doc -> replaceChild ( $ module , $ doc -> documentElement ) ; $ xml = $ doc -> saveXML ( $ doc -> documentElement ) ; //append each modules xml to one final xml $ fragment = $ xmlDoc -> createDocumentFragment ( ) ; $ fragment -> appendXML ( $ xml ) ; $ xmlDoc -> documentElement -> appendChild ( $ fragment ) ; } $ xml = $ xmlDoc -> saveXML ( ) ; } // Sending service end event //$arrayParameters = $this->sendEvent('melis_core_gdpr_user_extract_event_end', $xml); return $ xml ; }
This function will Retrieve xml string of user's info based on the ids passed
and Returns a xml string containing all modules that matched the ids passed

This event will take in the IDs of the selected items on the table as the parameters so please follow this structure.
Parameter for the event value structure:

array(
'selected' => array(
'MelisCmsProspects'  => array(13,15),
'MelisCmsNewsletter' => 'array(2),
),
)

The modules that will catch the event will then provide their own results using this structure.
Return value structure:

array(
'selected' => array(
'MelisCmsProspects'  => '<xml><MelisCmsProspects>...</MelisCmsProspects></xml>',
'MelisCmsNewsletter' => '<xml><MelisCmsNewsletter>...</MelisCmsNewsletter></xml>',
),
)

@param (array) $arrayParameters
@return (string) xml string
This function will Retrieve xml string of user s info based on the ids passed and Returns a xml string containing all modules that matched the ids passed