summaryrefslogtreecommitdiff
path: root/vendor/doctrine/dbal/src/Portability/Result.php
blob: d158683c1dc9b6d98a623c018a19b94f87c02bf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php

declare(strict_types=1);

namespace Doctrine\DBAL\Portability;

use Doctrine\DBAL\Driver\Middleware\AbstractResultMiddleware;
use Doctrine\DBAL\Driver\Result as ResultInterface;

final class Result extends AbstractResultMiddleware
{
    /** @internal The result can be only instantiated by the portability connection or statement. */
    public function __construct(ResultInterface $result, private readonly Converter $converter)
    {
        parent::__construct($result);
    }

    public function fetchNumeric(): array|false
    {
        return $this->converter->convertNumeric(
            parent::fetchNumeric(),
        );
    }

    public function fetchAssociative(): array|false
    {
        return $this->converter->convertAssociative(
            parent::fetchAssociative(),
        );
    }

    public function fetchOne(): mixed
    {
        return $this->converter->convertOne(
            parent::fetchOne(),
        );
    }

    /**
     * {@inheritDoc}
     */
    public function fetchAllNumeric(): array
    {
        return $this->converter->convertAllNumeric(
            parent::fetchAllNumeric(),
        );
    }

    /**
     * {@inheritDoc}
     */
    public function fetchAllAssociative(): array
    {
        return $this->converter->convertAllAssociative(
            parent::fetchAllAssociative(),
        );
    }

    /**
     * {@inheritDoc}
     */
    public function fetchFirstColumn(): array
    {
        return $this->converter->convertFirstColumn(
            parent::fetchFirstColumn(),
        );
    }
}