original_string: public function createAction(Request $request, $type = 0)
      {
          /** @var ContentManager $manager */
          $manager = $this->get('opifer.content.content_manager');
  
          if ($type) {
              $contentType = $this->get('opifer.content.content_type_manager')->getRepository()->find($type);
              $content = $this->get('opifer.eav.eav_manager')->initializeEntity($contentType->getSchema());
              $content->setContentType($contentType);
          } else {
              $content = $manager->initialize();
          }
  
          $form = $this->createForm(ContentType::class, $content);
          $form->handleRequest($request);
  
          if ($form->isValid()) {
              // Create a new document
              $blockManager = $this->get('opifer.content.block_manager');
              $document = new DocumentBlock();
              $document->setPublish(true);
              $blockManager->save($document);
  
              $content->setBlock($document);
              $manager->save($content);
  
              return $this->redirectToRoute('opifer_content_contenteditor_design', [
                  'type'    => 'content',
                  'id'      => $content->getId(),
                  'rootVersion' => 0,
              ]);
          }
  
          return $this->render($this->getParameter('opifer_content.content_new_view'), [
              'form' => $form->createView(),
          ]);
      }
code: public function createAction(Request $request, $type = 0)
      {
          /** @var ContentManager $manager */
          $manager = $this->get('opifer.content.content_manager');
  
          if ($type) {
              $contentType = $this->get('opifer.content.content_type_manager')->getRepository()->find($type);
              $content = $this->get('opifer.eav.eav_manager')->initializeEntity($contentType->getSchema());
              $content->setContentType($contentType);
          } else {
              $content = $manager->initialize();
          }
  
          $form = $this->createForm(ContentType::class, $content);
          $form->handleRequest($request);
  
          if ($form->isValid()) {
              // Create a new document
              $blockManager = $this->get('opifer.content.block_manager');
              $document = new DocumentBlock();
              $document->setPublish(true);
              $blockManager->save($document);
  
              $content->setBlock($document);
              $manager->save($content);
  
              return $this->redirectToRoute('opifer_content_contenteditor_design', [
                  'type'    => 'content',
                  'id'      => $content->getId(),
                  'rootVersion' => 0,
              ]);
          }
  
          return $this->render($this->getParameter('opifer_content.content_new_view'), [
              'form' => $form->createView(),
          ]);
      }
code_tokens: public function createAction ( Request $ request , $ type = 0 ) { /** @var ContentManager $manager */ $ manager = $ this -> get ( 'opifer.content.content_manager' ) ; if ( $ type ) { $ contentType = $ this -> get ( 'opifer.content.content_type_manager' ) -> getRepository ( ) -> find ( $ type ) ; $ content = $ this -> get ( 'opifer.eav.eav_manager' ) -> initializeEntity ( $ contentType -> getSchema ( ) ) ; $ content -> setContentType ( $ contentType ) ; } else { $ content = $ manager -> initialize ( ) ; } $ form = $ this -> createForm ( ContentType :: class , $ content ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { // Create a new document $ blockManager = $ this -> get ( 'opifer.content.block_manager' ) ; $ document = new DocumentBlock ( ) ; $ document -> setPublish ( true ) ; $ blockManager -> save ( $ document ) ; $ content -> setBlock ( $ document ) ; $ manager -> save ( $ content ) ; return $ this -> redirectToRoute ( 'opifer_content_contenteditor_design' , [ 'type' => 'content' , 'id' => $ content -> getId ( ) , 'rootVersion' => 0 , ] ) ; } return $ this -> render ( $ this -> getParameter ( 'opifer_content.content_new_view' ) , [ 'form' => $ form -> createView ( ) , ] ) ; }
docstring: Select the type of content, the site and the language before actually
  creating a new content item.
  
  @param Request $request
  @param integer $type
  
  @return Response
docstring_tokens: Select the type of content the site and the language before actually creating a new content item .