metadataPool = $metadataPool; $this->externalFKSetup = $externalFKSetup; } /** * {@inheritdoc} */ public function install(SchemaSetupInterface $setup, ModuleContextInterface $context) { $installer = $setup; $installer->startSetup(); $this->addExternalForeignKeys($installer); $installer->endSetup(); } /** * Add external foreign keys * * @param SchemaSetupInterface $installer * @return void * @throws \Exception */ protected function addExternalForeignKeys(SchemaSetupInterface $installer) { $metadata = $this->metadataPool->getMetadata(ProductInterface::class); $this->externalFKSetup->install( $installer, $metadata->getEntityTable(), $metadata->getIdentifierField(), 'wishlist_item', 'product_id' ); } }