application/Espo/Core/Utils/Database/Orm/Converter.php
protected function convertFields($entityName, &$entityMetadata)
    {
        //List of unmerged fields with default field defenitions in $outputMeta
        $unmergedFields = array(
            'name',
        );

        $outputMeta = array(
            'id' => array(
                'type' => Entity::ID,
                'dbType' => 'varchar'
            ),
            'name' => array(
                'type' => isset($entityMetadata['fields']['name']['type']) ? $entityMetadata['fields']['name']['type'] : Entity::VARCHAR,
                'notStorable' => true
            ),
            'deleted' => array(
                'type' => Entity::BOOL,
                'default' => false
            )
        );

        foreach ($entityMetadata['fields'] as $fieldName => $fieldParams) {
            if (empty($fieldParams['type'])) continue;

            /** check if "fields" option exists in $fieldMeta */
            $fieldTypeMetadata = $this->getMetadataHelper()->getFieldDefsByType($fieldParams);

            $fieldDefs = $this->convertField($entityName, $fieldName, $fieldParams, $fieldTypeMetadata);

            if ($fieldDefs !== false) {
                //push fieldDefs to the ORM metadata array
                if (isset($outputMeta[$fieldName]) && !in_array($fieldName, $unmergedFields)) {
                    $outputMeta[$fieldName] = array_merge($outputMeta[$fieldName], $fieldDefs);
                } else {
                    $outputMeta[$fieldName] = $fieldDefs;
                }
            }

            /** check and set the linkDefs from 'fields' metadata */
            if (isset($fieldTypeMetadata['linkDefs'])) {
                $linkDefs = $this->getMetadataHelper()->getLinkDefsInFieldMeta($entityName, $fieldParams, $fieldTypeMetadata['linkDefs']);
                if (isset($linkDefs)) {
                    if (!isset($entityMetadata['links'])) {
                        $entityMetadata['links'] = array();
                    }
                    $entityMetadata['links'] = Util::merge( array($fieldName => $linkDefs), $entityMetadata['links'] );
                }
            }
        }

        return $outputMeta;
    }
protected function convertFields($entityName, &$entityMetadata)
    {
        //List of unmerged fields with default field defenitions in $outputMeta
        $unmergedFields = array(
            'name',
        );

        $outputMeta = array(
            'id' => array(
                'type' => Entity::ID,
                'dbType' => 'varchar'
            ),
            'name' => array(
                'type' => isset($entityMetadata['fields']['name']['type']) ? $entityMetadata['fields']['name']['type'] : Entity::VARCHAR,
                'notStorable' => true
            ),
            'deleted' => array(
                'type' => Entity::BOOL,
                'default' => false
            )
        );

        foreach ($entityMetadata['fields'] as $fieldName => $fieldParams) {
            if (empty($fieldParams['type'])) continue;

            /** check if "fields" option exists in $fieldMeta */
            $fieldTypeMetadata = $this->getMetadataHelper()->getFieldDefsByType($fieldParams);

            $fieldDefs = $this->convertField($entityName, $fieldName, $fieldParams, $fieldTypeMetadata);

            if ($fieldDefs !== false) {
                //push fieldDefs to the ORM metadata array
                if (isset($outputMeta[$fieldName]) && !in_array($fieldName, $unmergedFields)) {
                    $outputMeta[$fieldName] = array_merge($outputMeta[$fieldName], $fieldDefs);
                } else {
                    $outputMeta[$fieldName] = $fieldDefs;
                }
            }

            /** check and set the linkDefs from 'fields' metadata */
            if (isset($fieldTypeMetadata['linkDefs'])) {
                $linkDefs = $this->getMetadataHelper()->getLinkDefsInFieldMeta($entityName, $fieldParams, $fieldTypeMetadata['linkDefs']);
                if (isset($linkDefs)) {
                    if (!isset($entityMetadata['links'])) {
                        $entityMetadata['links'] = array();
                    }
                    $entityMetadata['links'] = Util::merge( array($fieldName => $linkDefs), $entityMetadata['links'] );
                }
            }
        }

        return $outputMeta;
    }
protected function convertFields ( $ entityName , & $ entityMetadata ) { //List of unmerged fields with default field defenitions in $outputMeta $ unmergedFields = array ( 'name' , ) ; $ outputMeta = array ( 'id' => array ( 'type' => Entity :: ID , 'dbType' => 'varchar' ) , 'name' => array ( 'type' => isset ( $ entityMetadata [ 'fields' ] [ 'name' ] [ 'type' ] ) ? $ entityMetadata [ 'fields' ] [ 'name' ] [ 'type' ] : Entity :: VARCHAR , 'notStorable' => true ) , 'deleted' => array ( 'type' => Entity :: BOOL , 'default' => false ) ) ; foreach ( $ entityMetadata [ 'fields' ] as $ fieldName => $ fieldParams ) { if ( empty ( $ fieldParams [ 'type' ] ) ) continue ; /** check if "fields" option exists in $fieldMeta */ $ fieldTypeMetadata = $ this -> getMetadataHelper ( ) -> getFieldDefsByType ( $ fieldParams ) ; $ fieldDefs = $ this -> convertField ( $ entityName , $ fieldName , $ fieldParams , $ fieldTypeMetadata ) ; if ( $ fieldDefs !== false ) { //push fieldDefs to the ORM metadata array if ( isset ( $ outputMeta [ $ fieldName ] ) && ! in_array ( $ fieldName , $ unmergedFields ) ) { $ outputMeta [ $ fieldName ] = array_merge ( $ outputMeta [ $ fieldName ] , $ fieldDefs ) ; } else { $ outputMeta [ $ fieldName ] = $ fieldDefs ; } } /** check and set the linkDefs from 'fields' metadata */ if ( isset ( $ fieldTypeMetadata [ 'linkDefs' ] ) ) { $ linkDefs = $ this -> getMetadataHelper ( ) -> getLinkDefsInFieldMeta ( $ entityName , $ fieldParams , $ fieldTypeMetadata [ 'linkDefs' ] ) ; if ( isset ( $ linkDefs ) ) { if ( ! isset ( $ entityMetadata [ 'links' ] ) ) { $ entityMetadata [ 'links' ] = array ( ) ; } $ entityMetadata [ 'links' ] = Util :: merge ( array ( $ fieldName => $ linkDefs ) , $ entityMetadata [ 'links' ] ) ; } } } return $ outputMeta ; }
Metadata conversion from Espo format into Doctrine

@param string $entityName
@param array $entityMetadata

@return array
Metadata conversion from Espo format into Doctrine