EIDataMapper This class handles data mapping from an Eagle-I node to an Eagle-I ExchangeInstance object as per the field mappings in the content_type_mapping.xml file.

This class implements the Singleton design pattern.

 Methods

Get the single instance of the IEDataMapper object

getInstance() : \EIDataMapper | null
Static

Exceptions

\Exception if xml file is not available.

Returns

Determines whether a nid is mappable or not: whether the value of the export field is true or false NOTE: If a node does NOT have the field eaglei_export defined, this will return true - thereby allowing the user to export all nodes of content type, even if they haven't been explicitly selected.

isMappable($node) : bool

Parameters

$node

Returns

bool

Map a Drupal node to an Eagle-I EIExchangeInstance.

mapNode($node) : \EIExchangeInstance | null

Parameters

$node

Exceptions

\Exception if the node is not mappable or has no map data.

Returns

__construct()

__construct() 

Returns all nids in a reverse reference with the given content type and field.

findReverseReference($nid, $content_type, $field) : array
access private

Parameters

$nid

  • the nid to search for.

$content_type

  • the content type the reference field is on.

$field

  • the field referencing the nid in question.

Returns

array- the nids of all nodes that reference the given nid in the given field of the given content type.

Returns the string name of the content type for the passed nid, or false if the nid is invalid.

getContentType($node) : bool | string
access private

Parameters

$node

Returns

boolstring

Returns an xml map for the given content type, or null if no map is available.

getMap($content_type) : null | string
access private

Parameters

$content_type

Returns

nullstring

Retrieves the field value on the referentially passed node of the field specified in the referentially passed simple xml property (or the string name of the field).

getNodeFieldValue($node, $property) : null
access private

Parameters

$node

$property

  • a simple xml property or the string name of a field on the node

Returns

null

Returns the uri for a given nid, if any.

getUri($node) : null | string
access private

Parameters

$node

Returns

nullstring

Loads the simple xml data for the file path of the xml_file property.

loadMapData() 
access private

Exceptions

\Exception if the xml file could not be loaded.

Helper function for the doReverseReference method.

loadNodesOfContentType($content_type) : array

Returns all mappable nodes of a given content type. NOTE: This will only pull nids that are explicitly being exported to Eagle-I.

access private

Parameters

$content_type

Returns

array

Helper method for the public method mapNode.

mapNodeRecursive($node, $map, $level) : \EIExchangeInstance | null
access private

Parameters

$node

$map

$level

Exceptions

\Exception

Returns

 Properties

 

$instance : null
 

$content_types 
 

$map_data 
 

$xml_file