src/POData/Writers/Json/JsonODataV1Writer.php
/**
     * Begin an item in a collection
     *
     * @param ODataBagContent $bag bag property to write
     *
     * @return JsonODataV1Writer
     */
Begin an item in a collection
@param ODataBagContent $bag bag property to write


Begin an item in a collection @param ODataBagContent $bag bag property to write
protected function writeBagContent(ODataBagContent $bag)
    {
        $this->_writer
	        ->startObjectScope() 
	        ->writeName(ODataConstants::JSON_METADATA_STRING) 
            ->startObjectScope()
            ->writeName(ODataConstants::JSON_TYPE_STRING)
            ->writeValue($bag->type)
            ->endScope()  
	        ->writeName(ODataConstants::JSON_RESULT_NAME) 
	    	->startArrayScope(); 
        foreach ($bag->propertyContents as $content) {
            if ($content instanceof ODataPropertyContent) {
                $this->_writer->startObjectScope();
                $this->writeProperties($content);
                $this->_writer->endScope();
            } else {
                preg_match('#\((.*?)\)#', $bag->type, $type);
                $this->_writer->writeValue($content, $type[1]);
            }
        }
        $this->_writer
	        ->endScope()  
	        ->endScope(); 
	    return $this;
    }
protected function writeBagContent ( ODataBagContent $ bag ) { $ this -> _writer -> startObjectScope ( ) -> writeName ( ODataConstants :: JSON_METADATA_STRING ) -> startObjectScope ( ) -> writeName ( ODataConstants :: JSON_TYPE_STRING ) -> writeValue ( $ bag -> type ) -> endScope ( ) -> writeName ( ODataConstants :: JSON_RESULT_NAME ) -> startArrayScope ( ) ; foreach ( $ bag -> propertyContents as $ content ) { if ( $ content instanceof ODataPropertyContent ) { $ this -> _writer -> startObjectScope ( ) ; $ this -> writeProperties ( $ content ) ; $ this -> _writer -> endScope ( ) ; } else { preg_match ( '#\((.*?)\)#' , $ bag -> type , $ type ) ; $ this -> _writer -> writeValue ( $ content , $ type [ 1 ] ) ; } } $ this -> _writer -> endScope ( ) -> endScope ( ) ; return $ this ; }
Begin an item in a collection
 @param ODataBagContent $bag bag property to write
Begin an item in a collection @param ODataBagContent $bag bag property to write
// { //__metadata : { Type : "typename" } // } // "__results": // [ // retrieving the collection datatype in order //to write in json specific format, with in chords or not // ] // }