public function serialize(Entry $entry, array $options = [])
    {
        $user = $entry->getUser();

        $serialized = [
            'id' => $entry->getUuid(),
            'autoId' => $entry->getId(),
            'title' => $entry->getTitle(),
            'status' => $entry->getStatus(),
            'locked' => $entry->isLocked(),
            'creationDate' => $entry->getCreationDate() ? $entry->getCreationDate()->format('Y-m-d H:i:s') : null,
            'editionDate' => $entry->getEditionDate() ? $entry->getEditionDate()->format('Y-m-d H:i:s') : null,
            'publicationDate' => $entry->getPublicationDate() ? $entry->getPublicationDate()->format('Y-m-d H:i:s') : null,
            'user' => $user ? $this->userSerializer->serialize($user, [Options::SERIALIZE_MINIMAL]) : null,
            'clacoForm' => [
                'id' => $entry->getClacoForm()->getUuid(),
            ],
        ];
        $fieldValues = $entry->getFieldValues();

        if (count($fieldValues) > 0) {
            $serialized['values'] = $this->serializeValues($fieldValues);
        }
        if (!in_array(Options::SERIALIZE_MINIMAL, $options)) {
            $serialized = array_merge($serialized, [
                'categories' => $this->getCategories($entry),
                'keywords' => $this->getKeywords($entry),
                'comments' => $this->getComments($entry),
            ]);
        }

        return $serialized;
    }
public function serialize(Entry $entry, array $options = [])
    {
        $user = $entry->getUser();

        $serialized = [
            'id' => $entry->getUuid(),
            'autoId' => $entry->getId(),
            'title' => $entry->getTitle(),
            'status' => $entry->getStatus(),
            'locked' => $entry->isLocked(),
            'creationDate' => $entry->getCreationDate() ? $entry->getCreationDate()->format('Y-m-d H:i:s') : null,
            'editionDate' => $entry->getEditionDate() ? $entry->getEditionDate()->format('Y-m-d H:i:s') : null,
            'publicationDate' => $entry->getPublicationDate() ? $entry->getPublicationDate()->format('Y-m-d H:i:s') : null,
            'user' => $user ? $this->userSerializer->serialize($user, [Options::SERIALIZE_MINIMAL]) : null,
            'clacoForm' => [
                'id' => $entry->getClacoForm()->getUuid(),
            ],
        ];
        $fieldValues = $entry->getFieldValues();

        if (count($fieldValues) > 0) {
            $serialized['values'] = $this->serializeValues($fieldValues);
        }
        if (!in_array(Options::SERIALIZE_MINIMAL, $options)) {
            $serialized = array_merge($serialized, [
                'categories' => $this->getCategories($entry),
                'keywords' => $this->getKeywords($entry),
                'comments' => $this->getComments($entry),
            ]);
        }

        return $serialized;
    }
public function serialize ( Entry $ entry , array $ options = [ ] ) { $ user = $ entry -> getUser ( ) ; $ serialized = [ 'id' => $ entry -> getUuid ( ) , 'autoId' => $ entry -> getId ( ) , 'title' => $ entry -> getTitle ( ) , 'status' => $ entry -> getStatus ( ) , 'locked' => $ entry -> isLocked ( ) , 'creationDate' => $ entry -> getCreationDate ( ) ? $ entry -> getCreationDate ( ) -> format ( 'Y-m-d H:i:s' ) : null , 'editionDate' => $ entry -> getEditionDate ( ) ? $ entry -> getEditionDate ( ) -> format ( 'Y-m-d H:i:s' ) : null , 'publicationDate' => $ entry -> getPublicationDate ( ) ? $ entry -> getPublicationDate ( ) -> format ( 'Y-m-d H:i:s' ) : null , 'user' => $ user ? $ this -> userSerializer -> serialize ( $ user , [ Options :: SERIALIZE_MINIMAL ] ) : null , 'clacoForm' => [ 'id' => $ entry -> getClacoForm ( ) -> getUuid ( ) , ] , ] ; $ fieldValues = $ entry -> getFieldValues ( ) ; if ( count ( $ fieldValues ) > 0 ) { $ serialized [ 'values' ] = $ this -> serializeValues ( $ fieldValues ) ; } if ( ! in_array ( Options :: SERIALIZE_MINIMAL , $ options ) ) { $ serialized = array_merge ( $ serialized , [ 'categories' => $ this -> getCategories ( $ entry ) , 'keywords' => $ this -> getKeywords ( $ entry ) , 'comments' => $ this -> getComments ( $ entry ) , ] ) ; } return $ serialized ; }
Serializes an Entry entity for the JSON api.

@param Entry $entry   - the entry to serialize
@param array $options - a list of serialization options

@return array - the serialized representation of the entry
Serializes an Entry entity for the JSON api .