Command/CronCreateCommand.php
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $job = new CronJob();

        $output->writeln('');
        $output->writeln('<info>The unique name how the job will be referenced.</info>');

        $question = new Question('<question>Name:</question> ', false);

        $name = $this->getQuestionHelper()->ask($input, $output, $question);
        $this->validateJobName($name);
        $job->setName($name);

        $output->writeln('');
        $output->writeln('<info>The command to execute. You may add extra arguments.</info>');

        $question = new Question('<question>Command:</question> ', false);

        $command = $this->getQuestionHelper()->ask($input, $output, $question);
        $this->validateCommand($command);
        $job->setCommand($command);

        $output->writeln('');
        $output->writeln('<info>The schedule in the crontab syntax.</info>');

        $question = new Question('<question>Schedule:</question> ', false);

        $schedule = $this->getQuestionHelper()->ask($input, $output, $question);
        $this->validateSchedule($schedule);
        $job->setSchedule($schedule);

        $output->writeln('');
        $output->writeln('<info>Some more information about the job.</info>');

        $question = new Question('<question>Description:</question> ', false);

        $description = $this->getQuestionHelper()->ask($input, $output, $question);
        $job->setDescription($description);

        $output->writeln('');
        $output->writeln('<info>Should the cron be enabled.</info>');

        $question = new ConfirmationQuestion('<question>Enable?</question> [y/n]: ', false, '/^(y)/i');

        $enabled = $this->getQuestionHelper()->ask($input, $output, $question);
        $job->setEnabled($enabled);

        $this->getContainer()->get('cron.manager')
            ->saveJob($job);

        $output->writeln('');
        $output->writeln(sprintf('<info>Cron "%s" was created..</info>', $job->getName()));
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $job = new CronJob();

        $output->writeln('');
        $output->writeln('<info>The unique name how the job will be referenced.</info>');

        $question = new Question('<question>Name:</question> ', false);

        $name = $this->getQuestionHelper()->ask($input, $output, $question);
        $this->validateJobName($name);
        $job->setName($name);

        $output->writeln('');
        $output->writeln('<info>The command to execute. You may add extra arguments.</info>');

        $question = new Question('<question>Command:</question> ', false);

        $command = $this->getQuestionHelper()->ask($input, $output, $question);
        $this->validateCommand($command);
        $job->setCommand($command);

        $output->writeln('');
        $output->writeln('<info>The schedule in the crontab syntax.</info>');

        $question = new Question('<question>Schedule:</question> ', false);

        $schedule = $this->getQuestionHelper()->ask($input, $output, $question);
        $this->validateSchedule($schedule);
        $job->setSchedule($schedule);

        $output->writeln('');
        $output->writeln('<info>Some more information about the job.</info>');

        $question = new Question('<question>Description:</question> ', false);

        $description = $this->getQuestionHelper()->ask($input, $output, $question);
        $job->setDescription($description);

        $output->writeln('');
        $output->writeln('<info>Should the cron be enabled.</info>');

        $question = new ConfirmationQuestion('<question>Enable?</question> [y/n]: ', false, '/^(y)/i');

        $enabled = $this->getQuestionHelper()->ask($input, $output, $question);
        $job->setEnabled($enabled);

        $this->getContainer()->get('cron.manager')
            ->saveJob($job);

        $output->writeln('');
        $output->writeln(sprintf('<info>Cron "%s" was created..</info>', $job->getName()));
    }
{@inheritdoc}