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 POST response * * @param \PSX\Record\RecordInterface $record * @return array|\PSX\Record\RecordInterface */ protected function doPost($record) { $data = $record->config; if ($data instanceof RecordInterface) { $config = $data->getProperties(); } else { $config = null; } $this->connectionService->create($record->name, $record->class, $config); return array('success' => true, 'message' => 'Connection successful created'); }
protected function newConnection(array $row) { $config = !empty($row['config']) ? ConnectionService::decryptConfig($row['config'], $this->secretKey) : []; $connection = new Connection(); $connection->setId($row['id']); $connection->setName($row['name']); $connection->setClass($row['class']); $connection->setConfig($config); return $connection; }
public function executeUpgrade(Connection $connection) { // encrypt connection config $result = $connection->fetchAll('SELECT id, config FROM fusio_connection ORDER BY id ASC'); $key = '42eec18ffdbffc9fda6110dcc705d6ce'; foreach ($result as $row) { $config = $row['config']; if (!empty($config)) { $config = ConnectionService::encryptConfig(unserialize($config), $key); $connection->update('fusio_connection', ['config' => $config], ['id' => $row['id']]); } } }
/** * Returns the DELETE response * * @param \PSX\Record\RecordInterface $record * @return array|\PSX\Record\RecordInterface */ protected function doDelete($record) { $this->connectionService->delete((int) $this->getUriFragment('connection_id')); return array('success' => true, 'message' => 'Connection successful deleted'); }