protected function execute(InputInterface $input, OutputInterface $output) { $result = $this->connectionService->getAll($input->getOption('startIndex'), $input->getArgument('search')); $rows = []; foreach ($result->entry as $row) { $rows[] = [$row->id, $row->name]; } $table = new Table($output); $table->setHeaders(['ID', 'Name'])->setRows($rows); $table->render($output); }
/** * Returns the GET response * * @return array|\PSX\Record\RecordInterface */ protected function doGet() { return $this->connectionService->getAll($this->getParameter('startIndex', Validate::TYPE_INTEGER) ?: 0, $this->getParameter('search', Validate::TYPE_STRING) ?: null); }