Mariusz Muszyński преди 8 години
родител
ревизия
adf2858afb
променени са 1 файла, в които са добавени 4 реда и са изтрити 1 реда
  1. 4 1
      SE/se-lib/Route/WfsBiAudit.php

+ 4 - 1
SE/se-lib/Route/WfsBiAudit.php

@@ -5,7 +5,7 @@ Lib::loadClass('RouteBase');
 class Route_WfsBiAudit extends RouteBase {
 
 	const maxResolveDepth = 3;
-	private $dom, $tablesUsed = [];
+	private $dom, $path = [], $tablesUsed = [];
 
 	private static function output($output) {
 		header("Content-Type: application/xml");
@@ -39,6 +39,8 @@ EOT;
 	}
 
 	private function findRelations($node, $ID, $resolveDepth) {
+		if (in_array($ID, $this->path)) return;
+		$this->path[] = $ID;
 		$query = "select `REMOTE_TABLE`, `REMOTE_ID` from `BI_audit_ALL` where `ID` = {$ID}";
 		if (!($row = DB::getPDO()->fetchFirst($query))) self::throwServiceException("Błąd danych");
 		if (!in_array($row['REMOTE_TABLE'], $this->tablesUsed)) $this->tablesUsed[] = $row['REMOTE_TABLE'];
@@ -53,6 +55,7 @@ EOT;
 			$xlink = $this->addChild($node, "default_db__x3A__{$row['REMOTE_TABLE']}:{$row['REMOTE_TABLE']}");
 			$this->addAttribute($xlink, 'xlink:href', "https://biuro.biall-net.pl/wfs/default_db/{$row['REMOTE_TABLE']}#{$row['REMOTE_TABLE']}.{$row['REMOTE_ID']}");
 		}
+		array_pop($this->path);
 	}
 
 	public function defaultAction() {