public static function ParseMultiFeatureXml($app, $classDef, $xml, $featureNodeName = "Feature", $propertyNodeName = "Property") { $doc = new DOMDocument(); $doc->loadXML($xml); return MgUtils::ParseMultiFeatureDocument($app, $classDef, $doc, $featureNodeName, $propertyNodeName); }
/** * Handles POST requests for this adapter. Overridable. Does nothing if not overridden. */ public function HandlePost($single) { $trans = null; try { $tokens = explode(":", $this->className); $schemaName = $tokens[0]; $className = $tokens[1]; $commands = new MgFeatureCommandCollection(); $classDef = $this->featSvc->GetClassDefinition($this->featureSourceId, $schemaName, $className); if ($this->app->REQUEST_BODY_DOCUMENT != null) { $batchProps = MgUtils::ParseMultiFeatureDocument($this->app, $classDef, $this->app->REQUEST_BODY_DOCUMENT); } else { $batchProps = MgUtils::ParseMultiFeatureXml($this->app, $classDef, $this->app->request->getBody()); } $insertCmd = new MgInsertFeatures("{$schemaName}:{$className}", $batchProps); $commands->Add($insertCmd); if ($this->useTransaction) { $trans = $this->featSvc->BeginTransaction($this->featureSourceId); } //HACK: Due to #2252, we can't call UpdateFeatures() with NULL MgTransaction, so to workaround //that we call the original UpdateFeatures() overload with useTransaction = false if we find a //NULL MgTransaction if ($trans == null) { $result = $this->featSvc->UpdateFeatures($this->featureSourceId, $commands, false); } else { $result = $this->featSvc->UpdateFeatures($this->featureSourceId, $commands, $trans); } if ($trans != null) { $trans->Commit(); } $this->OutputUpdateFeaturesResult($commands, $result, $classDef); } catch (MgException $ex) { if ($trans != null) { $trans->Rollback(); } $this->OnException($ex); } }