mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Fix DumpCommand to generate html with/out sandbox
api:doc:dump --format=html always disables the Sandbox since the check in DumpCommand seems to be wrong. Fixed that as well as introduce a dummy Request Object as the layout.html.twig expects an app.request object.
This commit is contained in:
parent
2ceea4871a
commit
9eee2e263f
@ -15,6 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class DumpCommand extends ContainerAwareCommand
|
||||
{
|
||||
@ -52,10 +53,15 @@ class DumpCommand extends ContainerAwareCommand
|
||||
$formatter = $this->getContainer()->get(sprintf('nelmio_api_doc.formatter.%s_formatter', $format));
|
||||
}
|
||||
|
||||
if ($input->hasOption('no-sandbox') && 'html' === $format) {
|
||||
if ($input->getOption('no-sandbox') && 'html' === $format) {
|
||||
$formatter->setEnableSandbox(false);
|
||||
}
|
||||
|
||||
if ('html' === $format) {
|
||||
$this->getContainer()->enterScope('request');
|
||||
$this->getContainer()->set('request', new Request(), 'request');
|
||||
}
|
||||
|
||||
$extractedDoc = $this->getContainer()->get('nelmio_api_doc.extractor.api_doc_extractor')->all();
|
||||
$formattedDoc = $formatter->format($extractedDoc);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user