SchemaLocator.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Elasticsearch\Model\Adapter\Index\Config;
  7. use Magento\Framework\Config\SchemaLocatorInterface;
  8. use Magento\Framework\Module\Dir;
  9. class SchemaLocator implements SchemaLocatorInterface
  10. {
  11. /**
  12. * XML schema for config file.
  13. */
  14. const CONFIG_FILE_SCHEMA = 'esconfig.xsd';
  15. /**
  16. * Path to corresponding XSD file with validation rules for merged config
  17. *
  18. * @var string
  19. */
  20. protected $schema = null;
  21. /**
  22. * Path to corresponding XSD file with validation rules for separate config files
  23. * @var string
  24. */
  25. protected $perFileSchema = null;
  26. /**
  27. * @param \Magento\Framework\Module\Dir\Reader $moduleReader
  28. */
  29. public function __construct(\Magento\Framework\Module\Dir\Reader $moduleReader)
  30. {
  31. $configDir = $moduleReader->getModuleDir(Dir::MODULE_ETC_DIR, 'Magento_Elasticsearch');
  32. $this->schema = $configDir . DIRECTORY_SEPARATOR . self::CONFIG_FILE_SCHEMA;
  33. $this->perFileSchema = $configDir . DIRECTORY_SEPARATOR . self::CONFIG_FILE_SCHEMA;
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function getSchema()
  39. {
  40. return $this->schema;
  41. }
  42. /**
  43. * {@inheritdoc}
  44. */
  45. public function getPerFileSchema()
  46. {
  47. return $this->perFileSchema;
  48. }
  49. }