From 0845377300a09c0d97b1e00edaf13b4c6ce7edc1 Mon Sep 17 00:00:00 2001 From: Julius Beckmann Date: Fri, 20 Dec 2013 12:58:34 +0100 Subject: [PATCH] Use only JMS/GroupExclusion if groups are there When no groups are given in the ApiDoc, there should be no GroupExclusion and the Entity should be parsed wihtout exclusions. Otherwise only the "Default" group of the Entity would be parsed, which may not be used. The ApiDoc should not enforce the Entity to be grouped with "Default", to generate a "full-view" of it. --- Parser/JmsMetadataParser.php | 4 +++- Tests/Parser/JmsMetadataParserTest.php | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Parser/JmsMetadataParser.php b/Parser/JmsMetadataParser.php index 3fcdb4f..b2c3bac 100644 --- a/Parser/JmsMetadataParser.php +++ b/Parser/JmsMetadataParser.php @@ -98,7 +98,9 @@ class JmsMetadataParser implements ParserInterface } $exclusionStrategies = array(); - $exclusionStrategies[] = new GroupsExclusionStrategy($groups); + if ($groups) { + $exclusionStrategies[] = new GroupsExclusionStrategy($groups); + } $params = array(); diff --git a/Tests/Parser/JmsMetadataParserTest.php b/Tests/Parser/JmsMetadataParserTest.php index 3e41883..880596f 100644 --- a/Tests/Parser/JmsMetadataParserTest.php +++ b/Tests/Parser/JmsMetadataParserTest.php @@ -169,6 +169,14 @@ class JmsMetadataParserTest extends \PHPUnit_Framework_TestCase 'sinceVersion' => null, 'untilVersion' => null, ), + 'baz' => array( + 'dataType' => 'string', + 'required' => false, + 'description' => null, + 'readonly' => false, + 'sinceVersion' => null, + 'untilVersion' => null, + ), ), $output );