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
StockSourceLink
Validator
PriorityValidator.php
Go to the documentation of this file.
1
<?php
6
declare(strict_types=1);
7
8
namespace
Magento\Inventory\Model\StockSourceLink\Validator
;
9
10
use
Magento\Framework\Validation\ValidationResult
;
11
use Magento\Framework\Validation\ValidationResultFactory;
12
use
Magento\InventoryApi\Api\Data\StockSourceLinkInterface
;
13
use
Magento\InventoryApi\Model\StockSourceLinkValidatorInterface
;
14
18
class
PriorityValidator
implements
StockSourceLinkValidatorInterface
19
{
23
private
$validationResultFactory;
24
28
public
function
__construct
(ValidationResultFactory $validationResultFactory)
29
{
30
$this->validationResultFactory = $validationResultFactory;
31
}
32
36
public
function
validate
(
StockSourceLinkInterface
$link
):
ValidationResult
37
{
38
$value
= (int)
$link
->getPriority();
39
40
if
(
$value
<= 0) {
41
$errors
[] =
__
(
'"%field" should be greater then 0.'
, [
'field'
=>
StockSourceLinkInterface::PRIORITY
]);
42
}
else
{
43
$errors
= [];
44
}
45
46
return
$this->validationResultFactory->create([
'errors'
=>
$errors
]);
47
}
48
}
__
__()
Definition:
__.php:13
Magento\InventoryApi\Api\Data\StockSourceLinkInterface
Definition:
StockSourceLinkInterface.php:17
$link
$link
Definition:
quote_with_downloadable_product.php:27
Magento\Inventory\Model\StockSourceLink\Validator\PriorityValidator\validate
validate(StockSourceLinkInterface $link)
Definition:
PriorityValidator.php:36
$value
$value
Definition:
gender.phtml:16
Magento\Inventory\Model\StockSourceLink\Validator\PriorityValidator\__construct
__construct(ValidationResultFactory $validationResultFactory)
Definition:
PriorityValidator.php:28
Magento\InventoryApi\Model\StockSourceLinkValidatorInterface
Definition:
StockSourceLinkValidatorInterface.php:20
Magento\Inventory\Model\StockSourceLink\Validator
Definition:
PriorityValidator.php:8
Magento\InventoryApi\Api\Data\StockSourceLinkInterface\PRIORITY
const PRIORITY
Definition:
StockSourceLinkInterface.php:24
$errors
$errors
Definition:
overview.phtml:9
Magento\Inventory\Model\StockSourceLink\Validator\PriorityValidator
Definition:
PriorityValidator.php:18
Magento\Framework\Validation\ValidationResult
Definition:
ValidationResult.php:16