private function setInDataMap(
        string $tableName,
        string $identifier,
        array $values,
        int $workspaceId = 0
    ): void {
        if (empty($values)) {
            $this->dataMapPerWorkspace[$workspaceId][$tableName][$identifier] = $values;
            return;
        }

        $tableDataMap = $this->filterDataMapByPageId(
            $workspaceId,
            $tableName,
            $values['pid'] ?? null
        );
        $identifiers = array_keys($tableDataMap);
        $currentIndex = array_search($identifier, $identifiers);

        // current item did not have any values in data map, use last identifer
        if ($currentIndex === false && !empty($identifiers)) {
            $values['pid'] = '-' . $identifiers[count($identifiers) - 1];
        // current item does have values in data map, use previous identifier
        } elseif ($currentIndex > 0) {
            $previousIndex = $identifiers[$currentIndex - 1];
            $values['pid'] = '-' . $identifiers[$previousIndex];
        }

        $this->dataMapPerWorkspace[$workspaceId][$tableName][$identifier] = $values;
    }
private function setInDataMap(
        string $tableName,
        string $identifier,
        array $values,
        int $workspaceId = 0
    ): void {
        if (empty($values)) {
            $this->dataMapPerWorkspace[$workspaceId][$tableName][$identifier] = $values;
            return;
        }

        $tableDataMap = $this->filterDataMapByPageId(
            $workspaceId,
            $tableName,
            $values['pid'] ?? null
        );
        $identifiers = array_keys($tableDataMap);
        $currentIndex = array_search($identifier, $identifiers);

        // current item did not have any values in data map, use last identifer
        if ($currentIndex === false && !empty($identifiers)) {
            $values['pid'] = '-' . $identifiers[count($identifiers) - 1];
        // current item does have values in data map, use previous identifier
        } elseif ($currentIndex > 0) {
            $previousIndex = $identifiers[$currentIndex - 1];
            $values['pid'] = '-' . $identifiers[$previousIndex];
        }

        $this->dataMapPerWorkspace[$workspaceId][$tableName][$identifier] = $values;
    }
private function setInDataMap ( string $ tableName , string $ identifier , array $ values , int $ workspaceId = 0 ) : void { if ( empty ( $ values ) ) { $ this -> dataMapPerWorkspace [ $ workspaceId ] [ $ tableName ] [ $ identifier ] = $ values ; return ; } $ tableDataMap = $ this -> filterDataMapByPageId ( $ workspaceId , $ tableName , $ values [ 'pid' ] ?? null ) ; $ identifiers = array_keys ( $ tableDataMap ) ; $ currentIndex = array_search ( $ identifier , $ identifiers ) ; // current item did not have any values in data map, use last identifer if ( $ currentIndex === false && ! empty ( $ identifiers ) ) { $ values [ 'pid' ] = '-' . $ identifiers [ count ( $ identifiers ) - 1 ] ; // current item does have values in data map, use previous identifier } elseif ( $ currentIndex > 0 ) { $ previousIndex = $ identifiers [ $ currentIndex - 1 ] ; $ values [ 'pid' ] = '-' . $ identifiers [ $ previousIndex ] ; } $ this -> dataMapPerWorkspace [ $ workspaceId ] [ $ tableName ] [ $ identifier ] = $ values ; }
Adds values to data map and ensures sorting.
Per default DataHandler inserts records to top on according page
however, this factory shall insert sequentially one after another.

@param string $tableName
@param string $identifier
@param array $values
@param int $workspaceId
Adds values to data map and ensures sorting . Per default DataHandler inserts records to top on according page however this factory shall insert sequentially one after another .