public function createAssoc(array $properties, array $mapping)
    {
        $values = (array) $properties[$mapping['property']];
        if (!isset($properties[$mapping['assoc']])) {
            return $values;
        }

        $keys = (array) $properties[$mapping['assoc']];
        $nulls = (array) ($properties[$mapping['assocNulls']] ?? []);

        // make sure we start with first value
        reset($values);
        $result = [];
        foreach ($keys as $key) {
            if (in_array($key, $nulls)) {
                $result[$key] = null;
            } else {
                $result[$key] = current($values);
                next($values);
            }
        }

        return $result;
    }
public function createAssoc(array $properties, array $mapping)
    {
        $values = (array) $properties[$mapping['property']];
        if (!isset($properties[$mapping['assoc']])) {
            return $values;
        }

        $keys = (array) $properties[$mapping['assoc']];
        $nulls = (array) ($properties[$mapping['assocNulls']] ?? []);

        // make sure we start with first value
        reset($values);
        $result = [];
        foreach ($keys as $key) {
            if (in_array($key, $nulls)) {
                $result[$key] = null;
            } else {
                $result[$key] = current($values);
                next($values);
            }
        }

        return $result;
    }
public function createAssoc ( array $ properties , array $ mapping ) { $ values = ( array ) $ properties [ $ mapping [ 'property' ] ] ; if ( ! isset ( $ properties [ $ mapping [ 'assoc' ] ] ) ) { return $ values ; } $ keys = ( array ) $ properties [ $ mapping [ 'assoc' ] ] ; $ nulls = ( array ) ( $ properties [ $ mapping [ 'assocNulls' ] ] ?? [ ] ) ; // make sure we start with first value reset ( $ values ) ; $ result = [ ] ; foreach ( $ keys as $ key ) { if ( in_array ( $ key , $ nulls ) ) { $ result [ $ key ] = null ; } else { $ result [ $ key ] = current ( $ values ) ; next ( $ values ) ; } } return $ result ; }
Create an associative array form the properties stored with the node.

@param array $properties the node's properties
@param array $mapping    the field's mapping information

@return array
Create an associative array form the properties stored with the node .