Completed
Pull Request — 3.x (#928)
by
unknown
02:24 queued 11s
created

UuidBinaryType::convertToDatabaseValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\DoctrineORMAdminBundle\Tests\Fixtures\DoctrineType;
13
14
use Doctrine\DBAL\Platforms\AbstractPlatform;
15
use Doctrine\DBAL\Types\StringType;
16
use Sonata\DoctrineORMAdminBundle\Tests\Fixtures\Util\NonIntegerIdentifierTestClass;
17
18
/**
19
 * Mock for a custom doctrine type used in the ModelManagerTest suite.
20
 *
21
 * @author Jeroen Thora <[email protected]>
22
 */
23
class UuidBinaryType extends StringType
24
{
25
    const NAME = 'uuid_binary';
26
27
    public function getName()
28
    {
29
        return self::NAME;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function convertToPHPValue($value, AbstractPlatform $platform)
36
    {
37
        return !empty($value) ? new NonIntegerIdentifierTestClass($value->toString()) : null;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function convertToDatabaseValue($value, AbstractPlatform $platform)
44
    {
45
        return $value->toString();
46
    }
47
}
48