From 21bb47a632ba2ad87aee826783663924b5cdece3 Mon Sep 17 00:00:00 2001 From: wollanup Date: Mon, 5 Jun 2017 16:44:00 +0200 Subject: [PATCH] update version of wollanup/php-api-rest-interfaces --- composer.json | 2 +- src/Service/Router/Route.php | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3614f96..72195ee 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ }, "require": { "propel/propel": "~2.0@dev", - "wollanup/php-api-rest-interfaces": "^1.1.5", + "wollanup/php-api-rest-interfaces": "1.1.7", "wollanup/php-api-rest-propel-behavior": "^1.1", "wollanup/php-api-rest-service-request": "^1.0", "wollanup/php-api-rest-utils": "^1.1", diff --git a/src/Service/Router/Route.php b/src/Service/Router/Route.php index 607f8f1..0b879e5 100644 --- a/src/Service/Router/Route.php +++ b/src/Service/Router/Route.php @@ -95,7 +95,7 @@ public function bindToRouter(RouterInterface $router) $this->callable = sprintf('%s:%s', $this->getActionClass(), $this->getActionMethod()); if ($this->isMakeInstance()) { $route = $this; - if ($this->getVerb() === Route::POST && !$this->instanceForceFetch) { + if ($this->isMakeInstanceCreate()) { # POST : create $this->add(function ($request, $response, $next) use ($route) { $requestClass = $route->getRequestClass(); @@ -342,6 +342,22 @@ public function isMakeInstance() return $this->instanceFromPk; } + /** + * @return bool + */ + public function isMakeInstanceCreate() + { + return $this->getVerb() === Route::POST && !$this->instanceForceFetch; + } + + /** + * @return bool + */ + public function isMakeInstanceFetch() + { + return !$this->isMakeInstanceCreate(); + } + /** * @param bool $forceFetch *