Bridge/Symfony/Serializer/Normalizer/TicketMessageNormalizer.php
public function normalize($message, $format = null, array $context = [])
    {
        if ($this->contextHasGroup(['Default', 'Ticket'], $context)) {
            $formatter = $this->getFormatter();

            $data = [
                'id'            => $message->getId(),
                'ticket'        => $message->getTicket()->getId(),
                'content'       => $message->getContent(),
                'author'        => $message->getAuthor(),
                'notified_at'   => ($date = $message->getNotifiedAt()) ? $date->format('Y-m-d H:i:s') : null,
                'f_notified_at' => ($date = $message->getNotifiedAt()) ? $formatter->dateTime($date) : null,
                'created_at'    => ($date = $message->getCreatedAt()) ? $date->format('Y-m-d H:i:s') : null,
                'f_created_at'  => ($date = $message->getCreatedAt()) ? $formatter->dateTime($date) : null,
                'updated_at'    => ($date = $message->getUpdatedAt()) ? $date->format('Y-m-d H:i:s') : null,
                'f_updated_at'  => ($date = $message->getUpdatedAt()) ? $formatter->dateTime($date) : null,
                'attachments'   => [],
            ];

            foreach ($this->filterAttachments($message) as $attachment) {
                $data['attachments'][] = $this->normalizeObject($attachment, $format, $context);
            }

            return $data;
        }

        return parent::normalize($message, $format, $context);
    }
public function normalize($message, $format = null, array $context = [])
    {
        if ($this->contextHasGroup(['Default', 'Ticket'], $context)) {
            $formatter = $this->getFormatter();

            $data = [
                'id'            => $message->getId(),
                'ticket'        => $message->getTicket()->getId(),
                'content'       => $message->getContent(),
                'author'        => $message->getAuthor(),
                'notified_at'   => ($date = $message->getNotifiedAt()) ? $date->format('Y-m-d H:i:s') : null,
                'f_notified_at' => ($date = $message->getNotifiedAt()) ? $formatter->dateTime($date) : null,
                'created_at'    => ($date = $message->getCreatedAt()) ? $date->format('Y-m-d H:i:s') : null,
                'f_created_at'  => ($date = $message->getCreatedAt()) ? $formatter->dateTime($date) : null,
                'updated_at'    => ($date = $message->getUpdatedAt()) ? $date->format('Y-m-d H:i:s') : null,
                'f_updated_at'  => ($date = $message->getUpdatedAt()) ? $formatter->dateTime($date) : null,
                'attachments'   => [],
            ];

            foreach ($this->filterAttachments($message) as $attachment) {
                $data['attachments'][] = $this->normalizeObject($attachment, $format, $context);
            }

            return $data;
        }

        return parent::normalize($message, $format, $context);
    }
public function normalize ( $ message , $ format = null , array $ context = [ ] ) { if ( $ this -> contextHasGroup ( [ 'Default' , 'Ticket' ] , $ context ) ) { $ formatter = $ this -> getFormatter ( ) ; $ data = [ 'id' => $ message -> getId ( ) , 'ticket' => $ message -> getTicket ( ) -> getId ( ) , 'content' => $ message -> getContent ( ) , 'author' => $ message -> getAuthor ( ) , 'notified_at' => ( $ date = $ message -> getNotifiedAt ( ) ) ? $ date -> format ( 'Y-m-d H:i:s' ) : null , 'f_notified_at' => ( $ date = $ message -> getNotifiedAt ( ) ) ? $ formatter -> dateTime ( $ date ) : null , 'created_at' => ( $ date = $ message -> getCreatedAt ( ) ) ? $ date -> format ( 'Y-m-d H:i:s' ) : null , 'f_created_at' => ( $ date = $ message -> getCreatedAt ( ) ) ? $ formatter -> dateTime ( $ date ) : null , 'updated_at' => ( $ date = $ message -> getUpdatedAt ( ) ) ? $ date -> format ( 'Y-m-d H:i:s' ) : null , 'f_updated_at' => ( $ date = $ message -> getUpdatedAt ( ) ) ? $ formatter -> dateTime ( $ date ) : null , 'attachments' => [ ] , ] ; foreach ( $ this -> filterAttachments ( $ message ) as $ attachment ) { $ data [ 'attachments' ] [ ] = $ this -> normalizeObject ( $ attachment , $ format , $ context ) ; } return $ data ; } return parent :: normalize ( $ message , $ format , $ context ) ; }
@inheritDoc

@param TicketMessageInterface $message
@inheritDoc