Skip to content

Commit

Permalink
Workspace.removeItem() implementation. Refs midgardprojectgh-151
Browse files Browse the repository at this point in the history
  • Loading branch information
piotras committed Jan 24, 2013
1 parent a10d551 commit 1182586
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Midgard/PHPCR/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ abstract protected function populateParent();
public function getPath()
{
if ($this->is_removed) {
throw new \PHPCR\RepositoryException("Can not get path of removed item");
throw new \PHPCR\InvalidItemStateException("Can not get path of removed item");
}

return $this->getPathUnchecked();
Expand Down
2 changes: 1 addition & 1 deletion src/Midgard/PHPCR/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public function addValue($value)
public function getValue()
{
if ($this->is_purged === true || $this->is_removed === true) {
throw new \PHPCR\RepositoryException("Can not get value of purged property.");
throw new \PHPCR\InvalidItemStateException("Can not get value of purged property.");
}

$type = $this->getType();
Expand Down
9 changes: 8 additions & 1 deletion src/Midgard/PHPCR/Workspace.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,14 @@ public function deleteWorkspace($name)

public function removeItem($absPath)
{

$item = $this->session->getItem($absPath);
if ($item instanceof \PHPCR\PropertyInterface) {
$item->remove();
$item->removeMidgard2Property();
} else {
$item->removeMidgard2Node();
$item->remove();
}
}

public function getRepositoryManager()
Expand Down

0 comments on commit 1182586

Please sign in to comment.