Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
createAdminUser example
/** * {@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
(
)
)
)
;