File: Column.php

package info (click to toggle)
doctrine 2.14.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,612 kB
  • sloc: php: 113,660; xml: 4,630; makefile: 28; sh: 14
file content (137 lines) | stat: -rw-r--r-- 2,937 bytes parent folder | download
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php

declare(strict_types=1);

namespace Doctrine\ORM\Mapping;

use Attribute;
use BackedEnum;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
 * @Annotation
 * @NamedArgumentConstructor
 * @Target({"PROPERTY","ANNOTATION"})
 */
#[Attribute(Attribute::TARGET_PROPERTY)]
final class Column implements MappingAttribute
{
    /**
     * @var string|null
     * @readonly
     */
    public $name;

    /**
     * @var mixed
     * @readonly
     */
    public $type;

    /**
     * @var int|null
     * @readonly
     */
    public $length;

    /**
     * The precision for a decimal (exact numeric) column (Applies only for decimal column).
     *
     * @var int|null
     * @readonly
     */
    public $precision = 0;

    /**
     * The scale for a decimal (exact numeric) column (Applies only for decimal column).
     *
     * @var int|null
     * @readonly
     */
    public $scale = 0;

    /**
     * @var bool
     * @readonly
     */
    public $unique = false;

    /**
     * @var bool
     * @readonly
     */
    public $nullable = false;

    /**
     * @var bool
     * @readonly
     */
    public $insertable = true;

    /**
     * @var bool
     * @readonly
     */
    public $updatable = true;

    /**
     * @var class-string<BackedEnum>|null
     * @readonly
     */
    public $enumType = null;

    /**
     * @var array<string,mixed>
     * @readonly
     */
    public $options = [];

    /**
     * @var string|null
     * @readonly
     */
    public $columnDefinition;

    /**
     * @var string|null
     * @readonly
     * @psalm-var 'NEVER'|'INSERT'|'ALWAYS'|null
     * @Enum({"NEVER", "INSERT", "ALWAYS"})
     */
    public $generated;

    /**
     * @param class-string<BackedEnum>|null $enumType
     * @param array<string,mixed>           $options
     * @psalm-param 'NEVER'|'INSERT'|'ALWAYS'|null $generated
     */
    public function __construct(
        ?string $name = null,
        ?string $type = null,
        ?int $length = null,
        ?int $precision = null,
        ?int $scale = null,
        bool $unique = false,
        bool $nullable = false,
        bool $insertable = true,
        bool $updatable = true,
        ?string $enumType = null,
        array $options = [],
        ?string $columnDefinition = null,
        ?string $generated = null
    ) {
        $this->name             = $name;
        $this->type             = $type;
        $this->length           = $length;
        $this->precision        = $precision;
        $this->scale            = $scale;
        $this->unique           = $unique;
        $this->nullable         = $nullable;
        $this->insertable       = $insertable;
        $this->updatable        = $updatable;
        $this->enumType         = $enumType;
        $this->options          = $options;
        $this->columnDefinition = $columnDefinition;
        $this->generated        = $generated;
    }
}