<commit_before><?php

namespace Kpicaza\GenBundle\Formatter;

use Doctrine\ORM\Mapping\ClassMetadataInfo;

/**
 * Class FieldFormatter
 * @package Kpicaza\GenBundle\Formatter
 */
class FieldFormatter
{
    
    /**
     * @param $mappings
     * @param $associationMappings
     * @return mixed
     */
    public function formatMappingsWithRelations($mappings, $associationMappings)
    {
        $formattedMappings = $this->formatMappings($mappings);

        return $this->formatRelationMappings($formattedMappings, $associationMappings);

    }

    /**
     * @param $mappings
     * @return mixed
     */
    public function formatMappings($mappings)
    {
        $types = $this->getTypes();

        foreach ($mappings as $key => $mapping) {
            $mappings[$key] = $types[$mappings[$key]['type']];
        }

        return $mappings;
    }

    /**
     * @param $mappings
     * @param $associationMappings
     * @return mixed
     */
    protected function formatRelationMappings($mappings, $associationMappings)
    {
        $types = $this->getTypes();

        foreach ($associationMappings as $fieldName => $relation) {
            if ($relation['type'] !== ClassMetadataInfo::ONE_TO_MANY) {
                $mappings[sprintf('%s_%s', $fieldName, 'id')] = $types['string'];
            }
        }

        return $mappings;
    }

    /**
     * @return array
     */
    protected function getTypes()
    {
        return array(
            'string' => 'Type\\TextType::class',
            'text' => 'Type\\TextareaType::class',
            'datetime' => 'Type\\DateTimeType::class',
            'integer' => 'Type\\NumberType::class',
        );
    }

}<commit_msg>+ Add support for boolen form types<commit_after><?php

namespace Kpicaza\GenBundle\Formatter;

use Doctrine\ORM\Mapping\ClassMetadataInfo;

/**
 * Class FieldFormatter
 * @package Kpicaza\GenBundle\Formatter
 */
class FieldFormatter
{
    
    /**
     * @param $mappings
     * @param $associationMappings
     * @return mixed
     */
    public function formatMappingsWithRelations($mappings, $associationMappings)
    {
        $formattedMappings = $this->formatMappings($mappings);

        return $this->formatRelationMappings($formattedMappings, $associationMappings);

    }

    /**
     * @param $mappings
     * @return mixed
     */
    public function formatMappings($mappings)
    {
        $types = $this->getTypes();

        foreach ($mappings as $key => $mapping) {
            $mappings[$key] = $types[$mappings[$key]['type']];
        }

        return $mappings;
    }

    /**
     * @param $mappings
     * @param $associationMappings
     * @return mixed
     */
    protected function formatRelationMappings($mappings, $associationMappings)
    {
        $types = $this->getTypes();

        foreach ($associationMappings as $fieldName => $relation) {
            if ($relation['type'] !== ClassMetadataInfo::ONE_TO_MANY) {
                $mappings[sprintf('%s_%s', $fieldName, 'id')] = $types['string'];
            }
        }

        return $mappings;
    }

    /**
     * @return array
     */
    protected function getTypes()
    {
        return array(
            'string' => 'Type\\TextType::class',
            'text' => 'Type\\TextareaType::class',
            'datetime' => 'Type\\DateTimeType::class',
            'integer' => 'Type\\NumberType::class',
            'boolean' => 'Type\\NumberType::class',
        );
    }

}
{'fraction_non_alphanumeric': 0.14517061885482938, 'fraction_numerical': 0.0, 'mean_word_length': 2.31957773512476, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4304400', 'n_tokens_mistral': 1026, 'n_tokens_neox': 1010, 'n_words': 178}