104 $domDocumentClass = \
Magento\Framework\Config\Dom::class,
105 $defaultScope =
'global' 107 $this->_fileResolver = $fileResolver;
108 $this->_converter = $converter;
110 $this->_idAttributes = array_replace($this->_idAttributes, $idAttributes);
112 $this->_schemaFile = $schemaLocator->getSchema();
113 $this->_perFileSchema = $schemaLocator->getPerFileSchema() &&
$validationState->isValidationRequired()
114 ? $schemaLocator->getPerFileSchema() :
null;
115 $this->_domDocumentClass = $domDocumentClass;
116 $this->_defaultScope = $defaultScope;
125 public function read($scope =
null)
128 $fileList = $this->_fileResolver->get($this->_fileName, $scope);
147 $configMerger =
null;
150 if (!$configMerger) {
155 }
catch (\
Magento\Framework\Config\Dom\ValidationException $e) {
156 throw new \Magento\Framework\Exception\LocalizedException(
158 'The XML in file "%1" is invalid:' .
"\n%2\nVerify the XML and try again.",
159 [$key, $e->getMessage()]
164 if ($this->validationState->isValidationRequired()) {
166 if ($configMerger && !$configMerger->validate($this->_schemaFile,
$errors)) {
168 throw new \Magento\Framework\Exception\LocalizedException(
176 $output = $this->_converter->convert($configMerger->getDom());
193 $this->validationState,
194 $this->_idAttributes,
196 $this->_perFileSchema
199 throw new \UnexpectedValueException(
200 "Instance of the DOM config merger is expected, got {$mergerClass} instead."
_createConfigMerger($mergerClass, $initialContents)
__construct(\Magento\Framework\Config\FileResolverInterface $fileResolver, \Magento\Framework\Config\ConverterInterface $converter, \Magento\Framework\Config\SchemaLocatorInterface $schemaLocator, \Magento\Framework\Config\ValidationStateInterface $validationState, $fileName, $idAttributes=[], $domDocumentClass=\Magento\Framework\Config\Dom::class, $defaultScope='global')