14 class Validator extends \Magento\Framework\Validator\AbstractValidator
47 '"%fieldName" is required. Enter and try again.',
48 [
'fieldName' =>
'position']
54 'The %fieldName value of "%value" must be greater than or equal to %minValue.',
55 [
'fieldName' =>
'position',
'value' =>
$value->getPosition(),
'minValue' => 0]
63 '"%fieldName" is required. Enter and try again.',
64 [
'fieldName' =>
'priority']
70 'The %fieldName value of "%value" must be greater than or equal to %minValue.',
71 [
'fieldName' =>
'priority',
'value' =>
$value->getPriority(),
'minValue' => 0]
79 '"%fieldName" is required. Enter and try again.',
80 [
'fieldName' =>
'code']
85 if ((
$value->getCustomerTaxClassIds() ===
null) || !
$value->getCustomerTaxClassIds()) {
88 '"%fieldName" is required. Enter and try again.',
89 [
'fieldName' =>
'customer_tax_class_ids']
92 $customerTaxClassIds =
$value->getCustomerTaxClassIds();
93 foreach ($customerTaxClassIds as $customerTaxClassId) {
95 $taxClass = $this->classModelRegistry->retrieve($customerTaxClassId);
96 if ($taxClass ===
null || !($taxClass->getClassType() == TaxClassModel::TAX_CLASS_TYPE_CUSTOMER)) {
99 'No such entity with %fieldName = %fieldValue',
101 'fieldName' =>
'customer_tax_class_ids',
102 'value' => $customerTaxClassId,
117 if ((
$value->getProductTaxClassIds() ===
null) || !
$value->getProductTaxClassIds()) {
120 '"%fieldName" is required. Enter and try again.',
121 [
'fieldName' =>
'product_tax_class_ids']
124 $productTaxClassIds =
$value->getProductTaxClassIds();
125 foreach ($productTaxClassIds as $productTaxClassId) {
127 $taxClass = $this->classModelRegistry->retrieve($productTaxClassId);
128 if ($taxClass ===
null || !($taxClass->getClassType() == TaxClassModel::TAX_CLASS_TYPE_PRODUCT)) {
131 'No such entity with %fieldName = %fieldValue',
133 'fieldName' =>
'product_tax_class_ids',
134 'value' => $productTaxClassId,
149 if ((
$value->getTaxRateIds() ===
null) || !
$value->getTaxRateIds()) {
152 '"%fieldName" is required. Enter and try again.',
153 [
'fieldName' =>
'tax_rate_ids']
157 return empty($messages);
addErrorMessage(&$messages, $message, $params)
__construct(ClassModelRegistry $classModelRegistry)
_addMessages(array $messages)
static is($value, $classBaseName, array $args=array(), $namespaces=array())
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]