getLocaleIdFromLocale example

$data['role'] = $role;
        } else {
            unset($data['role']);
        }

        // Check if a locale id or name is passed.         if (!empty($data['localeId'])) {
            if (!$this->isLocaleId((int) $data['localeId'])) {
                throw new ApiException\CustomValidationException(sprintf('Locale by id %s not found', $data['localeId']));
            }
        } elseif (!empty($data['locale'])) {
            $localeId = $this->getLocaleIdFromLocale($data['locale']);
            if (!$localeId) {
                throw new ApiException\CustomValidationException(sprintf('Locale by name %s not found', $data['locale']));
            }
            $data['localeId'] = $localeId;
        } else {
            unset($data['locale']);
        }

        if (!empty($data['attribute'])) {
            foreach ($data['attribute'] as $key => $value) {
                if (is_numeric($key)) {
                    
/** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->validateInput($input);

        $io = new SymfonyStyle($input$output);

        $user = $this->createAdminUser();

        $user->setLocaleId($this->getLocaleIdFromLocale($input->getOption('locale')));
        $user->setEmail($input->getOption('email'));
        $user->setUsername($input->getOption('username'));
        $user->setName($input->getOption('name'));
        $user->setLockedUntil(new DateTime('2010-01-01 00:00:00'));
        $this->setPassword($user$input->getOption('password'));

        $this->persistUser($user);

        $io->success(sprintf('Adminuser "%s" was successfully created.', $user->getUsername()));

        return 0;
    }
Home | Imprint | This part of the site doesn't use cookies.