src/MappingHelper.php
public static function setSimpleDecimalFields(
        array $fields,
        ClassMetadataBuilder $builder,
        $default = null
    ): void {
        if (null !== $default && !\is_string($default)) {
            throw new \InvalidArgumentException(
                'Invalid default value ' . $default
                . ' with type ' . self::getType($default)
            );
        }
        if (null !== $default && !is_numeric($default)) {
            throw new \InvalidArgumentException(
                'Invalid default value ' . $default
                . ', even though it is a string, it must be numeric '
            );
        }
        foreach ($fields as $field) {
            $fieldBuilder = new FieldBuilder(
                $builder,
                [
                    'fieldName' => $field,
                    'type'      => Type::DECIMAL,
                    'default'   => (string)(float)$default,
                ]
            );
            $fieldBuilder
                ->columnName(self::getColumnNameForField($field))
                ->nullable(null === $default)
                ->precision(Database::MAX_DECIMAL_PRECISION)
                ->scale(Database::MAX_DECIMAL_SCALE)
                ->build();
        }
    }
public static function setSimpleDecimalFields(
        array $fields,
        ClassMetadataBuilder $builder,
        $default = null
    ): void {
        if (null !== $default && !\is_string($default)) {
            throw new \InvalidArgumentException(
                'Invalid default value ' . $default
                . ' with type ' . self::getType($default)
            );
        }
        if (null !== $default && !is_numeric($default)) {
            throw new \InvalidArgumentException(
                'Invalid default value ' . $default
                . ', even though it is a string, it must be numeric '
            );
        }
        foreach ($fields as $field) {
            $fieldBuilder = new FieldBuilder(
                $builder,
                [
                    'fieldName' => $field,
                    'type'      => Type::DECIMAL,
                    'default'   => (string)(float)$default,
                ]
            );
            $fieldBuilder
                ->columnName(self::getColumnNameForField($field))
                ->nullable(null === $default)
                ->precision(Database::MAX_DECIMAL_PRECISION)
                ->scale(Database::MAX_DECIMAL_SCALE)
                ->build();
        }
    }
public static function setSimpleDecimalFields ( array $ fields , ClassMetadataBuilder $ builder , $ default = null ) : void { if ( null !== $ default && ! \ is_string ( $ default ) ) { throw new \ InvalidArgumentException ( 'Invalid default value ' . $ default . ' with type ' . self :: getType ( $ default ) ) ; } if ( null !== $ default && ! is_numeric ( $ default ) ) { throw new \ InvalidArgumentException ( 'Invalid default value ' . $ default . ', even though it is a string, it must be numeric ' ) ; } foreach ( $ fields as $ field ) { $ fieldBuilder = new FieldBuilder ( $ builder , [ 'fieldName' => $ field , 'type' => Type :: DECIMAL , 'default' => ( string ) ( float ) $ default , ] ) ; $ fieldBuilder -> columnName ( self :: getColumnNameForField ( $ field ) ) -> nullable ( null === $ default ) -> precision ( Database :: MAX_DECIMAL_PRECISION ) -> scale ( Database :: MAX_DECIMAL_SCALE ) -> build ( ) ; } }
Set bog standard decimal fields quickly in bulk

@param array                $fields
@param ClassMetadataBuilder $builder
@param mixed                $default
In this case the boolean argument is simply data
@SuppressWarnings(PHPMD.BooleanArgumentFlag)
Set bog standard decimal fields quickly in bulk