Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions
CustomerGroupConfig Class Reference
Inheritance diagram for CustomerGroupConfig:
CustomerGroupConfigInterface

Public Member Functions

 __construct (\Magento\Config\Model\Config $config, \Magento\Customer\Api\GroupRepositoryInterface $groupRepository)
 
 setDefaultCustomerGroup ($id)
 

Detailed Description

System configuration operations for customer groups.

Definition at line 12 of file CustomerGroupConfig.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Config\Model\Config  $config,
\Magento\Customer\Api\GroupRepositoryInterface  $groupRepository 
)
Parameters
\Magento\Config\Model\Config$config
\Magento\Customer\Api\GroupRepositoryInterface$groupRepository

Definition at line 28 of file CustomerGroupConfig.php.

31  {
32  $this->config = $config;
33  $this->groupRepository = $groupRepository;
34  }

Member Function Documentation

◆ setDefaultCustomerGroup()

setDefaultCustomerGroup (   $id)

Set system default customer group.

Parameters
int$id
Returns
int
Exceptions

Implements CustomerGroupConfigInterface.

Definition at line 39 of file CustomerGroupConfig.php.

40  {
41  if ($this->groupRepository->getById($id)) {
42  $this->config->setDataByPath(
44  $id
45  );
46  $this->config->save();
47  }
48 
49  return $id;
50  }
$id
Definition: fieldset.phtml:14

The documentation for this class was generated from the following file: