commit ae391b4db0c40bfe7094c48e35d15edcfd88ee32
parent c670e0e3825eaf30af128b8dc1b5faf007953d65
Author: Felicia Hummel <felicia@partkeepr.com>
Date: Mon, 30 Jan 2017 15:03:11 +0100
Allow virtual fields to be persisted, fixes #750
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/PartKeepr/DoctrineReflectionBundle/Services/ReflectionService.php b/src/PartKeepr/DoctrineReflectionBundle/Services/ReflectionService.php
@@ -207,8 +207,9 @@ class ReflectionService
if ($virtualFieldAnnotation !== null) {
$fieldMappings[] = [
- 'name' => $property->getName(),
- 'type' => $this->getExtJSFieldMapping($virtualFieldAnnotation->type),
+ 'persist' => true,
+ 'name' => $property->getName(),
+ 'type' => $this->getExtJSFieldMapping($virtualFieldAnnotation->type),
];
}
}
@@ -357,9 +358,9 @@ class ReflectionService
public function allowPersist(ClassMetadata $cm, $field)
{
$groupsAnnotation = $this->reader->getPropertyAnnotation(
- $cm->getReflectionProperty($field),
- 'Symfony\Component\Serializer\Annotation\Groups'
- );
+ $cm->getReflectionProperty($field),
+ 'Symfony\Component\Serializer\Annotation\Groups'
+ );
if ($groupsAnnotation !== null) {
if (in_array("readonly", $groupsAnnotation->getGroups())) {