Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
Recurring Class Reference
Inheritance diagram for Recurring:
InstallSchemaInterface

Public Member Functions

 __construct (MetadataPool $metadataPool, ExternalFKSetup $externalFKSetup)
 
 install (SchemaSetupInterface $setup, ModuleContextInterface $context)
 

Protected Member Functions

 addExternalForeignKeys (SchemaSetupInterface $installer, $tableName, $columnName)
 

Protected Attributes

 $metadataPool
 
 $externalFKSetup
 

Detailed Description

@codeCoverageIgnore

Definition at line 18 of file Recurring.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( MetadataPool  $metadataPool,
ExternalFKSetup  $externalFKSetup 
)
Parameters
MetadataPool$metadataPool
ExternalFKSetup$externalFKSetup

Definition at line 34 of file Recurring.php.

37  {
38  $this->metadataPool = $metadataPool;
39  $this->externalFKSetup = $externalFKSetup;
40  }

Member Function Documentation

◆ addExternalForeignKeys()

addExternalForeignKeys ( SchemaSetupInterface  $installer,
  $tableName,
  $columnName 
)
protected

Add external foreign keys

Parameters
SchemaSetupInterface$installer
string$tableName
string$columnName
Returns
void
Exceptions

Definition at line 73 of file Recurring.php.

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  }
$tableName
Definition: trigger.php:13

◆ install()

install ( SchemaSetupInterface  $setup,
ModuleContextInterface  $context 
)

{Installs DB schema for a module

Parameters
SchemaSetupInterface$setup
ModuleContextInterface$context
Returns
void
}

Implements InstallSchemaInterface.

Definition at line 45 of file Recurring.php.

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  }
$tableName
Definition: trigger.php:13
addExternalForeignKeys(SchemaSetupInterface $installer, $tableName, $columnName)
Definition: Recurring.php:73
$setup
Definition: trigger.php:12

Field Documentation

◆ $externalFKSetup

$externalFKSetup
protected

Definition at line 28 of file Recurring.php.

◆ $metadataPool

$metadataPool
protected

Definition at line 23 of file Recurring.php.


The documentation for this class was generated from the following file: