/** * Load the packages information * * @return void */ private function load() { if ($this->packageModuleMap === null) { $jsonData = $this->reader->getComposerJsonFiles()->toArray(); foreach (array_keys($this->loader->load()) as $moduleName) { $moduleDir = $this->filesystem->getDirectoryRead(\Magento\Framework\App\Filesystem\DirectoryList::ROOT); $key = $moduleDir->getRelativePath($this->dirReader->getModuleDir('', $moduleName) . '/composer.json'); if (isset($jsonData[$key])) { $packageData = \Zend_Json::decode($jsonData[$key]); if (isset($packageData['name'])) { $this->packageModuleMap[$packageData['name']] = $moduleName; } if (isset($packageData['version'])) { $this->modulePackageVersionMap[$moduleName] = $packageData['version']; } if (!empty($packageData['require'])) { $this->requireMap[$moduleName] = array_keys($packageData['require']); } if (!empty($packageData['conflict'])) { $this->conflictMap[$moduleName] = $packageData['conflict']; } } } } }
/** * {@inheritdoc} */ public function get($filename, $scope) { switch ($scope) { case 'global': $iterator = $this->moduleReader->getConfigurationFiles($filename)->toArray(); $themeConfigFile = $this->currentTheme->getCustomization()->getCustomViewConfigPath(); if ($themeConfigFile && $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile))) { $iterator[$this->rootDirectory->getRelativePath($themeConfigFile)] = $this->rootDirectory->readFile($this->rootDirectory->getRelativePath($themeConfigFile)); } else { $designPath = $this->resolver->resolve(RulePool::TYPE_FILE, 'etc/view.xml', $this->area, $this->currentTheme); if (file_exists($designPath)) { try { $designDom = new \DOMDocument(); $designDom->load($designPath); $iterator[$designPath] = $designDom->saveXML(); } catch (\Exception $e) { throw new \Magento\Framework\Exception\LocalizedException(new \Magento\Framework\Phrase('Could not read config file')); } } } break; default: $iterator = $this->iteratorFactory->create([]); break; } return $iterator; }
/** * @param string $area * @param bool $forceReload * @param array $cachedData * @dataProvider dataProviderForTestLoadData * @SuppressWarnings(PHPMD.NPathComplexity) */ public function testLoadData($area, $forceReload, $cachedData) { $this->expectsSetConfig('themeId'); $this->cache->expects($this->exactly($forceReload ? 0 : 1))->method('load')->will($this->returnValue(serialize($cachedData))); if (!$forceReload && $cachedData !== false) { $this->translate->loadData($area, $forceReload); $this->assertEquals($cachedData, $this->translate->getData()); return; } $this->directory->expects($this->any())->method('isExist')->will($this->returnValue(true)); // _loadModuleTranslation() $this->moduleList->expects($this->once())->method('getNames')->will($this->returnValue(['name'])); $moduleData = ['module original' => 'module translated', 'module theme' => 'module-theme original translated', 'module pack' => 'module-pack original translated', 'module db' => 'module-db original translated']; $this->modulesReader->expects($this->any())->method('getModuleDir')->will($this->returnValue('/app/module')); $themeData = ['theme original' => 'theme translated', 'module theme' => 'theme translated overwrite', 'module pack' => 'theme-pack translated overwrite', 'module db' => 'theme-db translated overwrite']; $this->csvParser->expects($this->any())->method('getDataPairs')->will($this->returnValueMap([['/app/module/en_US.csv', 0, 1, $moduleData], ['/app/module/en_GB.csv', 0, 1, $moduleData], ['/theme.csv', 0, 1, $themeData]])); // _loadThemeTranslation() $this->viewFileSystem->expects($this->any())->method('getLocaleFileName')->will($this->returnValue('/theme.csv')); // _loadPackTranslation $packData = ['pack original' => 'pack translated', 'module pack' => 'pack translated overwrite', 'module db' => 'pack-db translated overwrite']; $this->packDictionary->expects($this->once())->method('getDictionary')->will($this->returnValue($packData)); // _loadDbTranslation() $dbData = ['db original' => 'db translated', 'module db' => 'db translated overwrite']; $this->resource->expects($this->any())->method('getTranslationArray')->will($this->returnValue($dbData)); $this->cache->expects($this->exactly(1))->method('save'); $this->translate->loadData($area, $forceReload); $expected = ['module original' => 'module translated', 'module theme' => 'theme translated overwrite', 'module pack' => 'pack translated overwrite', 'module db' => 'db translated overwrite', 'theme original' => 'theme translated', 'pack original' => 'pack translated', 'db original' => 'db translated']; $this->assertEquals($expected, $this->translate->getData()); }
/** * Run test for get method * * @return void */ public function testGet() { $filename = 'test-filename'; $expected = ['file1', 'file2']; $this->readerMock->expects($this->once())->method('getConfigurationFiles')->with($filename)->willReturn($expected); $this->assertEquals($expected, $this->fileResolver->get($filename, null)); }
public function testGetModuleDirWhenCustomDirIsSet() { $moduleDir = 'app/code/Test/Module/etc/custom'; $this->_dirsMock->expects($this->never())->method('getDir'); $this->_model->setModuleDir('Test_Module', 'etc', $moduleDir); $this->assertEquals($moduleDir, $this->_model->getModuleDir(Dir::MODULE_ETC_DIR, 'Test_Module')); }
/** * Read locales * @param \Magento\Framework\Module\Dir\Reader $moduleReader */ public function __construct(\Magento\Framework\Module\Dir\Reader $moduleReader) { $file = $moduleReader->getModuleDir('etc', 'BelVG_FacebookFree') . '/' . 'locale.xml'; if (is_readable($file)) { $this->locales = simplexml_load_file($file); } }
protected function setUp() { $this->moduleDir = 'moduleDirectory'; $this->moduleReader = $this->getMock('Magento\\Framework\\Module\\Dir\\Reader', [], [], '', false); $this->moduleReader->expects($this->any())->method('getModuleDir')->willReturn($this->moduleDir); $this->schemaLocator = new SchemaLocator($this->moduleReader); }
/** * Retrieve the list of resources declared by the given module * * @param string $moduleName * @return string[] */ public function getResourceList($moduleName) { if (!isset($this->_moduleResources[$moduleName])) { // Process sub-directories within modules sql directory $moduleSqlDir = $this->_moduleReader->getModuleDir('sql', $moduleName); $sqlResources = array(); $resourceDirs = glob($moduleSqlDir . '/*', GLOB_ONLYDIR); if (!empty($resourceDirs)) { foreach ($resourceDirs as $resourceDir) { $sqlResources[] = basename($resourceDir); } } $moduleDataDir = $this->_moduleReader->getModuleDir('data', $moduleName); // Process sub-directories within modules data directory $dataResources = array(); $resourceDirs = glob($moduleDataDir . '/*', GLOB_ONLYDIR); if (!empty($resourceDirs)) { foreach ($resourceDirs as $resourceDir) { $dataResources[] = basename($resourceDir); } } $this->_moduleResources[$moduleName] = array_unique(array_merge($sqlResources, $dataResources)); } return $this->_moduleResources[$moduleName]; }
/** * Build DOM with initial XML contents and specifying identifier attributes for merging * * Format of $schemaFileType: array('etc', 'sql', 'data', 'i18n', 'view', 'Controller') * Format of $schemaFileModule: 'Magento_XXXXX' * Format of $schemaFileName: 'schema.xsd' * Format of $idAttributes: array('name', 'id') * Format of $contextXPath: array('/config/ui') * The path to ID attribute name should not include any attribute notations or modifiers -- only node names * * @param string $schemaFileType * @param string $schemaFileModule * @param string $schemaFileName * @param DirectoryReader $directoryReader * @param bool $isMergeSimpleXMLElement * @param array $contextXPath * @param array $idAttributes */ public function __construct(DirectoryReader $directoryReader, $schemaFileType, $schemaFileModule, $schemaFileName, $isMergeSimpleXMLElement = false, array $contextXPath = [], array $idAttributes = []) { $this->schemaFilePath = $directoryReader->getModuleDir($schemaFileType, $schemaFileModule) . '/' . trim($schemaFileName, '/'); $this->isMergeSimpleXMLElement = $isMergeSimpleXMLElement; $this->contextXPath = $contextXPath; $this->idAttributes = $idAttributes; }
/** * @param \Magento\Framework\Module\Dir\Reader $modulesReader * @param \Magento\Framework\Config\DomFactory $domConfigFactory */ public function __construct(\Magento\Framework\Module\Dir\Reader $modulesReader, \Magento\Framework\Config\DomFactory $domConfigFactory) { $this->_modulesReader = $modulesReader; $this->_domConfigFactory = $domConfigFactory; $this->_initMessageTemplates(); $this->_xsdSchemas = array(self::LAYOUT_SCHEMA_SINGLE_HANDLE => $this->_modulesReader->getModuleDir('etc', 'Magento_Core') . '/layout_single.xsd', self::LAYOUT_SCHEMA_MERGED => $this->_modulesReader->getModuleDir('etc', 'Magento_Core') . '/layout_merged.xsd'); }
protected function setUp() { $this->_xsdFile = $this->_xsdDir . '/address_formats.xsd'; $this->_moduleReader = $this->getMock('Magento\\Framework\\Module\\Dir\\Reader', ['getModuleDir'], [], '', false); $this->_moduleReader->expects($this->once())->method('getModuleDir')->with('etc', 'Magento_Customer')->will($this->returnValue($this->_xsdDir)); $this->_model = new \Magento\Customer\Model\Address\Config\SchemaLocator($this->_moduleReader); }
/** * constructor * * @param \Magento\Framework\Module\Dir\Reader $moduleReader * @param $fileSchema * @param null $mergedSchema */ public function __construct(Reader $moduleReader, $fileSchema, $mergedSchema = null) { if (is_null($mergedSchema)) { $mergedSchema = $fileSchema . '_merged'; } $this->schema = $moduleReader->getModuleDir('etc', 'Umc_Base') . '/umc/' . $mergedSchema . '.xsd'; $this->perFileSchema = $moduleReader->getModuleDir('etc', 'Umc_Base') . '/umc/' . $fileSchema . '.xsd'; }
/** * @return bool */ public function hasLocalCopy() { $path = $this->_moduleReader->getModuleDir('etc', 'Magento_Adminhtml'); $directory = $this->_filesystem->getDirectoryRead(\Magento\Framework\App\Filesystem::MODULES_DIR); if ($path && $directory->isDirectory($directory->getRelativePath($path))) { return true; } return false; }
/** * Read list of all available application actions * * @return array */ public function read() { $actionFiles = $this->moduleReader->getActionFiles(); $actions = array(); foreach ($actionFiles as $actionFile) { $action = str_replace('/', '\\', substr($actionFile, 0, -4)); $actions[strtolower($action)] = $action; } return $actions; }
/** * Save default translator */ protected function setUp() { $this->_defaultTranslator = \Magento\Framework\Validator\AbstractValidator::getDefaultTranslator(); $this->_objectManager = $this->getMock('Magento\Framework\ObjectManagerInterface'); $this->_validatorConfig = $this->getMockBuilder( 'Magento\Framework\Validator\Config' )->setMethods( ['createValidatorBuilder', 'createValidator'] )->disableOriginalConstructor()->getMock(); $this->_objectManager->expects( $this->at(0) )->method( 'create' )->with( 'Magento\Framework\Translate\Adapter' )->will( $this->returnValue(new \Magento\Framework\Translate\Adapter()) ); $this->_objectManager->expects( $this->at(1) )->method( 'create' )->with( 'Magento\Framework\Validator\Config', ['configFiles' => ['/tmp/moduleOne/etc/validation.xml']] )->will( $this->returnValue($this->_validatorConfig) ); // Config mock $this->_config = $this->getMockBuilder( 'Magento\Framework\Module\Dir\Reader' )->setMethods( ['getConfigurationFiles'] )->disableOriginalConstructor()->getMock(); $this->_config->expects( $this->once() )->method( 'getConfigurationFiles' )->with( 'validation.xml' )->will( $this->returnValue(['/tmp/moduleOne/etc/validation.xml']) ); // Translate adapter mock $this->_translateAdapter = $this->getMockBuilder( 'Magento\Framework\TranslateInterface' )->disableOriginalConstructor()->getMock(); $this->cache = $this->getMockBuilder(\Magento\Framework\Cache\FrontendInterface::class) ->getMockForAbstractClass(); }
public function setUp() { $this->componentRegistrar = $this->getMock('Magento\\Framework\\Component\\ComponentRegistrar', [], [], '', false); $this->reader = $this->getMock('Magento\\Framework\\Module\\Dir\\Reader', [], [], '', false); $this->componentRegistrar->expects($this->once())->method('getPaths')->will($this->returnValue(['A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E'])); $composerData = ['A/composer.json' => '{"name":"a", "require":{"b":"0.1"}, "conflict":{"c":"0.1"}, "version":"0.1"}', 'B/composer.json' => '{"name":"b", "require":{"d":"0.3"}, "version":"0.2"}', 'C/composer.json' => '{"name":"c", "require":{"e":"0.1"}, "version":"0.1"}', 'D/composer.json' => '{"name":"d", "conflict":{"c":"0.1"}, "version":"0.3"}', 'E/composer.json' => '{"name":"e", "version":"0.4"}']; $fileIteratorMock = $this->getMock('Magento\\Framework\\Config\\FileIterator', [], [], '', false); $fileIteratorMock->expects($this->once())->method('toArray')->will($this->returnValue($composerData)); $this->reader->expects($this->once())->method('getComposerJsonFiles')->will($this->returnValue($fileIteratorMock)); $this->packageInfo = new PackageInfo($this->reader, $this->componentRegistrar); }
/** * @param \Magento\Framework\Config\CacheInterface $cache * @param ModuleReader $moduleReader * @param string $actionInterface * @param string $cacheKey * @param array $reservedWords */ public function __construct(\Magento\Framework\Config\CacheInterface $cache, ModuleReader $moduleReader, $actionInterface = '\\Magento\\Framework\\App\\ActionInterface', $cacheKey = 'app_action_list', $reservedWords = []) { $this->reservedWords = array_merge($reservedWords, $this->reservedWords); $this->actionInterface = $actionInterface; $data = $cache->load($cacheKey); if (!$data) { $this->actions = $moduleReader->getActionFiles(); $cache->save(serialize($this->actions), $cacheKey); } else { $this->actions = unserialize($data); } }
/** * Init cached list of validation files */ protected function _initializeConfigList() { if (!$this->_configFiles) { $this->_configFiles = $this->cache->load(self::CACHE_KEY); if (!$this->_configFiles) { $this->_configFiles = $this->moduleReader->getConfigurationFiles('validation.xml'); $this->cache->save(serialize($this->_configFiles), self::CACHE_KEY); } else { $this->_configFiles = unserialize($this->_configFiles); } } }
public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Module\Dir\Reader $configReader, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Store\Model\StoreManagerInterface $storeManager, \Mehulchaudhari\Geoip\Helper\Data $geoipHelper, array $data = []) { $this->_geoipHelper = $geoipHelper; $this->_logger = $context->getLogger(); $this->_scopeConfig = $scopeConfig; $this->_storeManager = $storeManager; $this->libpath = $configReader->getModuleDir('', 'Mehulchaudhari_Geoip'); if (!function_exists('geoip_country_code_by_name') && $this->_geoipHelper->getConfig('general/apache_or_file') == 1) { define('GEOIP_LOCAL', 1); $geoIpInc = $this->libpath . '/lib/geoip.inc'; include $geoIpInc; } }
/** * @param bool $check */ protected function getContentStep($check = true) { $resultPath = 'adminhtml/path/to/file.xml'; $includeXmlContent = '<config><item id="1"><test/></item><item id="2"></item></config>'; $modulesDirectoryMock = $this->getMockBuilder('Magento\\Framework\\Filesystem\\Directory\\ReadInterface')->getMockForAbstractClass(); $this->readFactoryMock->expects($this->once())->method('create')->willReturn($modulesDirectoryMock); $this->moduleReaderMock->expects($this->once())->method('getModuleDir')->with('etc', 'Module_Name')->willReturn('path/in/application/module'); $modulesDirectoryMock->expects($this->once())->method('isExist')->with($resultPath)->willReturn($check); if ($check) { $modulesDirectoryMock->expects($this->once())->method('isFile')->with($resultPath)->willReturn($check); $modulesDirectoryMock->expects($this->once())->method('readFile')->with($resultPath)->willReturn($includeXmlContent); } }
/** * {@inheritdoc} */ public function get($filename, $scope) { switch ($scope) { case 'global': $iterator = $this->_moduleReader->getConfigurationFiles($filename); break; case 'design': $iterator = $this->iteratorFactory->create($this->themesDirectory, $this->themesDirectory->search('/*/*/etc/' . $filename)); break; default: $iterator = $this->iteratorFactory->create($this->themesDirectory, array()); break; } return $iterator; }
/** * Render view config object for current package and theme * * @param array $params * @return \Magento\Framework\Config\View */ public function getViewConfig(array $params = []) { $this->assetRepo->updateDesignParams($params); /** @var $currentTheme \Magento\Framework\View\Design\ThemeInterface */ $currentTheme = $params['themeModel']; $key = $currentTheme->getCode(); if (isset($this->viewConfigs[$key])) { return $this->viewConfigs[$key]; } $configFiles = $this->moduleReader->getConfigurationFiles(basename($this->filename))->toArray(); $themeConfigFile = $currentTheme->getCustomization()->getCustomViewConfigPath(); if (empty($themeConfigFile) || !$this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile)) ) { $themeConfigFile = $this->viewFileSystem->getFilename($this->filename, $params); } if ($themeConfigFile && $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile)) ) { $configFiles[$this->rootDirectory->getRelativePath($themeConfigFile)] = $this->rootDirectory->readFile( $this->rootDirectory->getRelativePath($themeConfigFile) ); } $config = $this->viewFactory->create($configFiles); $this->viewConfigs[$key] = $config; return $config; }
/** * {@inheritdoc} */ public function get($filename, $scope) { switch ($scope) { case 'global': $iterator = $this->_moduleReader->getConfigurationFiles($filename); break; case 'design': $themePaths = $this->componentDirSearch->collectFiles(ComponentRegistrar::THEME, 'etc/' . $filename); $iterator = $this->iteratorFactory->create($themePaths); break; default: $iterator = $this->iteratorFactory->create([]); break; } return $iterator; }
/** * {@inheritdoc} */ public function get($filename, $scope) { switch ($scope) { case 'primary': $directory = $this->filesystem->getDirectoryRead(DirectoryList::CONFIG); $iterator = $this->iteratorFactory->create($directory, $directory->search('{' . $filename . ',*/' . $filename . '}')); break; case 'global': $iterator = $this->_moduleReader->getConfigurationFiles($filename); break; default: $iterator = $this->_moduleReader->getConfigurationFiles($scope . '/' . $filename); break; } return $iterator; }
/** * Return generated varnish.vcl configuration file * * @param string $vclTemplatePath * @return string * @api */ public function getVclFile($vclTemplatePath) { $moduleEtcPath = $this->reader->getModuleDir(Dir::MODULE_ETC_DIR, 'Magento_PageCache'); $configFilePath = $moduleEtcPath . '/' . $this->_scopeConfig->getValue($vclTemplatePath); $directoryRead = $this->readFactory->create($moduleEtcPath); $configFilePath = $directoryRead->getRelativePath($configFilePath); $data = $directoryRead->readFile($configFilePath); return strtr($data, $this->_getReplacements()); }
/** * Get content of include file (in adminhtml area) * * @param string $includePath * @return string * @throws LocalizedException */ protected function getContent($includePath) { // <include path="Magento_Payment::my_payment.xml" /> list($moduleName, $filename) = explode('::', $includePath); $path = 'adminhtml/' . $filename; $directoryRead = $this->readFactory->create($this->moduleReader->getModuleDir(Dir::MODULE_ETC_DIR, $moduleName)); if ($directoryRead->isExist($path) && $directoryRead->isFile($path)) { return $directoryRead->readFile($path); } throw new LocalizedException(__('The file "%1" does not exist', $path)); }
/** * Download sample file action * * @return \Magento\Framework\Controller\Result\Raw */ public function execute() { $fileName = $this->getRequest()->getParam('filename') . '.csv'; $moduleDir = $this->reader->getModuleDir('', self::SAMPLE_FILES_MODULE); $fileAbsolutePath = $moduleDir . '/' . $fileName; $directoryRead = $this->readFactory->create($moduleDir); $filePath = $directoryRead->getRelativePath($fileAbsolutePath); if (!$directoryRead->isFile($filePath)) { /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ $this->messageManager->addError(__('There is no sample file for this entity.')); $resultRedirect = $this->resultRedirectFactory->create(); $resultRedirect->setPath('*/import'); return $resultRedirect; } $fileSize = isset($directoryRead->stat($filePath)['size']) ? $directoryRead->stat($filePath)['size'] : null; $this->fileFactory->create($fileName, null, DirectoryList::VAR_DIR, 'application/octet-stream', $fileSize); /** @var \Magento\Framework\Controller\Result\Raw $resultRaw */ $resultRaw = $this->resultRawFactory->create(); $resultRaw->setContents($directoryRead->readFile($filePath)); return $resultRaw; }
/** * Get content include file (in adminhtml area) * * @param string $includePath * @return string * @throws LocalizedException */ protected function getContent($includePath) { $modulesDirectory = $this->filesystem->getDirectoryRead(DirectoryList::MODULES); // <include path="Magento_Payment::my_payment.xml" /> list($moduleName, $filename) = explode('::', $includePath); $file = $this->moduleReader->getModuleDir('etc', $moduleName) . '/adminhtml/' . $filename; $path = $modulesDirectory->getRelativePath($file); if ($modulesDirectory->isExist($path) && $modulesDirectory->isFile($path)) { return $modulesDirectory->readFile($path); } throw new LocalizedException(__('The file "' . $path . '" does not exist')); }
public function testGetViewConfig() { $themeMock = $this->getMock('Magento\\Theme\\Model\\Theme', ['getId', 'getCustomization', 'getCustomViewConfigPath'], [], '', false); $themeMock->expects($this->atLeastOnce())->method('getId')->will($this->returnValue(2)); $themeMock->expects($this->once())->method('getCustomization')->will($this->returnSelf()); $themeMock->expects($this->once())->method('getCustomViewConfigPath')->will($this->returnValue('')); $params = ['themeModel' => $themeMock]; $configFile = 'config.xml'; $this->repositoryMock->expects($this->atLeastOnce())->method('updateDesignParams')->with($this->equalTo($params))->will($this->returnSelf()); $iterator = $this->getMock('Magento\\Framework\\Config\\FileIterator', [], [], '', false); $iterator->expects($this->once())->method('toArray')->will($this->returnValue([])); $this->readerMock->expects($this->once())->method('getConfigurationFiles')->with($this->equalTo(basename(\Magento\Framework\View\ConfigInterface::CONFIG_FILE_NAME)))->will($this->returnValue($iterator)); $this->directoryReadMock->expects($this->once())->method('isExist')->with($this->anything())->will($this->returnValue(true)); $this->fileSystemMock->expects($this->once())->method('getFilename')->with($this->equalTo(\Magento\Framework\View\ConfigInterface::CONFIG_FILE_NAME), $params)->will($this->returnValue($configFile)); $this->directoryReadMock->expects($this->any())->method('getRelativePath')->with($this->equalTo($configFile))->will($this->returnArgument(0)); $xmlData = '<view><vars module="Magento_Catalog"><var name="test">1</var></vars></view>'; $this->directoryReadMock->expects($this->once())->method('readFile')->with($this->equalTo($configFile))->will($this->returnValue($xmlData)); $this->assertInstanceOf('Magento\\Framework\\Config\\View', $this->config->getViewConfig($params)); // lazy load test $this->assertInstanceOf('Magento\\Framework\\Config\\View', $this->config->getViewConfig($params)); }
/** * Get validator * * @param array $data * @return \Magento\Framework\Validator */ protected function _getValidator(array $data) { if ($this->_validator !== null) { return $this->_validator; } $configFiles = $this->_modulesReader->getConfigurationFiles('validation.xml'); $validatorFactory = $this->_validatorConfigFactory->create(['configFiles' => $configFiles]); $builder = $validatorFactory->createValidatorBuilder('customer', 'form'); $builder->addConfiguration('metadata_data_validator', ['method' => 'setAttributes', 'arguments' => [$this->getAllowedAttributes()]]); $builder->addConfiguration('metadata_data_validator', ['method' => 'setData', 'arguments' => [$data]]); $builder->addConfiguration('metadata_data_validator', ['method' => 'setEntityType', 'arguments' => [$this->_entityType]]); $this->_validator = $builder->createValidator(); return $this->_validator; }