commit 8a88f174bd0c475f7f960b7725d4a2faa38f8d06
parent faea086be7de7af088b0c7a3d398afc3394f5e18
Author: Timo A. Hummel <felicitus@felicitus.org>
Date: Sun, 1 Nov 2015 22:01:32 +0100
Removed legacy create user and set password commands, fos:user:create and fos:user:change-password are the proper commands. Fixes #449
Diffstat:
3 files changed, 0 insertions(+), 126 deletions(-)
diff --git a/src/PartKeepr/AuthBundle/Console/Command/CreateUserCommand.php b/src/PartKeepr/AuthBundle/Console/Command/CreateUserCommand.php
@@ -1,46 +0,0 @@
-<?php
-namespace PartKeepr\AuthBundle\Console\Command;
-
-use Doctrine\ORM\EntityManager;
-use PartKeepr\AuthBundle\Entity\User;
-use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
-use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Output\OutputInterface;
-
-class CreateUserCommand extends ContainerAwareCommand
-{
- protected function configure()
- {
- $this
- ->setName('partkeepr:user:create')
- ->setDescription('Creates an user')
- ->addArgument(
- 'username',
- InputArgument::REQUIRED,
- 'The username'
- )
- ->addArgument(
- 'password',
- InputArgument::REQUIRED,
- 'The password'
- );
- }
-
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $username = $input->getArgument('username');
- $password = $input->getArgument('password');
-
- $user = new User($username, $password);
-
- $em = $this->getContainer()->get('doctrine')->getManager();
-
- /** @var $em EntityManager */
-
- $em->persist($user);
- $em->flush();
-
- $output->writeln("User created");
- }
-}-
\ No newline at end of file
diff --git a/src/PartKeepr/AuthBundle/Console/Command/SetPasswordCommand.php b/src/PartKeepr/AuthBundle/Console/Command/SetPasswordCommand.php
@@ -1,66 +0,0 @@
-<?php
-namespace PartKeepr\AuthBundle\Console\Command;
-
-use Doctrine\ORM\EntityManager;
-use PartKeepr\AuthBundle\Entity\User;
-use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
-use Symfony\Component\Console\Input\InputArgument;
-use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Output\OutputInterface;
-
-/**
- * Class SetPasswordCommand
- *
- * Implements the command to change the password of an user
- *
- * @package PartKeepr\AuthBundle\Console\Command
- */
-class SetPasswordCommand extends ContainerAwareCommand
-{
- /**
- * {@inheritdoc}
- */
- protected function configure()
- {
- $this
- ->setName('partkeepr:user:password')
- ->setDescription('Changes the password of an user')
- ->addArgument(
- 'username',
- InputArgument::REQUIRED,
- 'The username'
- )
- ->addArgument(
- 'password',
- InputArgument::REQUIRED,
- 'The password'
- );
- }
-
- /**
- * {@inheritdoc}
- */
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $username = $input->getArgument('username');
- $password = $input->getArgument('password');
-
- /**
- * @var $entityManager EntityManager
- */
- $entityManager = $this->getContainer()->get('doctrine')->getManager();
- $repository = $entityManager->getRepository(
- 'PartKeepr\AuthBundle\Entity\User\User'
- );
-
- /**
- * @var $user User
- */
- $user = $repository->findOneBy(array("username" => $username));
- $user->setPassword($password);
-
- $entityManager->flush();
-
- $output->writeln("Password changed");
- }
-}-
\ No newline at end of file
diff --git a/src/PartKeepr/AuthBundle/PartKeeprAuthBundle.php b/src/PartKeepr/AuthBundle/PartKeeprAuthBundle.php
@@ -1,20 +1,8 @@
<?php
-
namespace PartKeepr\AuthBundle;
-use PartKeepr\AuthBundle\Console\Command\CreateUserCommand;
-use PartKeepr\AuthBundle\Console\Command\SetPasswordCommand;
-use Symfony\Component\Console\Application;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class PartKeeprAuthBundle extends Bundle
{
- /**
- * {@inheritDoc}
- */
- public function registerCommands(Application $application)
- {
- $application->add(new CreateUserCommand());
- $application->add(new SetPasswordCommand());
- }
}