Skip to content

Commit ab95f27

Browse files
committed
Made Version commands CNP sensative
1 parent 7f07210 commit ab95f27

File tree

6 files changed

+37
-35
lines changed

6 files changed

+37
-35
lines changed

src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckinCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ protected function configure()
1313
{
1414
$this->setName('version:checkin');
1515
$this->setDescription('Checkin (commit) a node version');
16-
$this->addArgument('absPath', null, InputArgument::REQUIRED, 'Absolute path to node');
16+
$this->addArgument('path', null, InputArgument::REQUIRED, 'Absolute path to node');
1717
$this->setHelp(<<<HERE
18-
Creates for the versionable node at <info>absPath</info> a new version with a system
18+
Creates for the versionable node at <info>path</info> a new version with a system
1919
generated version name and returns that version (which will be the new
2020
base version of this node). Sets the <comment>jcr:checkedOut</comment> property to false
2121
thus putting the node into the checked-in state. This means that the node
@@ -49,15 +49,15 @@ public function execute(InputInterface $input, OutputInterface $output)
4949
{
5050
$session = $this->getHelper('phpcr')->getSession();
5151
$nodeHelper = $this->getHelper('node');
52-
$absPath = $input->getArgument('absPath');
52+
$path = $session->getAbsPath($input->getArgument('path'));
5353
$workspace = $session->getWorkspace();
5454

5555
$versionManager = $workspace->getVersionManager();
5656

57-
$node = $session->getNode($absPath);
57+
$node = $session->getNode($path);
5858
$nodeHelper->assertNodeIsVersionable($node);
5959

60-
$version = $versionManager->checkin($absPath);
60+
$version = $versionManager->checkin($path);
6161

6262
$output->writeln('Version: ' . $version->getName());
6363
}

src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckoutCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ protected function configure()
1313
{
1414
$this->setName('version:checkout');
1515
$this->setDescription('Checkout a node version and enable changes to be made');
16-
$this->addArgument('absPath', null, InputArgument::REQUIRED, 'Absolute path to node');
16+
$this->addArgument('path', null, InputArgument::REQUIRED, 'Absolute path to node');
1717
$this->setHelp(<<<HERE
18-
Sets the versionable node at <info>absPath</info> to checked-out status by setting
18+
Sets the versionable node at <info>path</info> to checked-out status by setting
1919
its jcr:isCheckedOut property to true. Under full versioning it also sets
2020
the jcr:predecessors property to be a reference to the current base
2121
version (the same value as held in <comment>jcr:baseVersion</comment>).
@@ -37,7 +37,7 @@ public function execute(InputInterface $input, OutputInterface $output)
3737
{
3838
$session = $this->getHelper('phpcr')->getSession();
3939
$nodeHelper = $this->getHelper('node');
40-
$absPath = $input->getArgument('absPath');
40+
$absPath = $session->getAbsPath($input->getArgument('path'));
4141
$workspace = $session->getWorkspace();
4242

4343
$node = $session->getNode($absPath);

src/PHPCR/Shell/Console/Command/Phpcr/VersionCheckpointCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ protected function configure()
1313
{
1414
$this->setName('version:checkpoint');
1515
$this->setDescription('Checkin and then checkout a node');
16-
$this->addArgument('absPath', null, InputArgument::REQUIRED, 'Absolute path to node');
16+
$this->addArgument('path', null, InputArgument::REQUIRED, 'Path to node');
1717
$this->setHelp(<<<HERE
1818
Performs a <info>version:checkin</info> followed by a <info>version:checkout</info> on the versionable node at
19-
<info>absPath</info>
19+
<info>path</info>
2020
2121
If this node is already checked-in, this method is equivalent to <info>version:checkout</info>.
2222
HERE
@@ -27,13 +27,13 @@ public function execute(InputInterface $input, OutputInterface $output)
2727
{
2828
$session = $this->getHelper('phpcr')->getSession();
2929
$nodeHelper = $this->getHelper('node');
30-
$absPath = $input->getArgument('absPath');
30+
$path = $session->getAbsPath($input->getArgument('path'));
3131
$workspace = $session->getWorkspace();
3232

33-
$node = $session->getNode($absPath);
33+
$node = $session->getNode($path);
3434
$nodeHelper->assertNodeIsVersionable($node);
3535
$versionManager = $workspace->getVersionManager();
36-
$version = $versionManager->checkpoint($absPath);
36+
$version = $versionManager->checkpoint($path);
3737

3838
$output->writeln('Version: ' . $version->getName());
3939
}

src/PHPCR/Shell/Console/Command/Phpcr/VersionHistoryCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ protected function configure()
1313
{
1414
$this->setName('version:history');
1515
$this->setDescription('Show version history of node at given absolute path');
16-
$this->addArgument('absPath', null, InputArgument::REQUIRED, 'Absolute path to node');
16+
$this->addArgument('path', null, InputArgument::REQUIRED, 'Absolute path to node');
1717
$this->setHelp(<<<HERE
18-
Lists the version history of the node given at <info>absPath</info>.
18+
Lists the version history of the node given at <info>path</info>.
1919
HERE
2020
);
2121
}
@@ -26,13 +26,13 @@ public function execute(InputInterface $input, OutputInterface $output)
2626
$nodeHelper = $this->getHelper('node');
2727
$table = clone $this->getHelper('table');
2828

29-
$absPath = $input->getArgument('absPath');
29+
$path = $session->getAbsPath($input->getArgument('path'));
3030
$workspace = $session->getWorkspace();
3131

32-
$node = $session->getNode($absPath);
32+
$node = $session->getNode($path);
3333
$nodeHelper->assertNodeIsVersionable($node);
3434
$versionManager = $workspace->getVersionManager();
35-
$history = $versionManager->getVersionHistory($absPath);
35+
$history = $versionManager->getVersionHistory($path);
3636

3737
$versions = $history->getAllVersions();
3838

src/PHPCR/Shell/Console/Command/Phpcr/VersionRemoveCommand.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ protected function configure()
1313
{
1414
$this->setName('version:remove');
1515
$this->setDescription('Remove a node version');
16-
$this->addArgument('absPath', null, InputArgument::REQUIRED, 'Absolute path to node');
16+
$this->addArgument('path', null, InputArgument::REQUIRED, 'Path to node');
1717
$this->addArgument('versionName', null, InputArgument::REQUIRED, 'Name of version to remove');
1818
$this->setHelp(<<<HERE
1919
Removes the named version from this version history and automatically
@@ -37,13 +37,14 @@ protected function configure()
3737

3838
public function execute(InputInterface $input, OutputInterface $output)
3939
{
40-
$absPath = $input->getArgument('absPath');
41-
$versionName = $input->getArgument('versionName');
4240
$session = $this->getHelper('phpcr')->getSession();
41+
42+
$versionName = $input->getArgument('versionName');
43+
$path = $session->getAbsPath($input->getArgument('path'));
4344
$workspace = $session->getWorkspace();
4445
$versionManager = $workspace->getVersionManager();
4546

46-
$history = $versionManager->getVersionHistory($absPath);
47+
$history = $versionManager->getVersionHistory($path);
4748
$history->removeVersion($versionName);
4849
}
4950
}

src/PHPCR/Shell/Console/Command/Phpcr/VersionRestoreCommand.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@ protected function configure()
1414
{
1515
$this->setName('version:restore');
1616
$this->setDescription('Restore a node version');
17-
$this->addArgument('absPath', null, InputArgument::REQUIRED, 'Absolute path to node');
17+
$this->addArgument('path', null, InputArgument::REQUIRED, 'Path to node');
1818
$this->addArgument('versionName', null, InputArgument::REQUIRED, 'Name of version to retore');
1919
$this->addOption('remove-existing', null, InputOption::VALUE_NONE, 'Flag that governs what happens in case of identifier collision');
2020
$this->setHelp(<<<HERE
2121
Attempt to restore an old version of a node.
2222
23-
<em>If <info>absPath</info> is given and <info>versionName</info> is a version name:</em>
24-
Restores the node at <info>absPath</info> to the state defined by the version with
23+
<em>If <info>path</info> is given and <info>versionName</info> is a version name:</em>
24+
Restores the node at <info>path</info> to the state defined by the version with
2525
the specified version name (<info>versionName</info>).
26-
This method will work regardless of whether the node at absPath is
26+
This method will work regardless of whether the node at path is
2727
checked-in or not.
2828
2929
30-
<em>If <info>absPath</info> is given and <info>versionName</info> is a VersionInterface instance:
30+
<em>If <info>path</info> is given and <info>versionName</info> is a VersionInterface instance:
3131
</em>
32-
Restores the specified version to <info>absPath</info>. There must be no existing
33-
node at <info>absPath</info>. If one exists, a VersionException is thrown.
34-
There must be a parent node to the location at <info>absPath</info>, otherwise a
32+
Restores the specified version to <info>path</info>. There must be no existing
33+
node at <info>path</info>. If one exists, a VersionException is thrown.
34+
There must be a parent node to the location at <info>path</info>, otherwise a
3535
PathNotFoundException is thrown.
36-
If the would-be parent of the location <info>absPath</info> is actually a property,
36+
If the would-be parent of the location <info>path</info> is actually a property,
3737
or if a node type restriction would be violated, then a
3838
ConstraintViolationException is thrown.
3939
@@ -71,7 +71,7 @@ protected function configure()
7171
subgraphs that has the same identifier as one of the nodes that would be
7272
introduced by the restore operation into one of these subgraphs.
7373
Else, an identifier collision occurs when a node exists outside the
74-
subgraph rooted at absPath with the same identifier as a node that would
74+
subgraph rooted at path with the same identifier as a node that would
7575
be introduced by the restore operation into the affected subgraph.
7676
The result in such a case is governed by the removeExisting flag. If
7777
<info>removeExisting</info> is true, then the incoming node takes precedence, and the
@@ -93,12 +93,13 @@ protected function configure()
9393

9494
public function execute(InputInterface $input, OutputInterface $output)
9595
{
96-
$absPath = $input->getArgument('absPath');
96+
$session = $this->getHelper('phpcr')->getSession();
97+
98+
$path = $session->getAbsPath($input->getArgument('path'));
9799
$versionName = $input->getArgument('versionName');
98100
$removeExisting = $input->getOption('remove-existing');
99-
$session = $this->getHelper('phpcr')->getSession();
100101
$workspace = $session->getWorkspace();
101102
$versionManager = $workspace->getVersionManager();
102-
$versionManager->restore($removeExisting, $versionName, $absPath);
103+
$versionManager->restore($removeExisting, $versionName, $path);
103104
}
104105
}

0 commit comments

Comments
 (0)