From af9a0efe7e6dedd643637b04d27c30f967262153 Mon Sep 17 00:00:00 2001 From: Patrick Hopfner Date: Thu, 9 Mar 2017 11:10:35 +0100 Subject: [PATCH 1/3] Version controller clean up --- Controller/VersionController.php | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/Controller/VersionController.php b/Controller/VersionController.php index fed19078d..9acbe536b 100644 --- a/Controller/VersionController.php +++ b/Controller/VersionController.php @@ -127,24 +127,18 @@ public function postTriggerAction(Request $request, $uuid, $version) switch ($action) { case 'restore': - try { - $document = $this->getDocumentManager()->find($uuid, $locale); - - $this->getDocumentManager()->restore( - $document, - $locale, - str_replace('_', '.', $version) - ); - $this->getDocumentManager()->flush(); - - $data = $this->getDocumentManager()->find($uuid, $locale); - $view = $this->view($data, $data !== null ? Response::HTTP_OK : Response::HTTP_NO_CONTENT); - $view->setSerializationContext(SerializationContext::create()->setGroups(['defaultPage'])); - } catch (VersionException $exception) { - $view = $this->view($exception->getMessage(), Response::HTTP_NOT_FOUND); - } catch (DocumentNotFoundException $exception) { - $view = $this->view($exception->getMessage(), Response::HTTP_NOT_FOUND); - } + $document = $this->getDocumentManager()->find($uuid, $locale); + + $this->getDocumentManager()->restore( + $document, + $locale, + str_replace('_', '.', $version) + ); + $this->getDocumentManager()->flush(); + + $data = $this->getDocumentManager()->find($uuid, $locale); + $view = $this->view($data, $data !== null ? Response::HTTP_OK : Response::HTTP_NO_CONTENT); + $view->setSerializationContext(SerializationContext::create()->setGroups(['defaultPage'])); break; default: From 73522170397248aa6af0dde8f7194cad9dff3cd4 Mon Sep 17 00:00:00 2001 From: Patrick Hopfner Date: Thu, 9 Mar 2017 11:34:40 +0100 Subject: [PATCH 2/3] Code clean up --- Controller/VersionController.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/Controller/VersionController.php b/Controller/VersionController.php index 9acbe536b..fbf73f559 100644 --- a/Controller/VersionController.php +++ b/Controller/VersionController.php @@ -15,11 +15,9 @@ use FOS\RestBundle\Controller\FOSRestController; use FOS\RestBundle\Routing\ClassResourceInterface; use JMS\Serializer\SerializationContext; -use PHPCR\Version\VersionException; use Sulu\Bundle\ArticleBundle\Admin\ArticleAdmin; use Sulu\Component\Content\Document\Behavior\SecurityBehavior; use Sulu\Component\DocumentManager\DocumentManagerInterface; -use Sulu\Component\DocumentManager\Exception\DocumentNotFoundException; use Sulu\Component\DocumentManager\Version; use Sulu\Component\Rest\Exception\RestException; use Sulu\Component\Rest\ListBuilder\ListRepresentation; From 9c7cf0754cb620de81386e14652ce6de7e8a2564 Mon Sep 17 00:00:00 2001 From: Patrick Hopfner Date: Thu, 9 Mar 2017 15:46:58 +0100 Subject: [PATCH 3/3] Updated dependencies --- .travis.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0e919a070..5a788632b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ matrix: - CODE_COVERAGE="--coverage-clover=coverage.clover" - php: 7.0 env: - - SULU_VERSION="1.5.*" + - SULU_VERSION="dev-master" - SYMFONY__PHPCR__TRANSPORT=jackrabbit before_install: diff --git a/composer.json b/composer.json index 97f1a608f..3b6a0253d 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "MIT", "require": { "php": "^5.5 || ^7.0", - "sulu/sulu": "^1.5 || dev-develop", + "sulu/sulu": "^1.5 || dev-develop || dev-master", "sulu/document-manager": "@dev", "massive/search-bundle": "@dev", "ongr/elasticsearch-bundle": "~1.0"