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

        $chapter = $this->chapterRepository->getChapterBySlug($chapterSlug, $lesson->getId());

        if (is_null($chapter)) {
            throw new NotFoundHttpException();
        }

        return new JsonResponse($this->chapterSerializer->serialize($chapter));
    }
public function getAction(Request $request, Lesson $lesson, $chapterSlug)
    {
        $this->checkPermission('OPEN', $lesson->getResourceNode(), [], true);

        $chapter = $this->chapterRepository->getChapterBySlug($chapterSlug, $lesson->getId());

        if (is_null($chapter)) {
            throw new NotFoundHttpException();
        }

        return new JsonResponse($this->chapterSerializer->serialize($chapter));
    }
public function getAction ( Request $ request , Lesson $ lesson , $ chapterSlug ) { $ this -> checkPermission ( 'OPEN' , $ lesson -> getResourceNode ( ) , [ ] , true ) ; $ chapter = $ this -> chapterRepository -> getChapterBySlug ( $ chapterSlug , $ lesson -> getId ( ) ) ; if ( is_null ( $ chapter ) ) { throw new NotFoundHttpException ( ) ; } return new JsonResponse ( $ this -> chapterSerializer -> serialize ( $ chapter ) ) ; }
Get chapter by its slug.

@EXT\Route("/chapters/{chapterSlug}", name="apiv2_lesson_chapter_get")
@EXT\Method("GET")

@param Request $request
@param Lesson  $lesson
@param string  $chapterSlug

@return JsonResponse
Get chapter by its slug .