protected function execute(InputInterface $input, OutputInterface $output) { $result = $this->schemaService->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 DELETE response * * @param \PSX\Record\RecordInterface $record * @return array|\PSX\Record\RecordInterface */ protected function doDelete($record) { $this->schemaService->delete((int) $this->getUriFragment('schema_id')); return array('success' => true, 'message' => 'Schema successful deleted'); }
/** * Returns the POST response * * @param \PSX\Record\RecordInterface $record * @return array|\PSX\Record\RecordInterface */ protected function doPost($record) { $this->schemaService->create($record->name, $record->source); return array('success' => true, 'message' => 'Schema successful created'); }
/** * Returns the POST response * * @param \PSX\Record\RecordInterface $record * @return array|\PSX\Record\RecordInterface */ protected function doPost($record) { $body = $this->schemaService->getHtmlPreview((int) $this->getUriFragment('schema_id')); $this->setBody(['preview' => $body]); }