Skip to content

Commit ea2fb10

Browse files
authored
Merge pull request #397 from Strate/issue_367
#367 Exclude annotation not preventing attempt to find public methods when using AccessType
2 parents e0704d3 + b7b1d80 commit ea2fb10

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/JMS/Serializer/Metadata/Driver/AnnotationDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,10 @@ public function loadMetadataForClass(\ReflectionClass $class)
214214
}
215215
}
216216

217-
$propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]);
218217

219218
if ((ExclusionPolicy::NONE === $exclusionPolicy && ! $isExclude)
220219
|| (ExclusionPolicy::ALL === $exclusionPolicy && $isExpose)) {
220+
$propertyMetadata->setAccessor($accessType, $accessor[0], $accessor[1]);
221221
$classMetadata->addPropertyMetadata($propertyMetadata);
222222
}
223223
}

tests/JMS/Serializer/Tests/Fixtures/GetSetObject.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
namespace JMS\Serializer\Tests\Fixtures;
2020

2121
use JMS\Serializer\Annotation\AccessType;
22+
use JMS\Serializer\Annotation\Exclude;
2223
use JMS\Serializer\Annotation\Type;
2324
use JMS\Serializer\Annotation\ReadOnly;
2425

@@ -36,6 +37,12 @@ class GetSetObject
3637
*/
3738
private $readOnlyProperty = 42;
3839

40+
/**
41+
* This property should be exlcluded
42+
* @Exclude()
43+
*/
44+
private $excludedProperty;
45+
3946
public function getId()
4047
{
4148
throw new \RuntimeException('This should not be called.');

0 commit comments

Comments
 (0)