Definition at line 14 of file Config.php.
◆ __construct()
- Parameters
-
array | $configFiles | |
\Magento\Framework\Config\DomFactory | $domFactory | |
\Magento\Framework\Validator\UniversalFactory | $builderFactory | |
Definition at line 37 of file Config.php.
42 $this->_builderFactory = $builderFactory;
◆ _extractConstraintOptions()
_extractConstraintOptions |
( |
\DOMElement |
$constraint | ) |
|
|
protected |
Extract constraint options.
- Parameters
-
- Returns
- array|null
Read constructor arguments
<constraint class="Constraint"> <argument> <option name="minValue">123</option> <option name="maxValue">234</option> </argument> <argument>0</argument> <argument> <callback class="Class" method="method"> </argument> </constraint>
Read constraint configurator callback
<constraint class="Constraint"> <callback class="Magento\Foo\Helper\Data" method="configureValidator"> </constraint>
Read constraint method configuration
Definition at line 208 of file Config.php.
242 $callback = $this->_readCallback(
$children);
◆ _getIdAttributes()
Define id attributes for entities
- Returns
- array
Definition at line 422 of file Config.php.
425 '/validation/entity' =>
'name',
426 '/validation/entity/rules/rule' =>
'name',
427 '/validation/entity/rules/rule/entity_constraints/constraint' =>
'class',
428 '/validation/entity/rules/rule/property_constraints/property/constraint' =>
'class',
429 '/validation/entity/rules/rule/property_constraints/property' =>
'name',
430 '/validation/entity/groups/group' =>
'name',
431 '/validation/entity/groups/group/uses/use' =>
'rule'
◆ _getInitialXml()
Get initial XML of a valid document.
- Returns
- string
Definition at line 411 of file Config.php.
413 return '<?xml version="1.0" encoding="UTF-8"?>' .
414 '<validation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"></validation>';
◆ createValidator()
createValidator |
( |
|
$entityName, |
|
|
|
$groupName, |
|
|
array |
$builderConfig = null |
|
) |
| |
Create validator based on entity and group.
- Parameters
-
string | $entityName | |
string | $groupName | |
array | null | $builderConfig | |
- Returns
- \Magento\Framework\Validator
Definition at line 98 of file Config.php.
createValidatorBuilder($entityName, $groupName, array $builderConfig=null)
◆ createValidatorBuilder()
createValidatorBuilder |
( |
|
$entityName, |
|
|
|
$groupName, |
|
|
array |
$builderConfig = null |
|
) |
| |
Create validator builder instance based on entity and group.
- Parameters
-
string | $entityName | |
string | $groupName | |
array | null | $builderConfig | |
- Exceptions
-
Definition at line 55 of file Config.php.
57 if (!isset($this->_data[$entityName])) {
58 throw new \InvalidArgumentException(sprintf(
'Unknown validation entity "%s"', $entityName));
61 if (!isset($this->_data[$entityName][$groupName])) {
62 throw new \InvalidArgumentException(
63 sprintf(
'Unknown validation group "%s" in entity "%s"', $groupName, $entityName)
67 $builderClass = isset(
68 $this->_data[$entityName][$groupName][
'builder']
72 throw new \InvalidArgumentException(sprintf(
'Builder class "%s" was not found', $builderClass));
75 $builder = $this->_builderFactory->create(
77 [
'constraints' => $this->_data[$entityName][$groupName][
'constraints']]
80 throw new \InvalidArgumentException(
81 sprintf(
'Builder "%s" must extend \Magento\Framework\Validator\Builder', $builderClass)
85 $builder->addConfigurations($builderConfig);
◆ getSchemaFile()
Get absolute path to validation.xsd
- Returns
- string
Definition at line 401 of file Config.php.
403 return __DIR__ .
'/etc/validation.xsd';
defined('TESTS_BP')||define('TESTS_BP' __DIR__
◆ $_builderFactory
◆ $_defaultBuilderClass
$_defaultBuilderClass = \Magento\Framework\Validator\Builder::class |
|
protected |
◆ CONSTRAINT_TYPE_ENTITY
const CONSTRAINT_TYPE_ENTITY = 'entity' |
#+ Constraints types
Definition at line 19 of file Config.php.
◆ CONSTRAINT_TYPE_PROPERTY
const CONSTRAINT_TYPE_PROPERTY = 'property' |
The documentation for this class was generated from the following file: