I found a class that adds custom type to Doctrine annotation (TINYINT):
<?php
namespace AppBundle\Doctrine\DBAL\Types;
use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Platforms\AbstractPlatform;
class Tinyint extends Type
{
const TINYINT = 'tinyint';
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
$fieldDeclaration = array_merge([
'length' => 1,
], $fieldDeclaration);
return sprintf("TINYINT(%d)",
$fieldDeclaration['length']
);
}
public function convertToPHPValue($value, AbstractPlatform $platform)
{
return (int) $value;
}
public function convertToDatabaseValue($value, AbstractPlatform $platform)
{
return (int) $value;
}
public function getName()
{
return self::TINYINT;
}
public function getBindingType()
{
return \PDO::PARAM_INT;
}
}
But there's only an example of how to add it to Symfony. I need to do this using the SlimPHP Framework...
Maybe someone else has had the same experience!?