/** * Execute command * * @param InputInterface $input * @param OutputInterface $output * * @return null|int */ protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); /* @var $ws WebService */ $ws = $this->getHelper('psws')->getWebService(); $resource = $input->getOption('resource'); $id = $input->getOption('id'); $ws->delete($resource, $id); $this->printSuccess($output); }
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); /* @var $ws WebService */ $ws = $this->getHelper('psws')->getWebService(); $resource = $input->getOption('resource'); $file = $input->getOption('input'); if (is_file($file)) { $data = pathinfo($file, PATHINFO_EXTENSION) === 'xml' ? simplexml_load_file($file) : array('image' => '@' . $file); } else { $data = simplexml_load_string($file); } $ws->create($resource, $data); $this->printSuccess($output); }
/** * Execute command * * @param InputInterface $input * @param OutputInterface $output * * @return null|int */ protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); /* @var $ws WebService */ $ws = $this->getHelper('psws')->getWebService(); $resource = $input->getOption('resource'); $type = $input->getOption('type'); $toFile = $input->getOption('output'); $response = $ws->schema($resource, $type); $content = $response->getContentRaw(); if (!$toFile) { $output->writeln($content); } else { file_put_contents($toFile, $content); $this->printSuccess($output); } }
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); /* @var $ws WebService */ $ws = $this->getHelper('psws')->getWebService(); $resource = $input->getOption('resource'); $id = $input->getOption('id'); $paramsIN = $input->getOption('params'); $toFile = $input->getOption('output'); $params = array(); if ($paramsIN) { parse_str((string) $paramsIN, $params); } $response = $ws->get($resource, $id, $params); $content = $response->getContentRaw(); if (!$toFile) { $output->writeln($content); } else { file_put_contents($toFile, $content); $this->printSuccess($output); } }