plugin/lesson/Controller/API/ChapterController.php
public function createAction(Request $request, Lesson $lesson, Chapter $parent)
    {
        $this->checkPermission('EDIT', $lesson->getResourceNode(), [], true);

        $newChapter = $this->chapterManager->createChapter($lesson, json_decode($request->getContent(), true), $parent);

        return new JsonResponse($this->chapterSerializer->serialize($newChapter));
    }
public function createAction(Request $request, Lesson $lesson, Chapter $parent)
    {
        $this->checkPermission('EDIT', $lesson->getResourceNode(), [], true);

        $newChapter = $this->chapterManager->createChapter($lesson, json_decode($request->getContent(), true), $parent);

        return new JsonResponse($this->chapterSerializer->serialize($newChapter));
    }
public function createAction ( Request $ request , Lesson $ lesson , Chapter $ parent ) { $ this -> checkPermission ( 'EDIT' , $ lesson -> getResourceNode ( ) , [ ] , true ) ; $ newChapter = $ this -> chapterManager -> createChapter ( $ lesson , json_decode ( $ request -> getContent ( ) , true ) , $ parent ) ; return new JsonResponse ( $ this -> chapterSerializer -> serialize ( $ newChapter ) ) ; }
Create new chapter.

@EXT\Route("/chapters/{slug}", name="apiv2_lesson_chapter_create")
@EXT\Method("POST")
@EXT\ParamConverter("parent", class="IcapLessonBundle:Chapter", options={"mapping": {"slug": "slug"}})

@param Request $request
@param Lesson  $lesson
@param Chapter $parent

@return JsonResponse
Create new chapter .