src/POData/Writers/Json/JsonODataV1Writer.php
/**
     * Write metadata information for the entry.
     *
     * @param ODataEntry $entry Entry to write metadata for.
     *
     * @return JsonODataV1Writer
     */
Write metadata information for the entry.
@param ODataEntry $entry Entry to write metadata for.


Write metadata information for the entry . @param ODataEntry $entry Entry to write metadata for .
protected function writeEntryMetadata(ODataEntry $entry)
    {
        if ($entry->id != null || $entry->type != null || $entry->eTag != null) {
            $this->_writer
	            ->writeName(ODataConstants::JSON_METADATA_STRING)
                ->startObjectScope();
            if ($entry->id != null) {
                $this->_writer
	                ->writeName($this->urlKey)
                    ->writeValue($entry->id);
            }
            if ($entry->eTag != null) {
                $this->_writer
	                ->writeName(ODataConstants::JSON_ETAG_STRING)
                    ->writeValue($entry->eTag);
            }
            if ($entry->type != null) {
                $this->_writer
	                ->writeName(ODataConstants::JSON_TYPE_STRING)
	                ->writeValue($entry->type);
            }
        }
        if ($entry->isMediaLinkEntry) {
            if ($entry->mediaLink != null) {
                $this->_writer
	                ->writeName(ODataConstants::JSON_EDITMEDIA_STRING)
	                ->writeValue($entry->mediaLink->editLink)
	                ->writeName(ODataConstants::JSON_MEDIASRC_STRING)
	                ->writeValue($entry->mediaLink->srcLink)
	                ->writeName(ODataConstants::JSON_CONTENTTYPE_STRING)
	                ->writeValue($entry->mediaLink->contentType);
                if ($entry->mediaLink->eTag != null) {
                    $this->_writer
	                    ->writeName(ODataConstants::JSON_MEDIAETAG_STRING)
	                    ->writeValue($entry->mediaLink->eTag);
                }
                $this->_writer->endScope();
            }
            foreach ($entry->mediaLinks as $mediaLink) {
                $this->_writer
	                ->writeName($mediaLink->name)
	                ->startObjectScope()
	                ->writeName(ODataConstants::JSON_MEDIASRC_STRING)
	                ->writeValue($mediaLink->srcLink)
	                ->writeName(ODataConstants::JSON_CONTENTTYPE_STRING)
	                ->writeValue($mediaLink->contentType);
                if ($mediaLink->eTag != null) {
                    $this->_writer
	                    ->writeName(ODataConstants::JSON_MEDIAETAG_STRING)
	                    ->writeValue($mediaLink->eTag);
                }
                $this->_writer->endScope();
            }
        } else {
            $this->_writer->endScope();
        }
	    return $this;
    }
protected function writeEntryMetadata ( ODataEntry $ entry ) { if ( $ entry -> id != null || $ entry -> type != null || $ entry -> eTag != null ) { $ this -> _writer -> writeName ( ODataConstants :: JSON_METADATA_STRING ) -> startObjectScope ( ) ; if ( $ entry -> id != null ) { $ this -> _writer -> writeName ( $ this -> urlKey ) -> writeValue ( $ entry -> id ) ; } if ( $ entry -> eTag != null ) { $ this -> _writer -> writeName ( ODataConstants :: JSON_ETAG_STRING ) -> writeValue ( $ entry -> eTag ) ; } if ( $ entry -> type != null ) { $ this -> _writer -> writeName ( ODataConstants :: JSON_TYPE_STRING ) -> writeValue ( $ entry -> type ) ; } } if ( $ entry -> isMediaLinkEntry ) { if ( $ entry -> mediaLink != null ) { $ this -> _writer -> writeName ( ODataConstants :: JSON_EDITMEDIA_STRING ) -> writeValue ( $ entry -> mediaLink -> editLink ) -> writeName ( ODataConstants :: JSON_MEDIASRC_STRING ) -> writeValue ( $ entry -> mediaLink -> srcLink ) -> writeName ( ODataConstants :: JSON_CONTENTTYPE_STRING ) -> writeValue ( $ entry -> mediaLink -> contentType ) ; if ( $ entry -> mediaLink -> eTag != null ) { $ this -> _writer -> writeName ( ODataConstants :: JSON_MEDIAETAG_STRING ) -> writeValue ( $ entry -> mediaLink -> eTag ) ; } $ this -> _writer -> endScope ( ) ; } foreach ( $ entry -> mediaLinks as $ mediaLink ) { $ this -> _writer -> writeName ( $ mediaLink -> name ) -> startObjectScope ( ) -> writeName ( ODataConstants :: JSON_MEDIASRC_STRING ) -> writeValue ( $ mediaLink -> srcLink ) -> writeName ( ODataConstants :: JSON_CONTENTTYPE_STRING ) -> writeValue ( $ mediaLink -> contentType ) ; if ( $ mediaLink -> eTag != null ) { $ this -> _writer -> writeName ( ODataConstants :: JSON_MEDIAETAG_STRING ) -> writeValue ( $ mediaLink -> eTag ) ; } $ this -> _writer -> endScope ( ) ; } } else { $ this -> _writer -> endScope ( ) ; } return $ this ; }
Write metadata information for the entry.
Write metadata information for the entry .
// __metadata : { uri: "Uri", type: "Type" [Media Link Properties] } // "__metadata" // Write uri value only for entity types // Write the etag property, if the entry has etag properties. // Write the type property, if the entry has type properties. // Media links. // writing named resource streams