From e87494bbadfaf1b15562acee5cf641d06f208f5a Mon Sep 17 00:00:00 2001 From: Xenofon Spafaridis Date: Mon, 7 Nov 2016 20:24:13 +0200 Subject: [PATCH] Allow empty [] when using PATCH TO_MANY relationship Fixes #54 --- src/Controller/POST.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Controller/POST.php b/src/Controller/POST.php index a8b2bb3..fa7ec1c 100644 --- a/src/Controller/POST.php +++ b/src/Controller/POST.php @@ -411,7 +411,7 @@ protected static function getParsedRelationshipAttributes( } elseif ($relationship->type == Relationship::TYPE_TO_MANY) { $parsedValues = []; - if (!is_array($relationshipData)) { + if (!is_array($relationshipData) && (count((array) $relationshipData) > 0)) { throw new RequestException(sprintf( 'Expected data to be an array for relationship "%s"', $relationshipKey