Skip to content

class_key field is ignored #76

@andrewcsp

Description

@andrewcsp

Using

  • ImportX 1.2.1-pl
  • MODX 3.1.2-pl

Observation
I am importing several resources with ImportX, and I noted it always imports resources with the class_key to MODX\Revolution\modDocument regardless of the csv/data I insert into ImportX.

Suggestion / Fix
The issue appears to be due to the setDefaultClassKey function. Line 104 (the if statement) is checking if $line['class_key'] is empty, it should however be checking $record['class_key']

    protected function setDefaultClassKey(array $record): array
    {
        $modxVersion = $this->modx->getVersionData();
        if (version_compare($modxVersion['full_version'], '3.0.0-dev', '>=') && empty($record['class_key'])) { // Note: using $record['class_key'] here
            $record['class_key'] = 'MODX\Revolution\modDocument';
        }

        return $record;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions