/** * To handle the HttpResponse object of a HttpRequest POST request in * non-batching mode. This function will invoke ObjectContext::AttachLocation * which uses the value of HttpHeader with key 'Location' to set the Identity * and EditLink of current entry (ResourceBox) under process. Also populate the * entity instance with OData service returned values. * * @param HttpResponse $httpResponse */ protected function HandleOperationResponse($httpResponse) { $resourceBox = $this->_changedEntries[$this->_entryIndex]; if ($resourceBox->IsResource()) { $headers = $httpResponse->getHeaders(); //Handle the POST Operation Response. //SDK will fire POST operation in three cases //1. AddLink [we will skip this case] //2. AddObject [$resourceBox->State == EntityStates::Added] //3. SetSaveStream on an entity which is just added using AddObject // In this case the CheckAndProcessMediaEntryPost will set the state // of the object to Modified. // [($resourceBox->State == EntityStates::Modified) && // $this->_processingMediaLinkEntry) && // !$this->_processingMediaLinkEntryPut)] if ($resourceBox->State == EntityStates::Added || $resourceBox->State == EntityStates::Modified && $this->_processingMediaLinkEntry && !$this->_processingMediaLinkEntryPut) { $resourceBox->EntityETag = AtomParser::GetEntityEtag($httpResponse->getBody()); $location = isset($headers[HttpRequestHeader::Location]) ? $headers[HttpRequestHeader::Location] : null; if ($httpResponse->isSuccessful()) { if ($location == null) { throw new ODataServiceException(Resource::NoLocationHeader, '', array(), null); } $this->_context->AttachLocation($resourceBox->getResource(), $location); if ($resourceBox->State == EntityStates::Added) { $atomEntry = null; AtomParser::PopulateObject($httpResponse->getBody(), $resourceBox->getResource(), $uri, $atomEntry); } else { //After the POST operation for a media, state of corrosponding entity will be //updated to Modified [earlier it will be Added] in CheckAndProcessMediaEntryPost //function. So next will be a MERGE request, while generating body for this //MERGE operation, the function CreateChangeSetBodyForResource will throw error //if any of the Key field is null. So update the Key fields. AtomParser::PopulateMediaEntryKeyFields($httpResponse->getBody(), $resourceBox->getResource()); } } } if ($this->_processingMediaLinkEntry && !$httpResponse->isSuccessful()) { $this->_processingMediaLinkEntry = false; if ($this->_processingMediaLinkEntryPut) { $resourceBox->State = EntityStates::Added; $this->_processingMediaLinkEntryPut = false; } } } }
/** * Add Territories * @param Territories $object */ public function AddToTerritories($object) { return parent::AddObject('Territories', $object); }
/** * Add sysdiagrams * @param sysdiagrams $object */ public function AddTosysdiagrams($object) { return parent::AddObject('sysdiagrams', $object); }
/** * Add People * @param People $object */ public function AddToPeople($object) { return parent::AddObject('People', $object); }