<commit_before><?php

namespace Galvesband\TraUserBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use \Galvesband\TraUserBundle\Entity\User;

/**
 * Class AddCommand
 *
 * Adds a new user to the system.
 *
 * @package Galvesband\TraUserBundle\Command
 */
class AddUserCommand extends ContainerAwareCommand
{
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this
            ->setName('galvesband_tra_user:add_command')
            ->setDescription('Adds a new user.')
            ->setHelp("This command allows you to create users.")

            ->addArgument('username', InputArgument::REQUIRED, "The name of the new user.")
            ->addArgument('email', InputArgument::REQUIRED, "The email of the user")
            ->addArgument('password', InputArgument::REQUIRED, "The password of the new <PASSWORD>")
            ->addOption("inactive", "i", InputOption::VALUE_OPTIONAL, "Sets the new user as inactive.", false);
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $user = new User();
        $user->setName($input->getArgument('username'));
        $user->setEmail($input->getArgument('email'));
        $user->setPlainPassword($input->getArgument('password'));
        $user->setIsActive(!$input->getOption('inactive'));

        // TODO Validation of User class

        $em = $this->getContainer()->get('doctrine')->getManager();
        $em->persist($user);
        $em->flush();

        $output->writeln('User created: ' . $user->getName());
    }
}<commit_msg>FIX Comando user. Aún no usa nada de validación.<commit_after><?php

namespace Galvesband\TraUserBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use \Galvesband\TraUserBundle\Entity\User;

/**
 * Class AddCommand
 *
 * Adds a new user to the system.
 *
 * @package Galvesband\TraUserBundle\Command
 */
class AddUserCommand extends ContainerAwareCommand
{
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this
            ->setName('galvesband_tra_user:add_command')
            ->setDescription('Adds a new user.')
            ->setHelp("This command allows you to create users.")

            ->addArgument('username', InputArgument::REQUIRED, "The name of the new user.")
            ->addArgument('email', InputArgument::REQUIRED, "The email of the user")
            ->addArgument('password', InputArgument::REQUIRED, "The password of <PASSWORD>")
            ->addOption("inactive", "i", InputOption::VALUE_NONE, "Sets the new user as inactive.")
            ->addOption("super", "s", InputOption::VALUE_NONE, "Sets the new user as super-administrator.");
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $user = new User();
        $user->setName($input->getArgument('username'));
        $user->setEmail($input->getArgument('email'));
        $user->setPlainPassword($input->getArgument('password'));
        $user->setIsActive(!$input->getOption('inactive'));
        $user->setIsSuperAdmin($input->getOption('super'));

        // TODO Validation of User class

        $em = $this->getContainer()->get('doctrine')->getManager();
        $em->persist($user);
        $em->flush();

        $output->writeln('User created: ' . $user->getName());
    }
}
{'fraction_non_alphanumeric': 0.14643595041322313, 'fraction_numerical': 0.0, 'mean_word_length': 3.2795580110497236, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 52, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3069992', 'n_tokens_mistral': 1080, 'n_tokens_neox': 1072, 'n_words': 227}