public function onLoad(LoadResourceEvent $event)
    {
        /** @var Lesson $lesson */
        $lesson = $event->getResource();
        $firstChapter = $this->chapterRepository->getFirstChapter($lesson);
        $root = $this->chapterRepository->findOneBy(['lesson' => $lesson, 'level' => 0, 'parent' => null]);

        $event->setData([
            'exportPdfEnabled' => $this->config->getParameter('is_pdf_export_active'),
            'lesson' => $this->serializer->serialize($lesson),
            'tree' => $this->chapterManager->serializeChapterTree($lesson),
            'chapter' => $firstChapter ? $this->serializer->serialize($firstChapter) : null,
            'root' => $root ? $this->serializer->serialize($root) : null,
        ]);

        $event->stopPropagation();
    }
public function onLoad(LoadResourceEvent $event)
    {
        /** @var Lesson $lesson */
        $lesson = $event->getResource();
        $firstChapter = $this->chapterRepository->getFirstChapter($lesson);
        $root = $this->chapterRepository->findOneBy(['lesson' => $lesson, 'level' => 0, 'parent' => null]);

        $event->setData([
            'exportPdfEnabled' => $this->config->getParameter('is_pdf_export_active'),
            'lesson' => $this->serializer->serialize($lesson),
            'tree' => $this->chapterManager->serializeChapterTree($lesson),
            'chapter' => $firstChapter ? $this->serializer->serialize($firstChapter) : null,
            'root' => $root ? $this->serializer->serialize($root) : null,
        ]);

        $event->stopPropagation();
    }
public function onLoad ( LoadResourceEvent $ event ) { /** @var Lesson $lesson */ $ lesson = $ event -> getResource ( ) ; $ firstChapter = $ this -> chapterRepository -> getFirstChapter ( $ lesson ) ; $ root = $ this -> chapterRepository -> findOneBy ( [ 'lesson' => $ lesson , 'level' => 0 , 'parent' => null ] ) ; $ event -> setData ( [ 'exportPdfEnabled' => $ this -> config -> getParameter ( 'is_pdf_export_active' ) , 'lesson' => $ this -> serializer -> serialize ( $ lesson ) , 'tree' => $ this -> chapterManager -> serializeChapterTree ( $ lesson ) , 'chapter' => $ firstChapter ? $ this -> serializer -> serialize ( $ firstChapter ) : null , 'root' => $ root ? $ this -> serializer -> serialize ( $ root ) : null , ] ) ; $ event -> stopPropagation ( ) ; }
Loads a lesson.

@DI\Observe("resource.icap_lesson.load")

@param LoadResourceEvent $event
Loads a lesson .