/**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Set filters & get data
     $type = $input->getArgument(self::TYPE_ARGUMENT);
     if ($type) {
         $this->productlist->setType($type);
     }
     $active = $input->getOption(self::ACTIVE_OPTION);
     if ($active) {
         $this->productlist->setStatus(1);
     }
     $products = $this->productlist->getProducts();
     // If only count, return it
     if ($input->getOption(self::COUNT_OPTION)) {
         return $output->writeln(sprintf('Count: %d', $products->getTotalCount()));
     }
     // Else prepare data for showing
     $types = $this->productlist->getProductTypesAssoc();
     $rows = new \ArrayObject();
     foreach ($products->getItems() as $id => $product) {
         $rows->append([$product->getId(), $product->getSku(), $product->getName(), $types[$product->getTypeId()]]);
     }
     // Output table layout
     $table = new Table($output);
     $table->setHeaders(['ID', 'SKU', 'Name', 'Type']);
     $table->setRows($rows->getArrayCopy());
     $table->render();
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // Get data
     $rows = new \ArrayObject();
     foreach ($this->productlist->getProductTypes() as $id => $type) {
         $rows->append([$type->getName(), $type->getLabel()]);
     }
     // Output table layout
     $table = new Table($output);
     $table->setHeaders(['Name', 'Label']);
     $table->setRows($rows->getArrayCopy());
     $table->render();
 }