4

I have this issue where I get the following error in the [stage: data migration][step: EAV Step]

In Mysql.php line 110:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')) ORDER BY entity_attribute_id ASC LIMIT 216' at line 1, query was: SELECT eav_entity_attribute.* FROM eav_entity_attribute WHERE (entity_attribute_id >= 0) AND (attribute_id IN ()) ORDER BY entity_attribute_id ASC LIMIT 216

The issue is related to this part "attribute_id IN ()" because the selection is empty. However I do not know where this comes from.

In the map.xml I have both source and destination ignoring the eav document as such

<ignore>
   <document>eav_entity_attribute</document>
</ignore>

The migration tool is CE to CE from 1.9.4.5 to 2.3.5-p1. No other error appears prior to this step.

1 Answer 1

3

I have seen the same issue migrating a 1.9.2.4 store to 2.3.5-p1.

The issue appears to be in the tool at src/Migration/Step/Eav/Data.php Around line 488. I got around it by checking if the attributes are set and not empty.

    /**
     * Migrate custom entity attributes
     */
    private function migrateCustomEntityAttributes()
    {
        $this->progress->advance();
        $sourceDocName = 'eav_entity_attribute';
        $destinationDocument = $this->destination->getDocument(
            $this->map->getDocumentMap($sourceDocName, MapInterface::TYPE_SOURCE)
        );
        $recordsToSave = $destinationDocument->getRecords();
        $customAttributeIds = $this->modelData->getCustomAttributeIds();
        //Added this line
        if(isset($customAttributeIds) && !empty($customAttributeIds)){
            $customEntityAttributes = $this->source->getRecords(
                $sourceDocName,
                0,
                $this->source->getRecordsCount($sourceDocName),
                new \Zend_Db_Expr(sprintf('attribute_id IN (%s)', implode(',', $customAttributeIds)))
            );

        foreach ($customEntityAttributes as $record) {
            $record['sort_order'] = $this->getCustomAttributeSortOrder($record);
            $record['attribute_group_id'] = $this->mapAttributeGroupIdsSourceDest[$record['attribute_group_id']];
            $record['entity_attribute_id'] = null;
            $destinationRecord = $this->factory->create(['document' => $destinationDocument, 'data' => $record]);
            $recordsToSave->addRecord($destinationRecord);
            }
        //And this line
        }
        $this->saveRecords($destinationDocument, $recordsToSave);
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.