src/Controller/Plugin/UserCreator.php
public function process($username, $password, $email)
    {
        $dm = $this->documentManager;

        /* @var UserRepository $repo */
        $repo = $dm->getRepository(User::class);
        $credential = $this->credentialFilter->filter($password);
        $info = new Info();
        $info->setEmail($email);
        $user = new User();
        $user
            ->setIsDraft(false)
            ->setRole('admin')
            ->setLogin($username)
            ->setCredential($credential)
            ->setInfo($info)
        ;
        $repo->setEntityPrototype(new User());

        $result = true;
        try{
            $repo->store($user);
        }catch (\Exception $e){
            throw $e;
        }
        return $result;
    }
public function process($username, $password, $email)
    {
        $dm = $this->documentManager;

        /* @var UserRepository $repo */
        $repo = $dm->getRepository(User::class);
        $credential = $this->credentialFilter->filter($password);
        $info = new Info();
        $info->setEmail($email);
        $user = new User();
        $user
            ->setIsDraft(false)
            ->setRole('admin')
            ->setLogin($username)
            ->setCredential($credential)
            ->setInfo($info)
        ;
        $repo->setEntityPrototype(new User());

        $result = true;
        try{
            $repo->store($user);
        }catch (\Exception $e){
            throw $e;
        }
        return $result;
    }
public function process ( $ username , $ password , $ email ) { $ dm = $ this -> documentManager ; /* @var UserRepository $repo */ $ repo = $ dm -> getRepository ( User :: class ) ; $ credential = $ this -> credentialFilter -> filter ( $ password ) ; $ info = new Info ( ) ; $ info -> setEmail ( $ email ) ; $ user = new User ( ) ; $ user -> setIsDraft ( false ) -> setRole ( 'admin' ) -> setLogin ( $ username ) -> setCredential ( $ credential ) -> setInfo ( $ info ) ; $ repo -> setEntityPrototype ( new User ( ) ) ; $ result = true ; try { $ repo -> store ( $ user ) ; } catch ( \ Exception $ e ) { throw $ e ; } return $ result ; }
Inserts a minimalistic user document into the database.

@param   string $username Login name
@param   string $password Credential
@param   string $email Email
@throws  \Exception when fail store user entity

@return bool
Inserts a minimalistic user document into the database .