/** * To create the Uri to be used for a binding operation (AddLink, SetLink * or DeleteLink). For example if both Customer (with id 'ALKFI')and * Order (1234)exists in OData service and in context, then Uri will be: * _http://dataservice/Customers('ALKFI')/$links/Orders(1234) * if only Customer exists in the data service and context and Order is just * added in the context then Uri will be: * _http://dataservice/Customers('ALKFI')/$links/Orders * * @param ResourceBox $sourceResourceBox * @param RelatedEnd $binding * @return Uri */ protected function CreateRequestUri($sourceResourceBox, $binding) { return Utility::CreateUri($sourceResourceBox->GetResourceUri($this->_context->GetBaseUriWithSlash()), $this->CreateRequestRelativeUri($binding)); }
/** * To update the $resourceBox::Source object by parsing the atom XML in $str. * [Note: Do not call this function from your application, it is used internally] * * @param string $str * @param ResourceBox $resourceBox * @param string $content_type */ public function LoadResourceBox($str, $resourceBox, $content_type) { $resource = $resourceBox->GetResource(); $uri = null; $atomEntry = null; AtomParser::PopulateObject($str, $resource, $uri, $atomEntry); if (isset($uri)) { $index = Utility::reverseFind($uri, '/'); $editLink = substr($uri, $index + 1, strlen($uri) - $index); $resourceBox->Identity = $uri; $resourceBox->EditLink = $editLink; } //If $str represents content of entry of type Media then //popluate values specific to media entry $resourceBox->EditMediaLink = $atomEntry->EditMediaLink; $resourceBox->MediaLinkEntry = $atomEntry->MediaLinkEntry; $resourceBox->StreamETag = $atomEntry->StreamETag; $resourceBox->EntityETag = $atomEntry->EntityETag; $resourceBox->StreamLink = $atomEntry->MediaContentUri; }