Reader.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Resources configuration filesystem loader
  4. *
  5. * Copyright © Magento, Inc. All rights reserved.
  6. * See COPYING.txt for license details.
  7. */
  8. namespace Magento\Framework\App\ResourceConnection\Config;
  9. class Reader extends \Magento\Framework\Config\Reader\Filesystem
  10. {
  11. /**
  12. * List of id attributes for merge
  13. *
  14. * @var array
  15. */
  16. protected $_idAttributes = ['/config/resource' => 'name'];
  17. /**
  18. * @param \Magento\Framework\Config\FileResolverInterface $fileResolver
  19. * @param Converter $converter
  20. * @param SchemaLocator $schemaLocator
  21. * @param \Magento\Framework\Config\ValidationStateInterface $validationState
  22. * @param string $fileName
  23. * @param array $idAttributes
  24. * @param string $domDocumentClass
  25. * @param string $defaultScope
  26. */
  27. public function __construct(
  28. \Magento\Framework\Config\FileResolverInterface $fileResolver,
  29. Converter $converter,
  30. SchemaLocator $schemaLocator,
  31. \Magento\Framework\Config\ValidationStateInterface $validationState,
  32. $fileName = 'resources.xml',
  33. $idAttributes = [],
  34. $domDocumentClass = \Magento\Framework\Config\Dom::class,
  35. $defaultScope = 'global'
  36. ) {
  37. parent::__construct(
  38. $fileResolver,
  39. $converter,
  40. $schemaLocator,
  41. $validationState,
  42. $fileName,
  43. $idAttributes,
  44. $domDocumentClass,
  45. $defaultScope
  46. );
  47. }
  48. /**
  49. * Read resource configuration
  50. *
  51. * @param string $scope
  52. * @return array
  53. */
  54. public function read($scope = null)
  55. {
  56. return $scope !== 'primary' ? parent::read($scope) : [];
  57. }
  58. }