Пример #1
0
 /**
  * @ApiDoc(
  *  section="Administration",
  *  description="REST API documentation"
  * )
  *
  * @Rest\Get("/api", name="jarves_api_doc_index")
  *
  * @return Response
  */
 public function indexAction()
 {
     $commentExtractor = new \Nelmio\ApiDocBundle\Util\DocCommentExtractor();
     $controllerNameParser = new ControllerNameParser($this->get('kernel'));
     $handlers = [new \Nelmio\ApiDocBundle\Extractor\Handler\FosRestHandler(), new \Nelmio\ApiDocBundle\Extractor\Handler\JmsSecurityExtraHandler(), new \Nelmio\ApiDocBundle\Extractor\Handler\SensioFrameworkExtraHandler(), new \Jarves\Extractor\Handler\ObjectCrudHandler($this->get('jarves'), $this->get('jarves.objects'))];
     $extractor = new \Nelmio\ApiDocBundle\Extractor\ApiDocExtractor($this->container, $this->container->get('router'), $this->container->get('annotation_reader'), $commentExtractor, $controllerNameParser, $handlers, []);
     $extractedDoc = $extractor->all();
     $formatter = new ApiDocFormatter();
     $formatter->setTemplatingEngine($this->get('templating'));
     $htmlContent = $formatter->format($extractedDoc);
     return new Response($htmlContent, 200, array('Content-Type' => 'text/html'));
 }
 protected function getNelmioApiDoc_Extractor_ApiDocExtractorService()
 {
     $a = $this->get('nelmio_api_doc.doc_comment_extractor');
     $this->services['nelmio_api_doc.extractor.api_doc_extractor'] = $instance = new \Nelmio\ApiDocBundle\Extractor\ApiDocExtractor($this, $this->get('router'), $this->get('annotation_reader'), $a, array(0 => new \Nelmio\ApiDocBundle\Extractor\Handler\FosRestHandler(), 1 => new \Nelmio\ApiDocBundle\Extractor\Handler\JmsSecurityExtraHandler(), 2 => new \Nelmio\ApiDocBundle\Extractor\Handler\SensioFrameworkExtraHandler(), 3 => new \Nelmio\ApiDocBundle\Extractor\Handler\PhpDocHandler($a)));
     $instance->addParser($this->get('nelmio_api_doc.parser.form_type_parser'));
     $instance->addParser($this->get('nelmio_api_doc.parser.validation_parser'));
     $instance->addParser($this->get('nelmio_api_doc.parser.jms_metadata_parser'));
     return $instance;
 }
 /**
  * Gets the 'nelmio_api_doc.extractor.api_doc_extractor' service.
  *
  * This service is shared.
  * This method always returns the same instance of the service.
  *
  * @return \Nelmio\ApiDocBundle\Extractor\ApiDocExtractor A Nelmio\ApiDocBundle\Extractor\ApiDocExtractor instance
  */
 protected function getNelmioApiDoc_Extractor_ApiDocExtractorService()
 {
     $a = $this->get('nelmio_api_doc.doc_comment_extractor');
     $b = $this->get('nelmio_api_doc.parser.form_type_parser');
     $c = $this->get('nelmio_api_doc.parser.validation_parser');
     $this->services['nelmio_api_doc.extractor.api_doc_extractor'] = $instance = new \Nelmio\ApiDocBundle\Extractor\ApiDocExtractor($this, $this->get('router'), $this->get('annotation_reader'), $a, new \Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser($this->get('kernel')), array(0 => new \Nelmio\ApiDocBundle\Extractor\Handler\FosRestHandler(), 1 => new \Nelmio\ApiDocBundle\Extractor\Handler\JmsSecurityExtraHandler(), 2 => new \Nelmio\ApiDocBundle\Extractor\Handler\SensioFrameworkExtraHandler(), 3 => new \Nelmio\ApiDocBundle\Extractor\Handler\PhpDocHandler($a)), array());
     $instance->addParser(new \CoreBundle\Parser\Parser($b, $c, $this->get('form.factory'), $a));
     $instance->addParser($this->get('nelmio_api_doc.parser.json_serializable_parser'));
     $instance->addParser($this->get('nelmio_api_doc.parser.collection_parser'));
     $instance->addParser($this->get('nelmio_api_doc.parser.form_errors_parser'));
     $instance->addParser($b);
     $instance->addParser($c);
     $instance->addParser($this->get('nelmio_api_doc.parser.jms_metadata_parser'));
     return $instance;
 }