AttributeFactory.php 900 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Eav\Model;
  7. /**
  8. * EAV attribute model factory
  9. *
  10. * @api
  11. * @codeCoverageIgnore
  12. * @since 100.0.2
  13. */
  14. class AttributeFactory
  15. {
  16. /**
  17. * @var \Magento\Framework\ObjectManagerInterface
  18. */
  19. protected $_objectManager;
  20. /**
  21. * @param \Magento\Framework\ObjectManagerInterface $objectManager
  22. */
  23. public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager)
  24. {
  25. $this->_objectManager = $objectManager;
  26. }
  27. /**
  28. * Create new Eav attribute instance
  29. *
  30. * @param string $className
  31. * @param array $arguments
  32. * @return mixed
  33. */
  34. public function createAttribute($className, $arguments = [])
  35. {
  36. return $this->_objectManager->create($className, ['data' => $arguments]);
  37. }
  38. }