This commit is contained in:
2021-08-05 11:41:18 +08:00
parent d2c1d130c9
commit ae246a42d1
2 changed files with 8 additions and 3 deletions
+7 -2
View File
@@ -261,8 +261,13 @@ class Node extends HttpService
*/
public function addChild(Node $node, string $field): Node
{
$this->childes[] = $node;
return $node;
/** @var Node $oLod */
$oLod = $this->childes[$field] ?? null;
if (!empty($oLod)) {
$node = $oLod;
}
$this->childes[$field] = $node;
return $this->childes[$field];
}