1 | <?php |
||
41 | class Field implements Buildable |
||
42 | { |
||
43 | use Macroable; |
||
44 | use Queueable { |
||
45 | build as buildQueued; |
||
46 | } |
||
47 | use QueuesMacros; |
||
48 | use GedmoFieldHints; |
||
49 | |||
50 | /** |
||
51 | * @var FieldBuilder |
||
52 | */ |
||
53 | protected $fieldBuilder; |
||
54 | |||
55 | /** |
||
56 | * @var ClassMetadataBuilder |
||
57 | */ |
||
58 | protected $metaDatabuilder; |
||
59 | |||
60 | /** |
||
61 | * @var ClassMetadataInfo |
||
62 | */ |
||
63 | protected $classMetadata; |
||
64 | |||
65 | /** |
||
66 | * @var Type |
||
67 | */ |
||
68 | protected $type; |
||
69 | |||
70 | /** |
||
71 | * @var string |
||
72 | */ |
||
73 | protected $name; |
||
74 | |||
75 | /** |
||
76 | * Protected constructor to force usage of factory method. |
||
77 | * |
||
78 | * @param FieldBuilder $fieldBuilder |
||
79 | * @param ClassMetadataBuilder $builder |
||
80 | * @param Type $type |
||
81 | * @param string $name |
||
82 | */ |
||
83 | 300 | protected function __construct(FieldBuilder $fieldBuilder, ClassMetadataBuilder $builder, Type $type, $name) |
|
91 | |||
92 | /** |
||
93 | * @param ClassMetadataBuilder $builder |
||
94 | * @param string $type |
||
95 | * @param string $name |
||
96 | * |
||
97 | * @throws \Doctrine\DBAL\DBALException |
||
98 | * @return Field |
||
99 | */ |
||
100 | 300 | public static function make(ClassMetadataBuilder $builder, $type, $name) |
|
108 | |||
109 | /** |
||
110 | * @return string |
||
111 | */ |
||
112 | 106 | public function getName() |
|
116 | |||
117 | /** |
||
118 | * @return Type |
||
119 | */ |
||
120 | 1 | public function getType() |
|
124 | |||
125 | /** |
||
126 | * @return ClassMetadata|ExtensibleClassMetadata |
||
127 | */ |
||
128 | 104 | public function getClassMetadata() |
|
132 | |||
133 | /** |
||
134 | * By default the property name is used for the database column name also, however the ‘name’ attribute |
||
135 | * allows you to determine the column name. |
||
136 | * |
||
137 | * @param string $columnName |
||
138 | * |
||
139 | * @return $this |
||
140 | */ |
||
141 | 6 | public function name($columnName) |
|
147 | |||
148 | /** |
||
149 | * @return Field |
||
150 | */ |
||
151 | 7 | public function autoIncrement() |
|
157 | |||
158 | /** |
||
159 | * @param callable|null $callback |
||
160 | * |
||
161 | * @return Field |
||
162 | */ |
||
163 | 10 | public function generatedValue(callable $callback = null) |
|
175 | |||
176 | /** |
||
177 | * Boolean value to determine if the column should be capable of representing only non-negative integers |
||
178 | * (applies only for integer column and might not be supported by all vendors). |
||
179 | * |
||
180 | * @return Field |
||
181 | */ |
||
182 | 10 | public function unsigned() |
|
188 | |||
189 | /** |
||
190 | * Boolean value to determine if the specified length of a string column should be fixed or varying |
||
191 | * (applies only for string/binary column and might not be supported by all vendors). |
||
192 | * |
||
193 | * @param bool $fixed |
||
194 | * |
||
195 | * @return Field |
||
196 | */ |
||
197 | 1 | public function fixed($fixed) |
|
203 | |||
204 | /** |
||
205 | * The comment of the column in the schema (might not be supported by all vendors). |
||
206 | * |
||
207 | * @param string $comment |
||
208 | * |
||
209 | * @return Field |
||
210 | */ |
||
211 | 1 | public function comment($comment) |
|
217 | |||
218 | /** |
||
219 | * The collation of the column (only supported by Drizzle, Mysql, PostgreSQL>=9.1, Sqlite and SQLServer). |
||
220 | * |
||
221 | * @param string $collation |
||
222 | * |
||
223 | * @return Field |
||
224 | */ |
||
225 | 1 | public function collation($collation) |
|
231 | |||
232 | /** |
||
233 | * @return Field |
||
234 | */ |
||
235 | 8 | public function primary() |
|
241 | |||
242 | /** |
||
243 | * @param null $name |
||
244 | * |
||
245 | * @return Field |
||
246 | */ |
||
247 | 2 | public function index($name = null) |
|
262 | |||
263 | /** |
||
264 | * @return Field |
||
265 | */ |
||
266 | 21 | public function useForVersioning() |
|
272 | |||
273 | /** |
||
274 | * @return Field |
||
275 | */ |
||
276 | 191 | public function build() |
|
284 | |||
285 | /** |
||
286 | * @return FieldBuilder |
||
287 | */ |
||
288 | 69 | public function getBuilder() |
|
292 | |||
293 | /** |
||
294 | * Magic call method works as a proxy for the Doctrine FieldBuilder. |
||
295 | * |
||
296 | * @param string $method |
||
297 | * @param array $args |
||
298 | * |
||
299 | * @throws BadMethodCallException |
||
300 | * @return $this |
||
301 | */ |
||
302 | 164 | public function __call($method, $args) |
|
321 | |||
322 | /** |
||
323 | * The default value to set for the column if no value is supplied. |
||
324 | * |
||
325 | * @param string $default |
||
326 | * |
||
327 | * @return Field |
||
328 | */ |
||
329 | 1 | protected function setDefault($default) |
|
335 | } |
||
336 |