Guest User

Untitled

a guest
Jul 16th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <?php
  2. namespace MageVision\Blog28\Helper;
  3.  
  4. use Magento\Framework\App\Helper\AbstractHelper;
  5. use Magento\Framework\App\Helper\Context;
  6. use Magento\Customer\Model\ResourceModel\Group\CollectionFactory;
  7.  
  8. class Data extends AbstractHelper
  9. {
  10. /**
  11. * @var CollectionFactory
  12. */
  13. protected $collectionFactory;
  14.  
  15. /**
  16. * @param Context $context
  17. * @param CollectionFactory $collectionFactory
  18. */
  19. public function __construct(
  20. Context $context,
  21. CollectionFactory $collectionFactory
  22. ) {
  23. parent::__construct($context);
  24. $this->collectionFactory = $collectionFactory;
  25. }
  26.  
  27. /**
  28. * Get all customer groups to option array
  29. *
  30. * @return array
  31. */
  32. public function getCustomerGroupsArray()
  33. {
  34. return $this->collectionFactory->create()->toOptionArray();
  35. }
  36. /**
  37. * Get all customer groups collection
  38. *
  39. * @return \Magento\Customer\Model\ResourceModel\Group\Collection
  40. */
  41. public function getCustomerGroupsCollection()
  42. {
  43. return $this->collectionFactory->create();
  44. }
  45. }
Add Comment
Please, Sign In to add comment