1 | <?php |
||
10 | abstract class AbstractBeanPropertyDescriptor |
||
11 | { |
||
12 | /** |
||
13 | * @var Table |
||
14 | */ |
||
15 | protected $table; |
||
16 | |||
17 | /** |
||
18 | * Whether to use the more complex name in case of conflict. |
||
19 | * |
||
20 | * @var bool |
||
21 | */ |
||
22 | protected $alternativeName = false; |
||
23 | /** |
||
24 | * @var NamingStrategyInterface |
||
25 | */ |
||
26 | protected $namingStrategy; |
||
27 | |||
28 | /** |
||
29 | * @param Table $table |
||
30 | * @param NamingStrategyInterface $namingStrategy |
||
31 | */ |
||
32 | public function __construct(Table $table, NamingStrategyInterface $namingStrategy) |
||
37 | |||
38 | /** |
||
39 | * Use the more complex name in case of conflict. |
||
40 | */ |
||
41 | public function useAlternativeName() |
||
45 | |||
46 | /** |
||
47 | * Returns the name of the class linked to this property or null if this is not a foreign key. |
||
48 | * |
||
49 | * @return null|string |
||
50 | */ |
||
51 | abstract public function getClassName(); |
||
52 | |||
53 | /** |
||
54 | * Returns the param annotation for this property (useful for constructor). |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | abstract public function getParamAnnotation(); |
||
59 | |||
60 | public function getVariableName() |
||
64 | |||
65 | public function getSetterName() |
||
69 | |||
70 | public function getGetterName() |
||
74 | |||
75 | /** |
||
76 | * Returns the PHP code used in the ben constructor for this property. |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | public function getConstructorAssignCode() |
||
86 | |||
87 | /** |
||
88 | * Returns true if the property is compulsory (and therefore should be fetched in the constructor). |
||
89 | * |
||
90 | * @return bool |
||
91 | */ |
||
92 | abstract public function isCompulsory(); |
||
93 | |||
94 | /** |
||
95 | * Returns true if the property has a default value. |
||
96 | * |
||
97 | * @return bool |
||
98 | */ |
||
99 | abstract public function hasDefault(); |
||
100 | |||
101 | /** |
||
102 | * Returns the code that assigns a value to its default value. |
||
103 | * |
||
104 | * @return string |
||
105 | * |
||
106 | * @throws \TDBMException |
||
107 | */ |
||
108 | abstract public function assignToDefaultCode(); |
||
109 | |||
110 | /** |
||
111 | * Returns true if the property is the primary key. |
||
112 | * |
||
113 | * @return bool |
||
114 | */ |
||
115 | abstract public function isPrimaryKey(); |
||
116 | |||
117 | /** |
||
118 | * @return Table |
||
119 | */ |
||
120 | public function getTable() |
||
124 | |||
125 | /** |
||
126 | * Returns the PHP code for getters and setters. |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | abstract public function getGetterSetterCode(); |
||
131 | |||
132 | /** |
||
133 | * Returns the part of code useful when doing json serialization. |
||
134 | * |
||
135 | * @return string |
||
136 | */ |
||
137 | abstract public function getJsonSerializeCode(); |
||
138 | |||
139 | /** |
||
140 | * @return bool |
||
141 | */ |
||
142 | public function isAlternativeName(): bool |
||
146 | } |
||
147 |