GuidType.php 680 Bytes
Newer Older
1 2
<?php

Michael Moravec's avatar
Michael Moravec committed
3 4
declare(strict_types=1);

5 6 7 8 9
namespace Doctrine\DBAL\Types;

use Doctrine\DBAL\Platforms\AbstractPlatform;

/**
Pascal Borreli's avatar
Pascal Borreli committed
10
 * Represents a GUID/UUID datatype (both are actually synonyms) in the database.
11 12 13
 */
class GuidType extends StringType
{
Benjamin Morel's avatar
Benjamin Morel committed
14 15 16
    /**
     * {@inheritdoc}
     */
17
    public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) : string
18
    {
19
        return $platform->getGuidTypeDeclarationSQL($fieldDeclaration);
20
    }
21

22
    public function getName() : string
23
    {
24
        return Types::GUID;
25
    }
26

27
    public function requiresSQLCommentHint(AbstractPlatform $platform) : bool
28
    {
29
        return ! $platform->hasNativeGuidType();
30
    }
31
}