src/Slashworks/BackendBundle/Helper/InstallHelper.php
private static function _createAdminUser()
        {

            $oUser     = new User();
            $factory   = self::$_container->get('security.encoder_factory');
            $encoder   = $factory->getEncoder($oUser);
            $sSalt     = $oUser->getSalt();
            $sPassword = $encoder->encodePassword(self::$_data['adminPassword'], $sSalt);


            $oStatement = self::$_connection->prepare('INSERT INTO `user` (`id`, `username`, `password`, `salt`, `firstname`, `lastname`, `email`, `phone`, `memo`, `activated`, `last_login`, `notification_change`, `notification_error`) VALUES (null, :adminUser, :adminPassword , :adminPasswordSalt, \'admin\', \'admin\', :adminEmail, \'\', \'\', 1, \'0000-00-00 00:00:00\', 1, 1);');
            $oResult    = $oStatement->execute(array(
                                                   ":adminUser"         => self::$_data['adminUser'],
                                                   ":adminPassword"     => $sPassword,
                                                   ":adminPasswordSalt" => $sSalt,
                                                   ":adminEmail"        => self::$_data['adminEmail'],
                                               ));

            if ($oResult !== true) {
                throw new Exception("Error while creating admin user");
            }

            $iUserId = self::$_connection->lastInsertId();

            $oStatement = self::$_connection->prepare('INSERT INTO  `user_role` (`user_id` ,`role_id`)VALUES (:user_id,  :user_role_id);');
            $oResult    = $oStatement->execute(array(
                                                   ":user_id"      => $iUserId,
                                                   ":user_role_id" => 6,
                                               ));

            if ($oResult !== true) {
                throw new Exception("Error while creating admin user");
            }

        }
private static function _createAdminUser()
        {

            $oUser     = new User();
            $factory   = self::$_container->get('security.encoder_factory');
            $encoder   = $factory->getEncoder($oUser);
            $sSalt     = $oUser->getSalt();
            $sPassword = $encoder->encodePassword(self::$_data['adminPassword'], $sSalt);


            $oStatement = self::$_connection->prepare('INSERT INTO `user` (`id`, `username`, `password`, `salt`, `firstname`, `lastname`, `email`, `phone`, `memo`, `activated`, `last_login`, `notification_change`, `notification_error`) VALUES (null, :adminUser, :adminPassword , :adminPasswordSalt, \'admin\', \'admin\', :adminEmail, \'\', \'\', 1, \'0000-00-00 00:00:00\', 1, 1);');
            $oResult    = $oStatement->execute(array(
                                                   ":adminUser"         => self::$_data['adminUser'],
                                                   ":adminPassword"     => $sPassword,
                                                   ":adminPasswordSalt" => $sSalt,
                                                   ":adminEmail"        => self::$_data['adminEmail'],
                                               ));

            if ($oResult !== true) {
                throw new Exception("Error while creating admin user");
            }

            $iUserId = self::$_connection->lastInsertId();

            $oStatement = self::$_connection->prepare('INSERT INTO  `user_role` (`user_id` ,`role_id`)VALUES (:user_id,  :user_role_id);');
            $oResult    = $oStatement->execute(array(
                                                   ":user_id"      => $iUserId,
                                                   ":user_role_id" => 6,
                                               ));

            if ($oResult !== true) {
                throw new Exception("Error while creating admin user");
            }

        }
private static function _createAdminUser ( ) { $ oUser = new User ( ) ; $ factory = self :: $ _container -> get ( 'security.encoder_factory' ) ; $ encoder = $ factory -> getEncoder ( $ oUser ) ; $ sSalt = $ oUser -> getSalt ( ) ; $ sPassword = $ encoder -> encodePassword ( self :: $ _data [ 'adminPassword' ] , $ sSalt ) ; $ oStatement = self :: $ _connection -> prepare ( 'INSERT INTO `user` (`id`, `username`, `password`, `salt`, `firstname`, `lastname`, `email`, `phone`, `memo`, `activated`, `last_login`, `notification_change`, `notification_error`) VALUES (null, :adminUser, :adminPassword , :adminPasswordSalt, \'admin\', \'admin\', :adminEmail, \'\', \'\', 1, \'0000-00-00 00:00:00\', 1, 1);' ) ; $ oResult = $ oStatement -> execute ( array ( ":adminUser" => self :: $ _data [ 'adminUser' ] , ":adminPassword" => $ sPassword , ":adminPasswordSalt" => $ sSalt , ":adminEmail" => self :: $ _data [ 'adminEmail' ] , ) ) ; if ( $ oResult !== true ) { throw new Exception ( "Error while creating admin user" ) ; } $ iUserId = self :: $ _connection -> lastInsertId ( ) ; $ oStatement = self :: $ _connection -> prepare ( 'INSERT INTO  `user_role` (`user_id` ,`role_id`)VALUES (:user_id,  :user_role_id);' ) ; $ oResult = $ oStatement -> execute ( array ( ":user_id" => $ iUserId , ":user_role_id" => 6 , ) ) ; if ( $ oResult !== true ) { throw new Exception ( "Error while creating admin user" ) ; } }
create the admin user
create the admin user