Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-reports
Setup
Recurring.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Reports\Setup
;
7
8
use
Magento\Framework\Setup\ExternalFKSetup
;
9
use
Magento\Framework\Setup\InstallSchemaInterface
;
10
use
Magento\Framework\Setup\ModuleContextInterface
;
11
use
Magento\Framework\Setup\SchemaSetupInterface
;
12
use
Magento\Framework\EntityManager\MetadataPool
;
13
use
Magento\Catalog\Api\Data\ProductInterface
;
14
18
class
Recurring
implements
InstallSchemaInterface
19
{
23
protected
$metadataPool
;
24
28
protected
$externalFKSetup
;
29
34
public
function
__construct
(
35
MetadataPool
$metadataPool
,
36
ExternalFKSetup
$externalFKSetup
37
) {
38
$this->metadataPool =
$metadataPool
;
39
$this->externalFKSetup =
$externalFKSetup
;
40
}
41
45
public
function
install
(
SchemaSetupInterface
$setup
,
ModuleContextInterface
$context)
46
{
47
$installer
=
$setup
;
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
73
protected
function
addExternalForeignKeys
(
SchemaSetupInterface
$installer
,
$tableName
, $columnName)
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
$tableName
Definition:
trigger.php:13
Magento\Reports\Setup\Recurring\addExternalForeignKeys
addExternalForeignKeys(SchemaSetupInterface $installer, $tableName, $columnName)
Definition:
Recurring.php:73
$installer
$installer
Definition:
configurable_attribute.php:16
Magento\Reports\Setup\Recurring\__construct
__construct(MetadataPool $metadataPool, ExternalFKSetup $externalFKSetup)
Definition:
Recurring.php:34
Magento\Framework\Setup\ModuleContextInterface
Definition:
ModuleContextInterface.php:13
Magento\Reports\Setup\Recurring
Definition:
Recurring.php:18
Magento\Framework\Setup\SchemaSetupInterface
Definition:
SchemaSetupInterface.php:13
Magento\Reports\Setup\Recurring\install
install(SchemaSetupInterface $setup, ModuleContextInterface $context)
Definition:
Recurring.php:45
Magento\Reports\Setup\Recurring\$metadataPool
$metadataPool
Definition:
Recurring.php:23
Magento\Framework\EntityManager\MetadataPool
Definition:
MetadataPool.php:18
Magento\Framework\Setup\ExternalFKSetup
Definition:
ExternalFKSetup.php:13
$setup
$setup
Definition:
trigger.php:12
Magento\Reports\Setup\Recurring\$externalFKSetup
$externalFKSetup
Definition:
Recurring.php:28
Magento\Catalog\Api\Data\ProductInterface
Definition:
ProductInterface.php:14
Magento\Framework\Setup\InstallSchemaInterface
Definition:
InstallSchemaInterface.php:14
Magento\Reports\Setup