Open vytsci opened 5 years ago
On file vendor/oro/platform/src/Oro/Bundle/EntityExtendBundle/Migration/Extension/ExtendExtension.php from Ive changed addManyToManyInverseRelation method a bit
$selfFieldId = new FieldConfigId(
'extend',
$selfClassName,
$associationName,
RelationType::MANY_TO_MANY
);
$targetFieldId = new FieldConfigId(
'extend',
$targetClassName,
$targetAssociationName,
RelationType::MANY_TO_MANY
);
$selfTableOptions['extend']['relation.' . $selfRelationKey . '.field_id'] = $selfFieldId;
$selfTableOptions['extend']['relation.' . $selfRelationKey . '.target_field_id'] = $targetFieldId;
$selfTableOptions['extend']['relation.' . $selfRelationKey . '.owner'] = true;
$selfTableOptions['extend']['relation.' . $selfRelationKey . '.target_entity'] = $targetClassName;
$this->extendOptionsManager->setTableOptions(
$selfTableName,
$selfTableOptions
);
$this->extendOptionsManager->mergeColumnOptions(
$selfTableName,
$associationName,
['extend' => ['bidirectional' => true]]
);
$targetTableOptions['extend']['relation.' . $targetRelationKey . '.field_id'] = $targetFieldId;
$targetTableOptions['extend']['relation.' . $targetRelationKey . '.target_field_id'] = $selfFieldId;
$targetTableOptions['extend']['relation.' . $targetRelationKey . '.owner'] = false;
$targetTableOptions['extend']['relation.' . $targetRelationKey . '.target_entity'] = $selfClassName;
$this->extendOptionsManager->setTableOptions(
$targetTableName,
$targetTableOptions
);
Ive added target_entity for both relations, Im still checking if everything works, If so Ill make PR.
I need to make these changes:
ManyToMany will be created as it should, but inverse side later throws exception on file vendor/oro/platform/src/Oro/Bundle/EntityExtendBundle/ORM/RelationMetadataBuilder.php:59 That target entity does not exist $configRelationEntity = $this->configManager->getEntityConfig('extend', $relation['target_entity']); Ive tried many combinations, but I was unable to generate proper Inverse side relation.