em = $em; } protected function configure() { $this ->setDescription('Create a new mailing') ->addArgument('label', InputArgument::REQUIRED, 'Label of the mailing') ->addOption('public', 'p', InputOption::VALUE_NONE, 'Make the mailing public') ; } protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $label = $input->getArgument('label'); $entity = new Mailing(); $entity ->setLabel($label) ->setIsPublic($input->getOption('public')); $this->em->persist($entity); $this->em->flush(); $io->success(sprintf('"%s" was created with id "%s"', $label, $entity->getId())); return Command::SUCCESS; } }