mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 18:43:49 +00:00
set doctrine type "date interval" using native postgresql date interval
This commit is contained in:
27
Doctrine/Type/NativeDateIntervalType.php
Normal file
27
Doctrine/Type/NativeDateIntervalType.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\MainBundle\Doctrine\Type;
|
||||
|
||||
use Doctrine\DBAL\Types\DateIntervalType;
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
|
||||
/**
|
||||
* Re-declare the date interval to use the implementation of date interval in
|
||||
* postgreql
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class NativeDateIntervalType extends DateIntervalType
|
||||
{
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return \Doctrine\DBAL\Types\Type::DATEINTERVAL;
|
||||
}
|
||||
|
||||
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string
|
||||
{
|
||||
return 'INTERVAL';
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user