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-inventory-catalog
Setup
Operation
CreateDefaultSource.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\InventoryCatalog\Setup\Operation
;
9
10
use
Magento\Framework\App\ResourceConnection
;
11
use
Magento\InventoryApi\Api\Data\SourceInterface
;
12
use
Magento\InventoryCatalogApi\Api\DefaultSourceProviderInterface
;
13
17
class
CreateDefaultSource
18
{
22
private
$defaultSourceProvider;
23
27
private
$resource;
28
33
public
function
__construct
(
34
DefaultSourceProviderInterface
$defaultSourceProvider,
35
ResourceConnection
$resource
36
) {
37
$this->defaultSourceProvider =
$defaultSourceProvider
;
38
$this->resource =
$resource
;
39
}
40
46
public
function
execute
()
47
{
48
$connection
= $this->resource->getConnection();
49
$sourceData = [
50
SourceInterface::SOURCE_CODE
=> $this->defaultSourceProvider->getCode(),
51
SourceInterface::NAME
=>
'Default Source'
,
52
SourceInterface::ENABLED
=> 1,
53
SourceInterface::DESCRIPTION
=>
'Default Source'
,
54
SourceInterface::LATITUDE
=> 0,
55
SourceInterface::LONGITUDE
=> 0,
56
SourceInterface::COUNTRY_ID
=>
'US'
,
57
SourceInterface::POSTCODE
=>
'00000'
,
58
];
59
$connection
->insert($this->resource->getTableName(
'inventory_source'
), $sourceData);
60
}
61
}
Magento\InventoryApi\Api\Data\SourceInterface\DESCRIPTION
const DESCRIPTION
Definition:
SourceInterface.php:27
Magento\InventoryCatalog\Setup\Operation
Definition:
AssignDefaultSourceToDefaultStock.php:8
Magento\InventoryApi\Api\Data\SourceInterface\LATITUDE
const LATITUDE
Definition:
SourceInterface.php:28
$resource
$resource
Definition:
bulk.php:12
Magento\InventoryCatalog\Setup\Operation\CreateDefaultSource
Definition:
CreateDefaultSource.php:17
Magento\InventoryApi\Api\Data\SourceInterface\SOURCE_CODE
const SOURCE_CODE
Definition:
SourceInterface.php:22
Magento\InventoryCatalog\Setup\Operation\CreateDefaultSource\execute
execute()
Definition:
CreateDefaultSource.php:46
$defaultSourceProvider
$defaultSourceProvider
Definition:
source_items_on_default_source.php:22
Magento\InventoryApi\Api\Data\SourceInterface\POSTCODE
const POSTCODE
Definition:
SourceInterface.php:35
Magento\InventoryCatalogApi\Api\DefaultSourceProviderInterface
Definition:
DefaultSourceProviderInterface.php:15
Magento\InventoryApi\Api\Data\SourceInterface\LONGITUDE
const LONGITUDE
Definition:
SourceInterface.php:29
Magento\InventoryApi\Api\Data\SourceInterface
Definition:
SourceInterface.php:17
Magento\InventoryApi\Api\Data\SourceInterface\ENABLED
const ENABLED
Definition:
SourceInterface.php:26
Magento\InventoryCatalog\Setup\Operation\CreateDefaultSource\__construct
__construct(DefaultSourceProviderInterface $defaultSourceProvider, ResourceConnection $resource)
Definition:
CreateDefaultSource.php:33
Magento\Framework\App\ResourceConnection
Definition:
ResourceConnection.php:18
$connection
$connection
Definition:
bulk.php:13
Magento\InventoryApi\Api\Data\SourceInterface\NAME
const NAME
Definition:
SourceInterface.php:23
Magento\InventoryApi\Api\Data\SourceInterface\COUNTRY_ID
const COUNTRY_ID
Definition:
SourceInterface.php:30
Magento\Framework\App\ResourceConnection