1 | <?php |
||
34 | class ClassMetadataBuilder |
||
35 | { |
||
36 | /** |
||
37 | * @var \Doctrine\ORM\Mapping\ClassMetadataInfo |
||
38 | */ |
||
39 | private $cm; |
||
40 | |||
41 | /** |
||
42 | * @param \Doctrine\ORM\Mapping\ClassMetadataInfo $cm |
||
43 | */ |
||
44 | 38 | public function __construct(ClassMetadataInfo $cm) |
|
48 | |||
49 | /** |
||
50 | * @return ClassMetadata |
||
51 | */ |
||
52 | 20 | public function getClassMetadata() |
|
56 | |||
57 | /** |
||
58 | * Marks the class as mapped superclass. |
||
59 | * |
||
60 | * @return ClassMetadataBuilder |
||
61 | */ |
||
62 | 1 | public function setMappedSuperClass() |
|
69 | |||
70 | /** |
||
71 | * Marks the class as embeddable. |
||
72 | * |
||
73 | * @return ClassMetadataBuilder |
||
74 | */ |
||
75 | 1 | public function setEmbeddable() |
|
82 | |||
83 | /** |
||
84 | * Adds and embedded class |
||
85 | * |
||
86 | * @param string $fieldName |
||
87 | * @param string $class |
||
88 | * @param string|null $columnPrefix |
||
89 | * |
||
90 | * @return $this |
||
91 | */ |
||
92 | 2 | public function addEmbedded($fieldName, $class, $columnPrefix = null) |
|
102 | |||
103 | /** |
||
104 | * Sets custom Repository class name. |
||
105 | * |
||
106 | * @param string $repositoryClassName |
||
107 | * |
||
108 | * @return ClassMetadataBuilder |
||
109 | */ |
||
110 | 1 | public function setCustomRepositoryClass($repositoryClassName) |
|
116 | |||
117 | /** |
||
118 | * Sets custom Persister class name. |
||
119 | * |
||
120 | * @param string $persisterClassName |
||
121 | * |
||
122 | * @return ClassMetadataBuilder |
||
123 | */ |
||
124 | public function setCustomPersisterClass($persisterClassName) |
||
130 | |||
131 | /** |
||
132 | * Marks class read only. |
||
133 | * |
||
134 | * @return ClassMetadataBuilder |
||
135 | */ |
||
136 | 1 | public function setReadOnly() |
|
142 | |||
143 | /** |
||
144 | * Sets the table name. |
||
145 | * |
||
146 | * @param string $name |
||
147 | * |
||
148 | * @return ClassMetadataBuilder |
||
149 | */ |
||
150 | 2 | public function setTable($name) |
|
156 | |||
157 | /** |
||
158 | * Adds Index. |
||
159 | * |
||
160 | * @param array $columns |
||
161 | * @param string $name |
||
162 | * |
||
163 | * @return ClassMetadataBuilder |
||
164 | */ |
||
165 | 2 | public function addIndex(array $columns, $name) |
|
175 | |||
176 | /** |
||
177 | * Adds Unique Constraint. |
||
178 | * |
||
179 | * @param array $columns |
||
180 | * @param string $name |
||
181 | * |
||
182 | * @return ClassMetadataBuilder |
||
183 | */ |
||
184 | 2 | public function addUniqueConstraint(array $columns, $name) |
|
194 | |||
195 | /** |
||
196 | * Adds named query. |
||
197 | * |
||
198 | * @param string $name |
||
199 | * @param string $dqlQuery |
||
200 | * |
||
201 | * @return ClassMetadataBuilder |
||
202 | */ |
||
203 | public function addNamedQuery($name, $dqlQuery) |
||
212 | |||
213 | /** |
||
214 | * Sets class as root of a joined table inheritance hierarchy. |
||
215 | * |
||
216 | * @return ClassMetadataBuilder |
||
217 | */ |
||
218 | 1 | public function setJoinedTableInheritance() |
|
224 | |||
225 | /** |
||
226 | * Sets class as root of a single table inheritance hierarchy. |
||
227 | * |
||
228 | * @return ClassMetadataBuilder |
||
229 | */ |
||
230 | 1 | public function setSingleTableInheritance() |
|
236 | |||
237 | /** |
||
238 | * Sets the discriminator column details. |
||
239 | * |
||
240 | * @param string $name |
||
241 | * @param string $type |
||
242 | * @param int $length |
||
243 | * |
||
244 | * @return ClassMetadataBuilder |
||
245 | */ |
||
246 | 1 | public function setDiscriminatorColumn($name, $type = 'string', $length = 255) |
|
256 | |||
257 | /** |
||
258 | * Adds a subclass to this inheritance hierarchy. |
||
259 | * |
||
260 | * @param string $name |
||
261 | * @param string $class |
||
262 | * |
||
263 | * @return ClassMetadataBuilder |
||
264 | */ |
||
265 | 1 | public function addDiscriminatorMapClass($name, $class) |
|
271 | |||
272 | /** |
||
273 | * Sets deferred explicit change tracking policy. |
||
274 | * |
||
275 | * @return ClassMetadataBuilder |
||
276 | */ |
||
277 | 1 | public function setChangeTrackingPolicyDeferredExplicit() |
|
283 | |||
284 | /** |
||
285 | * Sets notify change tracking policy. |
||
286 | * |
||
287 | * @return ClassMetadataBuilder |
||
288 | */ |
||
289 | 1 | public function setChangeTrackingPolicyNotify() |
|
295 | |||
296 | /** |
||
297 | * Adds lifecycle event. |
||
298 | * |
||
299 | * @param string $methodName |
||
300 | * @param string $event |
||
301 | * |
||
302 | * @return ClassMetadataBuilder |
||
303 | */ |
||
304 | 1 | public function addLifecycleEvent($methodName, $event) |
|
310 | |||
311 | /** |
||
312 | * Adds Field. |
||
313 | * |
||
314 | * @param string $name |
||
315 | * @param string $type |
||
316 | * @param array $mapping |
||
317 | * |
||
318 | * @return ClassMetadataBuilder |
||
319 | */ |
||
320 | 1 | public function addField($name, $type, array $mapping = array()) |
|
329 | |||
330 | /** |
||
331 | * Creates a field builder. |
||
332 | * |
||
333 | * @param string $name |
||
334 | * @param string $type |
||
335 | * |
||
336 | * @return FieldBuilder |
||
337 | */ |
||
338 | 5 | public function createField($name, $type) |
|
348 | |||
349 | /** |
||
350 | * Creates an embedded builder. |
||
351 | * |
||
352 | * @param string $fieldName |
||
353 | * @param string $class |
||
354 | * |
||
355 | * @return EmbeddedBuilder |
||
356 | */ |
||
357 | 2 | public function createEmbedded($fieldName, $class) |
|
368 | |||
369 | /** |
||
370 | * Adds a simple many to one association, optionally with the inversed by field. |
||
371 | * |
||
372 | * @param string $name |
||
373 | * @param string $targetEntity |
||
374 | * @param string|null $inversedBy |
||
375 | * |
||
376 | * @return ClassMetadataBuilder |
||
377 | */ |
||
378 | public function addManyToOne($name, $targetEntity, $inversedBy = null) |
||
388 | |||
389 | /** |
||
390 | * Creates a ManyToOne Association Builder. |
||
391 | * |
||
392 | * Note: This method does not add the association, you have to call build() on the AssociationBuilder. |
||
393 | * |
||
394 | * @param string $name |
||
395 | * @param string $targetEntity |
||
396 | * |
||
397 | * @return AssociationBuilder |
||
398 | */ |
||
399 | 3 | public function createManyToOne($name, $targetEntity) |
|
410 | |||
411 | /** |
||
412 | * Creates a OneToOne Association Builder. |
||
413 | * |
||
414 | * @param string $name |
||
415 | * @param string $targetEntity |
||
416 | * |
||
417 | * @return AssociationBuilder |
||
418 | */ |
||
419 | 4 | public function createOneToOne($name, $targetEntity) |
|
430 | |||
431 | /** |
||
432 | * Adds simple inverse one-to-one association. |
||
433 | * |
||
434 | * @param string $name |
||
435 | * @param string $targetEntity |
||
436 | * @param string $mappedBy |
||
437 | * |
||
438 | * @return ClassMetadataBuilder |
||
439 | */ |
||
440 | public function addInverseOneToOne($name, $targetEntity, $mappedBy) |
||
447 | |||
448 | /** |
||
449 | * Adds simple owning one-to-one association. |
||
450 | * |
||
451 | * @param string $name |
||
452 | * @param string $targetEntity |
||
453 | * @param string|null $inversedBy |
||
454 | * |
||
455 | * @return ClassMetadataBuilder |
||
456 | */ |
||
457 | public function addOwningOneToOne($name, $targetEntity, $inversedBy = null) |
||
467 | |||
468 | /** |
||
469 | * Creates a ManyToMany Association Builder. |
||
470 | * |
||
471 | * @param string $name |
||
472 | * @param string $targetEntity |
||
473 | * |
||
474 | * @return ManyToManyAssociationBuilder |
||
475 | */ |
||
476 | 3 | public function createManyToMany($name, $targetEntity) |
|
487 | |||
488 | /** |
||
489 | * Adds a simple owning many to many association. |
||
490 | * |
||
491 | * @param string $name |
||
492 | * @param string $targetEntity |
||
493 | * @param string|null $inversedBy |
||
494 | * |
||
495 | * @return ClassMetadataBuilder |
||
496 | */ |
||
497 | public function addOwningManyToMany($name, $targetEntity, $inversedBy = null) |
||
507 | |||
508 | /** |
||
509 | * Adds a simple inverse many to many association. |
||
510 | * |
||
511 | * @param string $name |
||
512 | * @param string $targetEntity |
||
513 | * @param string $mappedBy |
||
514 | * |
||
515 | * @return ClassMetadataBuilder |
||
516 | */ |
||
517 | public function addInverseManyToMany($name, $targetEntity, $mappedBy) |
||
524 | |||
525 | /** |
||
526 | * Creates a one to many association builder. |
||
527 | * |
||
528 | * @param string $name |
||
529 | * @param string $targetEntity |
||
530 | * |
||
531 | * @return OneToManyAssociationBuilder |
||
532 | */ |
||
533 | 3 | public function createOneToMany($name, $targetEntity) |
|
544 | |||
545 | /** |
||
546 | * Adds simple OneToMany association. |
||
547 | * |
||
548 | * @param string $name |
||
549 | * @param string $targetEntity |
||
550 | * @param string $mappedBy |
||
551 | * |
||
552 | * @return ClassMetadataBuilder |
||
553 | */ |
||
554 | public function addOneToMany($name, $targetEntity, $mappedBy) |
||
561 | } |
||
562 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: