Command/DeleteCommand.php
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $service_name = $input->getArgument('service');
        if (!$this->getContainer()->has($service_name)) {
            $output->writeln(sprintf('<error>The service "%s" does not exist.</error>', $service_name));

            return 1;
        }
        $service = $this->getContainer()->get($service_name);
        if (!$service instanceof StorableInterface) {
            $output->writeln(sprintf('<error>The service "%s" is not a storable object.</error>', $service_name));

            return 2;
        }

        $service->delete();
        $output->writeln('Done.');
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $service_name = $input->getArgument('service');
        if (!$this->getContainer()->has($service_name)) {
            $output->writeln(sprintf('<error>The service "%s" does not exist.</error>', $service_name));

            return 1;
        }
        $service = $this->getContainer()->get($service_name);
        if (!$service instanceof StorableInterface) {
            $output->writeln(sprintf('<error>The service "%s" is not a storable object.</error>', $service_name));

            return 2;
        }

        $service->delete();
        $output->writeln('Done.');
    }
{@inheritdoc}