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
framework
Setup
Declaration
Schema
Sharding.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Framework\Setup\Declaration\Schema
;
8
9
use
Magento\Framework\App\DeploymentConfig
;
10
use
Magento\Framework\Config\ConfigOptionsListConstants
;
11
17
class
Sharding
18
{
22
const
DEFAULT_CONNECTION
=
'default'
;
23
27
private
$deploymentConfig;
28
36
private
$resources;
37
44
public
function
__construct
(
DeploymentConfig
$deploymentConfig, array $resources)
45
{
46
$this->deploymentConfig =
$deploymentConfig
;
47
$this->resources = $resources;
48
}
49
55
public
function
getResources
()
56
{
57
$resources = [];
58
59
foreach
($this->resources as
$resource
) {
60
if
($this->
canUseResource
($resource)) {
61
$resources[] =
$resource
;
62
}
63
}
64
65
return
$resources;
66
}
67
74
public
function
canUseResource
($scopeName)
75
{
76
$connections = $this->deploymentConfig
77
->get(
ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS
);
78
return
isset($connections[$scopeName]);
79
}
80
86
public
function
getDefaultResource
()
87
{
88
return
self::DEFAULT_CONNECTION
;
89
}
90
}
Magento\Framework\Setup\Declaration\Schema\Sharding\getDefaultResource
getDefaultResource()
Definition:
Sharding.php:86
Magento\Framework\Setup\Declaration\Schema\Sharding\getResources
getResources()
Definition:
Sharding.php:55
Magento\Framework\Setup\Declaration\Schema\Sharding\DEFAULT_CONNECTION
const DEFAULT_CONNECTION
Definition:
Sharding.php:22
Magento\Framework\App\DeploymentConfig
Definition:
DeploymentConfig.php:17
$resource
$resource
Definition:
bulk.php:12
$deploymentConfig
$deploymentConfig
Definition:
health_check.php:18
Magento\Framework\Setup\Declaration\Schema\Sharding
Definition:
Sharding.php:17
Magento\Framework\Setup\Declaration\Schema\Sharding\canUseResource
canUseResource($scopeName)
Definition:
Sharding.php:74
Magento\Framework\Config\ConfigOptionsListConstants
Definition:
ConfigOptionsListConstants.php:16
Magento\Framework\Config\ConfigOptionsListConstants\CONFIG_PATH_DB_CONNECTIONS
const CONFIG_PATH_DB_CONNECTIONS
Definition:
ConfigOptionsListConstants.php:26
Magento\Framework\Setup\Declaration\Schema\Sharding\__construct
__construct(DeploymentConfig $deploymentConfig, array $resources)
Definition:
Sharding.php:44
Magento\Framework\Setup\Declaration\Schema
Definition:
Comparator.php:7
Magento\Framework\App\DeploymentConfig
Definition:
CommentParser.php:6