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
Model
Source
Command
Get.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\Inventory\Model\Source\Command
;
9
10
use
Magento\Framework\Exception\NoSuchEntityException
;
11
use
Magento\Inventory\Model\ResourceModel\Source
as
SourceResourceModel
;
12
use
Magento\InventoryApi\Api\Data\SourceInterface
;
13
use Magento\InventoryApi\Api\Data\SourceInterfaceFactory;
14
18
class
Get
implements
GetInterface
19
{
23
private
$sourceResource;
24
28
private
$sourceFactory;
29
34
public
function
__construct
(
35
SourceResourceModel
$sourceResource,
36
SourceInterfaceFactory $sourceFactory
37
) {
38
$this->sourceResource = $sourceResource;
39
$this->sourceFactory =
$sourceFactory
;
40
}
41
45
public
function
execute
(
string
$sourceCode
):
SourceInterface
46
{
48
$source
= $this->sourceFactory->create();
49
$this->sourceResource->load(
$source
,
$sourceCode
,
SourceInterface::SOURCE_CODE
);
50
51
if
(
null
===
$source
->getSourceCode()) {
52
throw
new
NoSuchEntityException
(
__
(
'Source with code "%value" does not exist.'
, [
'value'
=>
$sourceCode
]));
53
}
54
return
$source
;
55
}
56
}
Magento\Inventory\Model\ResourceModel\Source
Definition:
Collection.php:8
Magento\Inventory\Model\Source\Command\Get\__construct
__construct(SourceResourceModel $sourceResource, SourceInterfaceFactory $sourceFactory)
Definition:
Get.php:34
Magento\Inventory\Model\Source\Command\GetInterface\execute
execute(string $sourceCode)
$source
$source
Definition:
source.php:23
__
__()
Definition:
__.php:13
Magento\Inventory\Model\Source\Command\GetInterface
Definition:
GetInterface.php:23
Magento\InventoryApi\Api\Data\SourceInterface\SOURCE_CODE
const SOURCE_CODE
Definition:
SourceInterface.php:22
$sourceCode
$sourceCode
Definition:
inventory.phtml:11
Magento\InventoryApi\Api\Data\SourceInterface
Definition:
SourceInterface.php:17
Magento\Inventory\Model\Source\Command
Definition:
Get.php:8
Magento\Inventory\Model\Source\Command\Get
Definition:
Get.php:18
$sourceFactory
$sourceFactory
Definition:
source.php:16
Magento\Framework\Exception\NoSuchEntityException
Definition:
NoSuchEntityException.php:16