Config.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\ImportExport\Model\Export;
  7. use Magento\Framework\Serialize\SerializerInterface;
  8. /**
  9. * Provides export configuration
  10. */
  11. class Config extends \Magento\Framework\Config\Data implements \Magento\ImportExport\Model\Export\ConfigInterface
  12. {
  13. /**
  14. * Constructor
  15. *
  16. * @param Config\Reader $reader
  17. * @param \Magento\Framework\Config\CacheInterface $cache
  18. * @param string|null $cacheId
  19. * @param SerializerInterface|null $serializer
  20. */
  21. public function __construct(
  22. \Magento\ImportExport\Model\Export\Config\Reader $reader,
  23. \Magento\Framework\Config\CacheInterface $cache,
  24. $cacheId = 'export_config_cache',
  25. SerializerInterface $serializer = null
  26. ) {
  27. parent::__construct($reader, $cache, $cacheId, $serializer);
  28. }
  29. /**
  30. * Retrieve export entities configuration
  31. *
  32. * @return array
  33. */
  34. public function getEntities()
  35. {
  36. return $this->get('entities');
  37. }
  38. /**
  39. * Retrieve export entity types configuration
  40. *
  41. * @param string $entity
  42. * @return array
  43. */
  44. public function getEntityTypes($entity)
  45. {
  46. $entities = $this->getEntities();
  47. return isset($entities[$entity]) ? $entities[$entity]['types'] : [];
  48. }
  49. /**
  50. * Retrieve export file formats configuration
  51. *
  52. * @return array
  53. */
  54. public function getFileFormats()
  55. {
  56. return $this->get('fileFormats');
  57. }
  58. }