1 | <?php |
||
13 | class ObjectBeanPropertyDescriptor extends AbstractBeanPropertyDescriptor |
||
14 | { |
||
15 | /** |
||
16 | * @var ForeignKeyConstraint |
||
17 | */ |
||
18 | private $foreignKey; |
||
19 | |||
20 | /** |
||
21 | * @var SchemaAnalyzer |
||
22 | */ |
||
23 | private $schemaAnalyzer; |
||
24 | |||
25 | /** |
||
26 | * ObjectBeanPropertyDescriptor constructor. |
||
27 | * @param Table $table |
||
28 | * @param ForeignKeyConstraint $foreignKey |
||
29 | * @param SchemaAnalyzer $schemaAnalyzer |
||
30 | * @param NamingStrategyInterface $namingStrategy |
||
31 | */ |
||
32 | public function __construct(Table $table, ForeignKeyConstraint $foreignKey, SchemaAnalyzer $schemaAnalyzer, NamingStrategyInterface $namingStrategy) |
||
38 | |||
39 | /** |
||
40 | * Returns the foreignkey the column is part of, if any. null otherwise. |
||
41 | * |
||
42 | * @return ForeignKeyConstraint|null |
||
43 | */ |
||
44 | public function getForeignKey() |
||
48 | |||
49 | /** |
||
50 | * Returns the name of the class linked to this property or null if this is not a foreign key. |
||
51 | * |
||
52 | * @return null|string |
||
53 | */ |
||
54 | public function getClassName(): ?string |
||
58 | |||
59 | /** |
||
60 | * Returns the PHP type for the property (it can be a scalar like int, bool, or class names, like \DateTimeInterface, App\Bean\User....) |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | public function getPhpType(): string |
||
68 | |||
69 | |||
70 | /** |
||
71 | * Returns the param annotation for this property (useful for constructor). |
||
72 | * |
||
73 | * @return string |
||
74 | */ |
||
75 | public function getParamAnnotation() |
||
81 | |||
82 | /** |
||
83 | * Returns true if the property is compulsory (and therefore should be fetched in the constructor). |
||
84 | * |
||
85 | * @return bool |
||
86 | */ |
||
87 | public function isCompulsory() |
||
101 | |||
102 | /** |
||
103 | * Returns true if the property has a default value. |
||
104 | * |
||
105 | * @return bool |
||
106 | */ |
||
107 | public function hasDefault() |
||
111 | |||
112 | /** |
||
113 | * Returns the code that assigns a value to its default value. |
||
114 | * |
||
115 | * @return string |
||
116 | * |
||
117 | * @throws \TDBMException |
||
118 | */ |
||
119 | public function assignToDefaultCode() |
||
123 | |||
124 | /** |
||
125 | * Returns true if the property is the primary key. |
||
126 | * |
||
127 | * @return bool |
||
128 | */ |
||
129 | public function isPrimaryKey() |
||
139 | |||
140 | /** |
||
141 | * Returns the PHP code for getters and setters. |
||
142 | * |
||
143 | * @return string |
||
144 | */ |
||
145 | public function getGetterSetterCode() |
||
178 | |||
179 | /** |
||
180 | * Returns the part of code useful when doing json serialization. |
||
181 | * |
||
182 | * @return string |
||
183 | */ |
||
184 | public function getJsonSerializeCode() |
||
192 | |||
193 | /** |
||
194 | * The code to past in the __clone method. |
||
195 | * @return null|string |
||
196 | */ |
||
197 | public function getCloneRule(): ?string |
||
201 | } |
||
202 |