|
@@ 537-553 (lines=17) @@
|
| 534 |
|
* |
| 535 |
|
* @return \eZ\Publish\API\Repository\Values\Content\Location $location, with updated hidden value |
| 536 |
|
*/ |
| 537 |
|
public function hideLocation(APILocation $location) |
| 538 |
|
{ |
| 539 |
|
if (!$this->repository->canUser('content', 'hide', $location->getContentInfo(), $location)) { |
| 540 |
|
throw new UnauthorizedException('content', 'hide', ['locationId' => $location->id]); |
| 541 |
|
} |
| 542 |
|
|
| 543 |
|
$this->repository->beginTransaction(); |
| 544 |
|
try { |
| 545 |
|
$this->persistenceHandler->locationHandler()->hide($location->id); |
| 546 |
|
$this->repository->commit(); |
| 547 |
|
} catch (Exception $e) { |
| 548 |
|
$this->repository->rollback(); |
| 549 |
|
throw $e; |
| 550 |
|
} |
| 551 |
|
|
| 552 |
|
return $this->loadLocation($location->id); |
| 553 |
|
} |
| 554 |
|
|
| 555 |
|
/** |
| 556 |
|
* Unhides the $location. |
|
@@ 567-583 (lines=17) @@
|
| 564 |
|
* |
| 565 |
|
* @return \eZ\Publish\API\Repository\Values\Content\Location $location, with updated hidden value |
| 566 |
|
*/ |
| 567 |
|
public function unhideLocation(APILocation $location) |
| 568 |
|
{ |
| 569 |
|
if (!$this->repository->canUser('content', 'hide', $location->getContentInfo(), $location)) { |
| 570 |
|
throw new UnauthorizedException('content', 'hide', ['locationId' => $location->id]); |
| 571 |
|
} |
| 572 |
|
|
| 573 |
|
$this->repository->beginTransaction(); |
| 574 |
|
try { |
| 575 |
|
$this->persistenceHandler->locationHandler()->unHide($location->id); |
| 576 |
|
$this->repository->commit(); |
| 577 |
|
} catch (Exception $e) { |
| 578 |
|
$this->repository->rollback(); |
| 579 |
|
throw $e; |
| 580 |
|
} |
| 581 |
|
|
| 582 |
|
return $this->loadLocation($location->id); |
| 583 |
|
} |
| 584 |
|
|
| 585 |
|
/** |
| 586 |
|
* Moves the subtree to $newParentLocation. |