Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Recurring.php
Go to the documentation of this file.
1 <?php
7 
14 
19 {
23  protected $metadataPool;
24 
28  protected $externalFKSetup;
29 
34  public function __construct(
37  ) {
38  $this->metadataPool = $metadataPool;
39  $this->externalFKSetup = $externalFKSetup;
40  }
41 
46  {
48  $installer->startSetup();
49 
50  $listTables = [
51  ['product_alert_price', 'product_id'],
52  ['product_alert_stock', 'product_id'],
53  ];
54  foreach ($listTables as $tableData) {
55  $this->addExternalForeignKeys($installer, $tableData[0], $tableData[1]);
56  }
57 
58  $installer->endSetup();
59  }
60 
71  {
72  $metadata = $this->metadataPool->getMetadata(ProductInterface::class);
73  $this->externalFKSetup->install(
74  $installer,
75  $metadata->getEntityTable(),
76  $metadata->getIdentifierField(),
77  $tableName,
78  $columnName
79  );
80  }
81 }
$tableName
Definition: trigger.php:13
install(SchemaSetupInterface $setup, ModuleContextInterface $context)
Definition: Recurring.php:45
__construct(MetadataPool $metadataPool, ExternalFKSetup $externalFKSetup)
Definition: Recurring.php:34
$setup
Definition: trigger.php:12
addExternalForeignKeys(SchemaSetupInterface $installer, $tableName, $columnName)
Definition: Recurring.php:70