PartKeepr\DoctrineReflectionBundle\Services\ReflectionService::allowPersist PHP Method

allowPersist() public method

public allowPersist ( Doctrine\ORM\Mapping\ClassMetadata $cm, $field )
$cm Doctrine\ORM\Mapping\ClassMetadata
    public function allowPersist(ClassMetadata $cm, $field)
    {
        $groupsAnnotation = $this->reader->getPropertyAnnotation($cm->getReflectionProperty($field), 'Symfony\\Component\\Serializer\\Annotation\\Groups');
        if ($groupsAnnotation !== null) {
            if (in_array("readonly", $groupsAnnotation->getGroups())) {
                return false;
            }
        }
        return true;
    }