Commit 9f8bc8bf authored by Bernhard Schussek's avatar Bernhard Schussek

Added integer_array type

parent 3a86b753
......@@ -29,12 +29,7 @@ class FloatArrayType extends ArrayType
{
$convertedValue = parent::convertToPHPValue($value, $platform);
return array_map(
function (string $value): string {
return trim($value, '"');
},
$convertedValue
);
return array_map('floatval', $convertedValue);
}
/**
......
<?php
/*
* This file is part of the CWD Data Doctrine ORM Bundle
*
* (c) cwd.at GmbH <office@cwd.at>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Cwd\DataDoctrineORMBundle\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
/**
* An array of integers.
*/
class IntegerArrayType extends ArrayType
{
use GeneratedName;
/**
* {@inheritdoc}
*/
public function convertToPHPValue($value, AbstractPlatform $platform)
{
$convertedValue = parent::convertToPHPValue($value, $platform);
return array_map('intval', $convertedValue);
}
/**
* {@inheritdoc}
*/
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
return 'INT[]';
}
/**
* {@inheritdoc}
*/
public function getMappedDatabaseTypes(AbstractPlatform $platform)
{
return ['_int'];
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment