Issues (265)

src/ColumnInterface.php (1 issue)

1
<?php
2
3
/**
4
 * This file is part of Cycle ORM package.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
declare(strict_types=1);
11
12
namespace Cycle\Database;
13
14
/**
15
 * Represents table schema column abstraction.
16
 *
17
 * @method string getComment() Get column comment.
18
 *         An empty string will be returned if the feature is not supported by the driver.
19
 */
20
interface ColumnInterface
21
{
22
    /**
23
     * PHP types for phpType() method.
24
     */
25
    public const INT = 'int';
26
27
    public const BOOL = 'bool';
28
    public const STRING = 'string';
29
    public const FLOAT = 'float';
30
31
    /**
32
     * Get element name (unquoted).
33
     *
34
     * @return non-empty-string
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string.
Loading history...
35
     */
36
    public function getName(): string;
37
38
    /**
39
     * Internal database type, can vary based on database driver.
40
     */
41
    public function getInternalType(): string;
42
43
    /**
44
     * DBMS specific reverse mapping must map database specific type into limited set of abstract
45
     * types. Value depends on driver implementation.
46
     */
47
    public function getAbstractType(): string;
48
49
    /**
50
     * Must return PHP type column value can be better mapped into: int, bool, string or float.
51
     */
52
    public function getType(): string;
53
54
    /**
55
     * Column size.
56
     */
57
    public function getSize(): int;
58
59
    /**
60
     * Column precision.
61
     */
62
    public function getPrecision(): int;
63
64
    /**
65
     * Column scale value.
66
     */
67
    public function getScale(): int;
68
69
    /**
70
     * Can column store null value?
71
     */
72
    public function isNullable(): bool;
73
74
    /**
75
     * Indication that column has default value.
76
     */
77
    public function hasDefaultValue(): bool;
78
79
    /**
80
     * Get column default value, value must be automatically converted to appropriate internal type.
81
     */
82
    public function getDefaultValue(): mixed;
83
}
84