main/core/API/Serializer/Resource/Types/FileSerializer.php
public function serialize(File $file)
    {
        $options = [
            'id' => $file->getId(),
            'size' => $file->getSize(),
            'autoDownload' => $file->getAutoDownload(),
            'commentsActivated' => $file->getResourceNode()->isCommentsActivated(),
            'hashName' => $file->getHashName(),

            // We generate URL here because the stream API endpoint uses ResourceNode ID,
            // but the new api only contains the ResourceNode UUID.

            // NB : This will no longer be required when the stream API will use UUIDs
            'url' => $this->router->generate('claro_file_get_media', [
                'node' => $file->getResourceNode()->getId(),
            ]),
        ];

        return $options;
    }
public function serialize(File $file)
    {
        $options = [
            'id' => $file->getId(),
            'size' => $file->getSize(),
            'autoDownload' => $file->getAutoDownload(),
            'commentsActivated' => $file->getResourceNode()->isCommentsActivated(),
            'hashName' => $file->getHashName(),

            // We generate URL here because the stream API endpoint uses ResourceNode ID,
            // but the new api only contains the ResourceNode UUID.

            // NB : This will no longer be required when the stream API will use UUIDs
            'url' => $this->router->generate('claro_file_get_media', [
                'node' => $file->getResourceNode()->getId(),
            ]),
        ];

        return $options;
    }
public function serialize ( File $ file ) { $ options = [ 'id' => $ file -> getId ( ) , 'size' => $ file -> getSize ( ) , 'autoDownload' => $ file -> getAutoDownload ( ) , 'commentsActivated' => $ file -> getResourceNode ( ) -> isCommentsActivated ( ) , 'hashName' => $ file -> getHashName ( ) , // We generate URL here because the stream API endpoint uses ResourceNode ID, // but the new api only contains the ResourceNode UUID. // NB : This will no longer be required when the stream API will use UUIDs 'url' => $ this -> router -> generate ( 'claro_file_get_media' , [ 'node' => $ file -> getResourceNode ( ) -> getId ( ) , ] ) , ] ; return $ options ; }
Serializes a File resource entity for the JSON api.

@param File $file - the file to serialize

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