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
6 namespace Magento\Reports\Setup;
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  'report_viewed_product_aggregated_daily' => 'product_id',
52  'report_viewed_product_aggregated_monthly' => 'product_id',
53  'report_viewed_product_aggregated_yearly' => 'product_id',
54  'report_compared_product_index' => 'product_id',
55  'report_viewed_product_index' => 'product_id'
56  ];
57  foreach ($listTables as $tableName => $columnName) {
58  $this->addExternalForeignKeys($installer, $tableName, $columnName);
59  }
60 
61  $installer->endSetup();
62  }
63 
74  {
75  $metadata = $this->metadataPool->getMetadata(ProductInterface::class);
76  $this->externalFKSetup->install(
77  $installer,
78  $metadata->getEntityTable(),
79  $metadata->getIdentifierField(),
80  $tableName,
81  $columnName
82  );
83  }
84 }
$tableName
Definition: trigger.php:13
addExternalForeignKeys(SchemaSetupInterface $installer, $tableName, $columnName)
Definition: Recurring.php:73
__construct(MetadataPool $metadataPool, ExternalFKSetup $externalFKSetup)
Definition: Recurring.php:34
install(SchemaSetupInterface $setup, ModuleContextInterface $context)
Definition: Recurring.php:45
$setup
Definition: trigger.php:12