array( "Name" => "Name", "Source" => "Source", "Notes" => "Notes", "TypeId" => "TypeId", "ParentRevisionId" => "ParentRevisionId", "FirstRevisionId" => "FirstRevisionId", "FromNodeId" => "FromNodeId", "ToNodeId" => "ToNodeId" ), 'numeric' => array( "UserId" => "UserId", "Reliability" => "Reliability" ), 'timestamp' => array( "CreationDate" => "CreationDate" ), 'boolean' => array( "LatestRevision" => "LatestRevision", "IsBidirectional" => "IsBidirectional" ), 'relationshiptype' => array( "Type" => "TypeId" ), 'relationship' => array( "ParentRevision" => "ParentRevisionId", "FirstRevision" => "FirstRevisionId" ), 'node' => array( "FromNode" => "FromNodeId", "ToNode" => "ToNodeId" ), 'user' => array( "User" => "UserId" ) ); public function SaveRevision($user) { /* Create a working copy of the current object */ $this_copy = clone $this; /* Create a new object representing the new revision */ $sNode = clone $this; $sNode->sId = 0; $sNode->uParentRevisionId = $this->sId; $sNode->uUserId = $user->sId; $sNode->uCreationDate = time(); $sNode->InsertIntoDatabase(true); /* Clear out all changes to the working copy, and save the changed 'latest revision' flag */ $this_copy->RefreshData(); $this_copy->uLatestRevision = false; $this_copy->InsertIntoDatabase(); /* Set the same flag on the current object, in case of further operations */ $this->uLatestRevision = false; } }