1 | <?php |
||
11 | class EntityProperty |
||
12 | { |
||
13 | |||
14 | /** |
||
15 | * @var string Entity property type |
||
16 | */ |
||
17 | protected $type; |
||
18 | |||
19 | // @todo Should be aware of the column type length to avoid truncation or even query errors |
||
20 | |||
21 | /** |
||
22 | * @param string $type |
||
23 | */ |
||
24 | 1 | public function __construct(string $type) |
|
28 | |||
29 | /** |
||
30 | * Format value according to entity property type |
||
31 | * |
||
32 | * @param mixed $value Value |
||
33 | * |
||
34 | * @return mixed Value |
||
35 | */ |
||
36 | 5 | public function formatValueForEntity($value) |
|
60 | |||
61 | /** |
||
62 | * Format value for insertion into the database |
||
63 | * |
||
64 | * @param mixed $value Value |
||
65 | * |
||
66 | * @return mixed Value |
||
67 | */ |
||
68 | 2 | public function formatValueForDatabase($value) |
|
88 | } |
||
89 |