public function serialize(Chapter $chapter, array $options = [])
    {
        $previousChapter = $this->chapterRepository->getPreviousChapter($chapter);
        $nextChapter = $this->chapterRepository->getNextChapter($chapter);

        $serialized = [
            'id' => $chapter->getUuid(),
            'slug' => $chapter->getSlug(),
            'title' => $chapter->getTitle(),
            'text' => $chapter->getText(),
            'parentSlug' => $chapter->getParent() ? $chapter->getParent()->getSlug() : null,
            'previousSlug' => $previousChapter ? $previousChapter->getSlug() : null,
            'nextSlug' => $nextChapter ? $nextChapter->getSlug() : null,
        ];

        return $serialized;
    }
public function serialize(Chapter $chapter, array $options = [])
    {
        $previousChapter = $this->chapterRepository->getPreviousChapter($chapter);
        $nextChapter = $this->chapterRepository->getNextChapter($chapter);

        $serialized = [
            'id' => $chapter->getUuid(),
            'slug' => $chapter->getSlug(),
            'title' => $chapter->getTitle(),
            'text' => $chapter->getText(),
            'parentSlug' => $chapter->getParent() ? $chapter->getParent()->getSlug() : null,
            'previousSlug' => $previousChapter ? $previousChapter->getSlug() : null,
            'nextSlug' => $nextChapter ? $nextChapter->getSlug() : null,
        ];

        return $serialized;
    }
public function serialize ( Chapter $ chapter , array $ options = [ ] ) { $ previousChapter = $ this -> chapterRepository -> getPreviousChapter ( $ chapter ) ; $ nextChapter = $ this -> chapterRepository -> getNextChapter ( $ chapter ) ; $ serialized = [ 'id' => $ chapter -> getUuid ( ) , 'slug' => $ chapter -> getSlug ( ) , 'title' => $ chapter -> getTitle ( ) , 'text' => $ chapter -> getText ( ) , 'parentSlug' => $ chapter -> getParent ( ) ? $ chapter -> getParent ( ) -> getSlug ( ) : null , 'previousSlug' => $ previousChapter ? $ previousChapter -> getSlug ( ) : null , 'nextSlug' => $ nextChapter ? $ nextChapter -> getSlug ( ) : null , ] ; return $ serialized ; }
Serializes a Chapter entity for the JSON api.

@param Chapter $chapter - the Chapter resource to serialize
@param array   $options - a list of serialization options

@return array - the serialized representation of the Chapter resource
Serializes a Chapter entity for the JSON api .