-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Versioning Support #316
Open
dbu
wants to merge
16
commits into
2.x
Choose a base branch
from
versioning
base: 2.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+294
−65
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4f7fd63
enabled versioning tests
danrot badb447
implemented VersioningInterface
danrot 7816e61
fixed tests for versioning
danrot c9585a2
included VersionHandler in NodeProcessor
danrot 333d28f
added call to checkout method
danrot 22d2ee6
adjusted tests to skip not yet supported ones
danrot 95ba2f3
updated phpcr-utils
danrot aa81162
updated documentation
danrot 0517666
removed getter for VersionHandler
danrot be38d84
updated dependencies
danrot beb30ff
enabled version history tests
danrot ae72e3f
added required versioning properties to test fixtures
danrot 7abb78d
enabled VerstionTests
danrot afba787
added new tests and adapted fixtures
danrot 8bdf1dd
removed the test for write protection
danrot 34946d7
cleaned code
danrot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
|
||
namespace Jackalope\Transport\DoctrineDBAL; | ||
|
||
use Jackalope\Version\GenericVersioningInterface; | ||
use Jackalope\Version\VersionHandler; | ||
use PHPCR\LoginException; | ||
use PHPCR\NodeType\NodeDefinitionInterface; | ||
use PHPCR\NodeType\NodeTypeExistsException; | ||
|
@@ -23,6 +25,7 @@ | |
use PHPCR\PathNotFoundException; | ||
use PHPCR\Query\InvalidQueryException; | ||
use PHPCR\NodeType\ConstraintViolationException; | ||
use PHPCR\UnsupportedRepositoryOperationException; | ||
use PHPCR\Util\QOM\Sql2ToQomQueryConverter; | ||
use PHPCR\Util\ValueConverter; | ||
use PHPCR\Util\UUIDHelper; | ||
|
@@ -48,6 +51,7 @@ | |
use Jackalope\FactoryInterface; | ||
use Jackalope\NotImplementedException; | ||
use Jackalope\NodeType\NodeProcessor; | ||
use PHPCR\Version\VersionException; | ||
|
||
/** | ||
* Class to handle the communication between Jackalope and RDBMS via Doctrine DBAL. | ||
|
@@ -58,7 +62,7 @@ | |
* @author Benjamin Eberlei <[email protected]> | ||
* @author Lukas Kahwe Smith <[email protected]> | ||
*/ | ||
class Client extends BaseTransport implements QueryTransport, WritingInterface, WorkspaceManagementInterface, NodeTypeManagementInterface, TransactionInterface | ||
class Client extends BaseTransport implements QueryTransport, WritingInterface, WorkspaceManagementInterface, NodeTypeManagementInterface, TransactionInterface, GenericVersioningInterface | ||
{ | ||
/** | ||
* SQlite can only handle a maximum of 999 parameters inside an IN statement | ||
|
@@ -189,6 +193,11 @@ class Client extends BaseTransport implements QueryTransport, WritingInterface, | |
*/ | ||
private $nodeProcessor; | ||
|
||
/** | ||
* @var VersionHandler | ||
*/ | ||
private $versionHandler; | ||
|
||
/** | ||
* @param FactoryInterface $factory | ||
* @param Connection $conn | ||
|
@@ -1899,7 +1908,8 @@ private function getNodeProcessor() | |
$this->nodeProcessor = new NodeProcessor( | ||
$this->credentials->getUserID(), | ||
$this->getNamespacesObject(), | ||
$this->getAutoLastModified() | ||
$this->getAutoLastModified(), | ||
$this->versionHandler | ||
); | ||
|
||
return $this->nodeProcessor; | ||
|
@@ -2588,8 +2598,12 @@ public function rollbackSave() | |
public function updateProperties(Node $node) | ||
{ | ||
$this->assertLoggedIn(); | ||
// we can ignore the operations returned, there will be no additions because of property updates | ||
$this->getNodeProcessor()->process($node); | ||
|
||
$additionalAddOperations = $this->getNodeProcessor()->process($node); | ||
|
||
if (!empty($additionalAddOperations)) { | ||
$this->storeNodes($additionalAddOperations); | ||
} | ||
|
||
$this->syncNode($node->getIdentifier(), $node->getPath(), $node->getPrimaryNodeType(), false, $node->getProperties()); | ||
|
||
|
@@ -2617,4 +2631,49 @@ private function initConnection() | |
|
||
$this->connectionInitialized = true; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function checkinItem($path) | ||
{ | ||
return $this->versionHandler->checkinItem($path); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function checkoutItem($path) | ||
{ | ||
return $this->versionHandler->checkoutItem($path); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function restoreItem($removeExisting, $versionPath, $path) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function removeVersion($versionPath, $versionName) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
/** | ||
* Sets the generic version handler delivered by jackalope | ||
* @param VersionHandler $versionHandler | ||
*/ | ||
public function setVersionHandler(VersionHandler $versionHandler) | ||
{ | ||
if ($this->versionHandler) { | ||
throw new \InvalidArgumentException('Version handler is already set'); | ||
} | ||
|
||
$this->versionHandler = $versionHandler; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when ready, merge and release jackalope/jackalope#296 and then require versions that have that code.