plugin/forum/Serializer/SubjectSerializer.php
public function serialize(Subject $subject, array $options = [])
    {
        $first = $this->messageRepo->findOneBy([
          'subject' => $subject,
          'first' => true,
        ]);

        return [
          'id' => $subject->getUuid(),
          'forum' => [
            'id' => $subject->getForum()->getUuid(),
          ],
          'tags' => $this->serializeTags($subject),
          'content' => $first ? $first->getContent() : null,
          'title' => $subject->getTitle(),
          'meta' => $this->serializeMeta($subject, $options),
          'restrictions' => $this->serializeRestrictions($subject, $options),
          'poster' => $subject->getPoster() ? $this->fileSerializer->serialize($subject->getPoster()) : null,
        ];
    }
public function serialize(Subject $subject, array $options = [])
    {
        $first = $this->messageRepo->findOneBy([
          'subject' => $subject,
          'first' => true,
        ]);

        return [
          'id' => $subject->getUuid(),
          'forum' => [
            'id' => $subject->getForum()->getUuid(),
          ],
          'tags' => $this->serializeTags($subject),
          'content' => $first ? $first->getContent() : null,
          'title' => $subject->getTitle(),
          'meta' => $this->serializeMeta($subject, $options),
          'restrictions' => $this->serializeRestrictions($subject, $options),
          'poster' => $subject->getPoster() ? $this->fileSerializer->serialize($subject->getPoster()) : null,
        ];
    }
public function serialize ( Subject $ subject , array $ options = [ ] ) { $ first = $ this -> messageRepo -> findOneBy ( [ 'subject' => $ subject , 'first' => true , ] ) ; return [ 'id' => $ subject -> getUuid ( ) , 'forum' => [ 'id' => $ subject -> getForum ( ) -> getUuid ( ) , ] , 'tags' => $ this -> serializeTags ( $ subject ) , 'content' => $ first ? $ first -> getContent ( ) : null , 'title' => $ subject -> getTitle ( ) , 'meta' => $ this -> serializeMeta ( $ subject , $ options ) , 'restrictions' => $ this -> serializeRestrictions ( $ subject , $ options ) , 'poster' => $ subject -> getPoster ( ) ? $ this -> fileSerializer -> serialize ( $ subject -> getPoster ( ) ) : null , ] ; }
Serializes a Subject entity.

@param Subject $subject
@param array   $options

@return array
Serializes a Subject entity .