-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypeInterface.php
More file actions
72 lines (63 loc) · 1.68 KB
/
TypeInterface.php
File metadata and controls
72 lines (63 loc) · 1.68 KB
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
<?php
namespace Bdf\Prime\Types;
/**
* Database type representation
*
* Types should check if the platform native accept the type,
* If not, it should convert-it
*/
interface TypeInterface
{
public const TARRAY = 'array';
public const ARRAY_OBJECT = 'array_object';
public const JSON = 'json';
public const OBJECT = 'object';
public const BOOLEAN = 'boolean';
public const TINYINT = 'tinyint';
public const SMALLINT = 'smallint';
public const INTEGER = 'integer';
public const BIGINT = 'bigint';
public const DOUBLE = 'double';
public const FLOAT = 'float';
public const DECIMAL = 'decimal';
public const STRING = 'string';
public const TEXT = 'text';
public const BLOB = 'blob';
public const BINARY = 'binary';
public const GUID = 'guid';
public const DATETIME = 'datetime';
public const DATETIMETZ = 'datetimetz';
public const DATE = 'date';
public const TIME = 'time';
public const TIMESTAMP = 'timestamp';
/**
* Transform database value to PHP value
*
* @param mixed $value
* @param array $fieldOptions
*
* @return mixed
*/
public function fromDatabase($value, array $fieldOptions = []);
/**
* Transform PHP value to database value.
* The type SHOULD supports value that is already normalized to database
*
* @param mixed $value
*
* @return mixed
*/
public function toDatabase($value);
/**
* Get the type name
*
* @return string
*/
public function name(): string;
/**
* Get the php type name that map this type
*
* @return string
*/
public function phpType(): string;
}