protected function execute(InputInterface $input, OutputInterface $output) { $result = $this->userService->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() { $startIndex = $this->getParameter('startIndex', Validate::TYPE_INTEGER) ?: 0; $search = $this->getParameter('search', Validate::TYPE_STRING) ?: null; return $this->userService->getAll($startIndex, $search); }