/** * Undelete all revisions of an object * * @param ObjectInterface $object Object * @return ObjectInterface Object */ protected function undeleteObject(ObjectInterface $object) { // Hide object directory $objContainerDir = dirname(dirname($this->getAbsoluteResourcePath($object->getRepositoryLocator()))); $objContainerName = $object->getId()->getId() . '-' . $object->getObjectType()->getType(); $objPublicContainer = $objContainerDir . DIRECTORY_SEPARATOR . $objContainerName; $objHiddenContainer = $objContainerDir . DIRECTORY_SEPARATOR . '.' . $objContainerName; if (file_exists($objHiddenContainer) && is_dir($objHiddenContainer) && !rename($objHiddenContainer, $objPublicContainer)) { throw new RuntimeException(sprintf('Cannot unhide object container "%s"', $objContainerName), RuntimeException::CANNOT_UNHIDE_OBJECT_CONTAINER); } // Undelete all object revisions /** @var ObjectInterface $objectRevision */ foreach ($object as $objectRevision) { $this->persistObjectResource($objectRevision->undelete()); } return $this; }