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

getDatabaseFieldMappings() protected method

Returns database field mappings.
protected getDatabaseFieldMappings ( Doctrine\ORM\Mapping\ClassMetadata $cm ) : array
$cm Doctrine\ORM\Mapping\ClassMetadata
return array
    protected function getDatabaseFieldMappings(ClassMetadata $cm)
    {
        $fieldMappings = [];
        $fields = $cm->getFieldNames();
        foreach ($fields as $field) {
            $currentMapping = $cm->getFieldMapping($field);
            $asserts = $this->getExtJSAssertMappings($cm, $field);
            if ($currentMapping['fieldName'] == 'id') {
                $currentMapping['fieldName'] = '@id';
                $currentMapping['type'] = 'string';
            }
            $fieldMappings[] = ['name' => $currentMapping['fieldName'], 'type' => $this->getExtJSFieldMapping($currentMapping['type']), 'validators' => json_encode($asserts), 'persist' => $this->allowPersist($cm, $field)];
        }
        return $fieldMappings;
    }