protected function applyConfig(array $moduleConfiguration)
    {
        foreach ($moduleConfiguration['customer_group'] as $customerGroupData) {
            if (CustomerGroupQuery::create()->findOneByCode($customerGroupData['code']) === null) {
                $customerGroup = (new CustomerGroup)
                    ->setCode($customerGroupData['code']);

                foreach ($customerGroupData['descriptive'] as $descriptiveData) {
                    $customerGroup
                        ->setLocale($descriptiveData['locale'])
                        ->setTitle($descriptiveData['title'])
                        ->setDescription($descriptiveData['description']);
                }

                $customerGroup->save();
            }
        }

        if ($moduleConfiguration['default']) {
            $customerGroup = CustomerGroupQuery::create()->findOneByCode($moduleConfiguration['default']);
            if ($customerGroup !== null) {
                $this->resetDefault();

                $customerGroup
                    ->setIsDefault(true)
                    ->save();
            }
        }
    }
protected function applyConfig(array $moduleConfiguration)
    {
        foreach ($moduleConfiguration['customer_group'] as $customerGroupData) {
            if (CustomerGroupQuery::create()->findOneByCode($customerGroupData['code']) === null) {
                $customerGroup = (new CustomerGroup)
                    ->setCode($customerGroupData['code']);

                foreach ($customerGroupData['descriptive'] as $descriptiveData) {
                    $customerGroup
                        ->setLocale($descriptiveData['locale'])
                        ->setTitle($descriptiveData['title'])
                        ->setDescription($descriptiveData['description']);
                }

                $customerGroup->save();
            }
        }

        if ($moduleConfiguration['default']) {
            $customerGroup = CustomerGroupQuery::create()->findOneByCode($moduleConfiguration['default']);
            if ($customerGroup !== null) {
                $this->resetDefault();

                $customerGroup
                    ->setIsDefault(true)
                    ->save();
            }
        }
    }
protected function applyConfig ( array $ moduleConfiguration ) { foreach ( $ moduleConfiguration [ 'customer_group' ] as $ customerGroupData ) { if ( CustomerGroupQuery :: create ( ) -> findOneByCode ( $ customerGroupData [ 'code' ] ) === null ) { $ customerGroup = ( new CustomerGroup ) -> setCode ( $ customerGroupData [ 'code' ] ) ; foreach ( $ customerGroupData [ 'descriptive' ] as $ descriptiveData ) { $ customerGroup -> setLocale ( $ descriptiveData [ 'locale' ] ) -> setTitle ( $ descriptiveData [ 'title' ] ) -> setDescription ( $ descriptiveData [ 'description' ] ) ; } $ customerGroup -> save ( ) ; } } if ( $ moduleConfiguration [ 'default' ] ) { $ customerGroup = CustomerGroupQuery :: create ( ) -> findOneByCode ( $ moduleConfiguration [ 'default' ] ) ; if ( $ customerGroup !== null ) { $ this -> resetDefault ( ) ; $ customerGroup -> setIsDefault ( true ) -> save ( ) ; } } }
Save new customer group to database

@param array $moduleConfiguration Customer group module configuration
Save new customer group to database