Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CustomerGroupConfig.php
Go to the documentation of this file.
1 <?php
7 namespace Magento\Customer\Model;
8 
13 {
17  private $config;
18 
22  private $groupRepository;
23 
28  public function __construct(
29  \Magento\Config\Model\Config $config,
30  \Magento\Customer\Api\GroupRepositoryInterface $groupRepository
31  ) {
32  $this->config = $config;
33  $this->groupRepository = $groupRepository;
34  }
35 
39  public function setDefaultCustomerGroup($id)
40  {
41  if ($this->groupRepository->getById($id)) {
42  $this->config->setDataByPath(
44  $id
45  );
46  $this->config->save();
47  }
48 
49  return $id;
50  }
51 }
__construct(\Magento\Config\Model\Config $config, \Magento\Customer\Api\GroupRepositoryInterface $groupRepository)
$groupRepository
$config
Definition: fraud_order.php:17
$id
Definition: fieldset.phtml:14