kernel = $kernel; $this->doctrine = $doctrine; parent::__construct(); } protected function configure() { $this ->addOption('jobid', 'j', InputOption::VALUE_IS_ARRAY + InputOption::VALUE_REQUIRED, 'The ids of the jobs to clean') ->addOption('maxage', 'm', InputOption::VALUE_REQUIRED, 'The maximum age of the oldest runs'); } protected function execute(InputInterface $input, OutputInterface $output) : int { $maxage = $input->getOption('maxage'); $jobs = $input->getOption('jobid'); $runRepo = $this->doctrine->getRepository(Run::class); $deleted = $runRepo->cleanupRuns($jobs, $maxage); $output->writeln('Deleted ' . $deleted . ' runs'); return Command::SUCCESS; } }