CreateUserCommand

Extends \Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand

Class CreateUserCommand provides CLI function to add users

package

App\Command

Methods

CreateUserCommand constructor.

__construct(\Doctrine\ORM\EntityManagerInterface $em, \Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface $passwordEncoder, null|string $name = null) 

Arguments

$em

\Doctrine\ORM\EntityManagerInterface

$passwordEncoder

\Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface

$name

null|string

Provides the Composer console command description

configure() 

Creates the user with administrative privileges

create_user(string $username, string $password, string $email, \Symfony\Component\Console\Style\SymfonyStyle $io) 

Arguments

$username

string

$password

string

$email

string

$io

\Symfony\Component\Console\Style\SymfonyStyle

Executes the CLI command and provides the form input for adding a user

execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output) : integer|null|void

Arguments

$input

\Symfony\Component\Console\Input\InputInterface

$output

\Symfony\Component\Console\Output\OutputInterface

Response

integer|null|void

Properties

Doctrine Entity Interface to access Users Entity

em : \Doctrine\ORM\EntityManagerInterface
var

Type(s)

\Doctrine\ORM\EntityManagerInterface

Symfony Password Encoder to provide bcrypt authentication

passwordEncoder : \Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface
var

Type(s)

\Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface

Users Roles array

roles : array
var

Type(s)

array