From 360998a727c9c94d6f86ca4dee4974e0a5defaa0 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 17 Feb 2015 01:56:22 +0100 Subject: [PATCH] Zone list command --- .../PowerDNS/Command/ZoneListCommand.php | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/Deblan/PowerDNS/Command/ZoneListCommand.php diff --git a/src/Deblan/PowerDNS/Command/ZoneListCommand.php b/src/Deblan/PowerDNS/Command/ZoneListCommand.php new file mode 100644 index 0000000..7e9c34c --- /dev/null +++ b/src/Deblan/PowerDNS/Command/ZoneListCommand.php @@ -0,0 +1,50 @@ +setName('zone:list') + ->setDescription('List DNS zones') + // ->addArgument('foo', InputArgument::OPTIONAL, '') + // ->addOption('bar', null, InputOption::VALUE_NONE, '') + ->setHelp("The %command.name% "); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + // $this->getContainer()->get('foo.bar'); + // $output->writeln(sprintf('%s bar.', $example)); + // $input->getArgument('foo'); + // $input->getOption('bar'); + + $zones = ZoneQuery::create()->orderByName()->find(); + + foreach ($zones as $zone) { + $output->writeln(sprintf('%s.', $zone->getName())); + + if ($zone->getDescription()) { + $output->writeln($zone->getDescription()); + $output->writeln(''); + } + + foreach ($zones->getZoneVersions() as $zoneVersion) { + $output->writeln(sprintf('Version %d', $zoneVersion->getVersion())); + + if ($zoneVersion->getIsActive()) { + $output->writeln('Activeted'); + } + } + } + } +}