summaryrefslogtreecommitdiff
path: root/vendor/doctrine/orm/src/Mapping/Builder
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/doctrine/orm/src/Mapping/Builder')
-rw-r--r--vendor/doctrine/orm/src/Mapping/Builder/AssociationBuilder.php171
-rw-r--r--vendor/doctrine/orm/src/Mapping/Builder/ClassMetadataBuilder.php426
-rw-r--r--vendor/doctrine/orm/src/Mapping/Builder/EmbeddedBuilder.php46
-rw-r--r--vendor/doctrine/orm/src/Mapping/Builder/EntityListenerBuilder.php55
-rw-r--r--vendor/doctrine/orm/src/Mapping/Builder/FieldBuilder.php243
-rw-r--r--vendor/doctrine/orm/src/Mapping/Builder/ManyToManyAssociationBuilder.php73
-rw-r--r--vendor/doctrine/orm/src/Mapping/Builder/OneToManyAssociationBuilder.php46
7 files changed, 1060 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Mapping/Builder/AssociationBuilder.php b/vendor/doctrine/orm/src/Mapping/Builder/AssociationBuilder.php
new file mode 100644
index 0000000..ea9e13c
--- /dev/null
+++ b/vendor/doctrine/orm/src/Mapping/Builder/AssociationBuilder.php
@@ -0,0 +1,171 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\ORM\Mapping\Builder;
6
7use Doctrine\ORM\Mapping\ClassMetadata;
8use InvalidArgumentException;
9
10class AssociationBuilder
11{
12 /** @var mixed[]|null */
13 protected array|null $joinColumns = null;
14
15 /** @param mixed[] $mapping */
16 public function __construct(
17 protected readonly ClassMetadataBuilder $builder,
18 protected array $mapping,
19 protected readonly int $type,
20 ) {
21 }
22
23 /** @return $this */
24 public function mappedBy(string $fieldName): static
25 {
26 $this->mapping['mappedBy'] = $fieldName;
27
28 return $this;
29 }
30
31 /** @return $this */
32 public function inversedBy(string $fieldName): static
33 {
34 $this->mapping['inversedBy'] = $fieldName;
35
36 return $this;
37 }
38
39 /** @return $this */
40 public function cascadeAll(): static
41 {
42 $this->mapping['cascade'] = ['ALL'];
43
44 return $this;
45 }
46
47 /** @return $this */
48 public function cascadePersist(): static
49 {
50 $this->mapping['cascade'][] = 'persist';
51
52 return $this;
53 }
54
55 /** @return $this */
56 public function cascadeRemove(): static
57 {
58 $this->mapping['cascade'][] = 'remove';
59
60 return $this;
61 }
62
63 /** @return $this */
64 public function cascadeDetach(): static
65 {
66 $this->mapping['cascade'][] = 'detach';
67
68 return $this;
69 }
70
71 /** @return $this */
72 public function cascadeRefresh(): static
73 {
74 $this->mapping['cascade'][] = 'refresh';
75
76 return $this;
77 }
78
79 /** @return $this */
80 public function fetchExtraLazy(): static
81 {
82 $this->mapping['fetch'] = ClassMetadata::FETCH_EXTRA_LAZY;
83
84 return $this;
85 }
86
87 /** @return $this */
88 public function fetchEager(): static
89 {
90 $this->mapping['fetch'] = ClassMetadata::FETCH_EAGER;
91
92 return $this;
93 }
94
95 /** @return $this */
96 public function fetchLazy(): static
97 {
98 $this->mapping['fetch'] = ClassMetadata::FETCH_LAZY;
99
100 return $this;
101 }
102
103 /**
104 * Add Join Columns.
105 *
106 * @return $this
107 */
108 public function addJoinColumn(
109 string $columnName,
110 string $referencedColumnName,
111 bool $nullable = true,
112 bool $unique = false,
113 string|null $onDelete = null,
114 string|null $columnDef = null,
115 ): static {
116 $this->joinColumns[] = [
117 'name' => $columnName,
118 'referencedColumnName' => $referencedColumnName,
119 'nullable' => $nullable,
120 'unique' => $unique,
121 'onDelete' => $onDelete,
122 'columnDefinition' => $columnDef,
123 ];
124
125 return $this;
126 }
127
128 /**
129 * Sets field as primary key.
130 *
131 * @return $this
132 */
133 public function makePrimaryKey(): static
134 {
135 $this->mapping['id'] = true;
136
137 return $this;
138 }
139
140 /**
141 * Removes orphan entities when detached from their parent.
142 *
143 * @return $this
144 */
145 public function orphanRemoval(): static
146 {
147 $this->mapping['orphanRemoval'] = true;
148
149 return $this;
150 }
151
152 /** @throws InvalidArgumentException */
153 public function build(): ClassMetadataBuilder
154 {
155 $mapping = $this->mapping;
156 if ($this->joinColumns) {
157 $mapping['joinColumns'] = $this->joinColumns;
158 }
159
160 $cm = $this->builder->getClassMetadata();
161 if ($this->type === ClassMetadata::MANY_TO_ONE) {
162 $cm->mapManyToOne($mapping);
163 } elseif ($this->type === ClassMetadata::ONE_TO_ONE) {
164 $cm->mapOneToOne($mapping);
165 } else {
166 throw new InvalidArgumentException('Type should be a ToOne Association here');
167 }
168
169 return $this->builder;
170 }
171}
diff --git a/vendor/doctrine/orm/src/Mapping/Builder/ClassMetadataBuilder.php b/vendor/doctrine/orm/src/Mapping/Builder/ClassMetadataBuilder.php
new file mode 100644
index 0000000..b9d3cc8
--- /dev/null
+++ b/vendor/doctrine/orm/src/Mapping/Builder/ClassMetadataBuilder.php
@@ -0,0 +1,426 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\ORM\Mapping\Builder;
6
7use BackedEnum;
8use Doctrine\ORM\Mapping\ClassMetadata;
9
10/**
11 * Builder Object for ClassMetadata
12 *
13 * @link www.doctrine-project.com
14 */
15class ClassMetadataBuilder
16{
17 public function __construct(
18 private readonly ClassMetadata $cm,
19 ) {
20 }
21
22 public function getClassMetadata(): ClassMetadata
23 {
24 return $this->cm;
25 }
26
27 /**
28 * Marks the class as mapped superclass.
29 *
30 * @return $this
31 */
32 public function setMappedSuperClass(): static
33 {
34 $this->cm->isMappedSuperclass = true;
35 $this->cm->isEmbeddedClass = false;
36
37 return $this;
38 }
39
40 /**
41 * Marks the class as embeddable.
42 *
43 * @return $this
44 */
45 public function setEmbeddable(): static
46 {
47 $this->cm->isEmbeddedClass = true;
48 $this->cm->isMappedSuperclass = false;
49
50 return $this;
51 }
52
53 /**
54 * Adds and embedded class
55 *
56 * @param class-string $class
57 *
58 * @return $this
59 */
60 public function addEmbedded(string $fieldName, string $class, string|false|null $columnPrefix = null): static
61 {
62 $this->cm->mapEmbedded(
63 [
64 'fieldName' => $fieldName,
65 'class' => $class,
66 'columnPrefix' => $columnPrefix,
67 ],
68 );
69
70 return $this;
71 }
72
73 /**
74 * Sets custom Repository class name.
75 *
76 * @return $this
77 */
78 public function setCustomRepositoryClass(string $repositoryClassName): static
79 {
80 $this->cm->setCustomRepositoryClass($repositoryClassName);
81
82 return $this;
83 }
84
85 /**
86 * Marks class read only.
87 *
88 * @return $this
89 */
90 public function setReadOnly(): static
91 {
92 $this->cm->markReadOnly();
93
94 return $this;
95 }
96
97 /**
98 * Sets the table name.
99 *
100 * @return $this
101 */
102 public function setTable(string $name): static
103 {
104 $this->cm->setPrimaryTable(['name' => $name]);
105
106 return $this;
107 }
108
109 /**
110 * Adds Index.
111 *
112 * @psalm-param list<string> $columns
113 *
114 * @return $this
115 */
116 public function addIndex(array $columns, string $name): static
117 {
118 if (! isset($this->cm->table['indexes'])) {
119 $this->cm->table['indexes'] = [];
120 }
121
122 $this->cm->table['indexes'][$name] = ['columns' => $columns];
123
124 return $this;
125 }
126
127 /**
128 * Adds Unique Constraint.
129 *
130 * @psalm-param list<string> $columns
131 *
132 * @return $this
133 */
134 public function addUniqueConstraint(array $columns, string $name): static
135 {
136 if (! isset($this->cm->table['uniqueConstraints'])) {
137 $this->cm->table['uniqueConstraints'] = [];
138 }
139
140 $this->cm->table['uniqueConstraints'][$name] = ['columns' => $columns];
141
142 return $this;
143 }
144
145 /**
146 * Sets class as root of a joined table inheritance hierarchy.
147 *
148 * @return $this
149 */
150 public function setJoinedTableInheritance(): static
151 {
152 $this->cm->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_JOINED);
153
154 return $this;
155 }
156
157 /**
158 * Sets class as root of a single table inheritance hierarchy.
159 *
160 * @return $this
161 */
162 public function setSingleTableInheritance(): static
163 {
164 $this->cm->setInheritanceType(ClassMetadata::INHERITANCE_TYPE_SINGLE_TABLE);
165
166 return $this;
167 }
168
169 /**
170 * Sets the discriminator column details.
171 *
172 * @psalm-param class-string<BackedEnum>|null $enumType
173 * @psalm-param array<string, mixed> $options
174 *
175 * @return $this
176 */
177 public function setDiscriminatorColumn(
178 string $name,
179 string $type = 'string',
180 int $length = 255,
181 string|null $columnDefinition = null,
182 string|null $enumType = null,
183 array $options = [],
184 ): static {
185 $this->cm->setDiscriminatorColumn(
186 [
187 'name' => $name,
188 'type' => $type,
189 'length' => $length,
190 'columnDefinition' => $columnDefinition,
191 'enumType' => $enumType,
192 'options' => $options,
193 ],
194 );
195
196 return $this;
197 }
198
199 /**
200 * Adds a subclass to this inheritance hierarchy.
201 *
202 * @return $this
203 */
204 public function addDiscriminatorMapClass(string $name, string $class): static
205 {
206 $this->cm->addDiscriminatorMapClass($name, $class);
207
208 return $this;
209 }
210
211 /**
212 * Sets deferred explicit change tracking policy.
213 *
214 * @return $this
215 */
216 public function setChangeTrackingPolicyDeferredExplicit(): static
217 {
218 $this->cm->setChangeTrackingPolicy(ClassMetadata::CHANGETRACKING_DEFERRED_EXPLICIT);
219
220 return $this;
221 }
222
223 /**
224 * Adds lifecycle event.
225 *
226 * @return $this
227 */
228 public function addLifecycleEvent(string $methodName, string $event): static
229 {
230 $this->cm->addLifecycleCallback($methodName, $event);
231
232 return $this;
233 }
234
235 /**
236 * Adds Field.
237 *
238 * @psalm-param array<string, mixed> $mapping
239 *
240 * @return $this
241 */
242 public function addField(string $name, string $type, array $mapping = []): static
243 {
244 $mapping['fieldName'] = $name;
245 $mapping['type'] = $type;
246
247 $this->cm->mapField($mapping);
248
249 return $this;
250 }
251
252 /**
253 * Creates a field builder.
254 */
255 public function createField(string $name, string $type): FieldBuilder
256 {
257 return new FieldBuilder(
258 $this,
259 [
260 'fieldName' => $name,
261 'type' => $type,
262 ],
263 );
264 }
265
266 /**
267 * Creates an embedded builder.
268 */
269 public function createEmbedded(string $fieldName, string $class): EmbeddedBuilder
270 {
271 return new EmbeddedBuilder(
272 $this,
273 [
274 'fieldName' => $fieldName,
275 'class' => $class,
276 'columnPrefix' => null,
277 ],
278 );
279 }
280
281 /**
282 * Adds a simple many to one association, optionally with the inversed by field.
283 */
284 public function addManyToOne(
285 string $name,
286 string $targetEntity,
287 string|null $inversedBy = null,
288 ): ClassMetadataBuilder {
289 $builder = $this->createManyToOne($name, $targetEntity);
290
291 if ($inversedBy !== null) {
292 $builder->inversedBy($inversedBy);
293 }
294
295 return $builder->build();
296 }
297
298 /**
299 * Creates a ManyToOne Association Builder.
300 *
301 * Note: This method does not add the association, you have to call build() on the AssociationBuilder.
302 */
303 public function createManyToOne(string $name, string $targetEntity): AssociationBuilder
304 {
305 return new AssociationBuilder(
306 $this,
307 [
308 'fieldName' => $name,
309 'targetEntity' => $targetEntity,
310 ],
311 ClassMetadata::MANY_TO_ONE,
312 );
313 }
314
315 /**
316 * Creates a OneToOne Association Builder.
317 */
318 public function createOneToOne(string $name, string $targetEntity): AssociationBuilder
319 {
320 return new AssociationBuilder(
321 $this,
322 [
323 'fieldName' => $name,
324 'targetEntity' => $targetEntity,
325 ],
326 ClassMetadata::ONE_TO_ONE,
327 );
328 }
329
330 /**
331 * Adds simple inverse one-to-one association.
332 */
333 public function addInverseOneToOne(string $name, string $targetEntity, string $mappedBy): ClassMetadataBuilder
334 {
335 $builder = $this->createOneToOne($name, $targetEntity);
336 $builder->mappedBy($mappedBy);
337
338 return $builder->build();
339 }
340
341 /**
342 * Adds simple owning one-to-one association.
343 */
344 public function addOwningOneToOne(
345 string $name,
346 string $targetEntity,
347 string|null $inversedBy = null,
348 ): ClassMetadataBuilder {
349 $builder = $this->createOneToOne($name, $targetEntity);
350
351 if ($inversedBy !== null) {
352 $builder->inversedBy($inversedBy);
353 }
354
355 return $builder->build();
356 }
357
358 /**
359 * Creates a ManyToMany Association Builder.
360 */
361 public function createManyToMany(string $name, string $targetEntity): ManyToManyAssociationBuilder
362 {
363 return new ManyToManyAssociationBuilder(
364 $this,
365 [
366 'fieldName' => $name,
367 'targetEntity' => $targetEntity,
368 ],
369 ClassMetadata::MANY_TO_MANY,
370 );
371 }
372
373 /**
374 * Adds a simple owning many to many association.
375 */
376 public function addOwningManyToMany(
377 string $name,
378 string $targetEntity,
379 string|null $inversedBy = null,
380 ): ClassMetadataBuilder {
381 $builder = $this->createManyToMany($name, $targetEntity);
382
383 if ($inversedBy !== null) {
384 $builder->inversedBy($inversedBy);
385 }
386
387 return $builder->build();
388 }
389
390 /**
391 * Adds a simple inverse many to many association.
392 */
393 public function addInverseManyToMany(string $name, string $targetEntity, string $mappedBy): ClassMetadataBuilder
394 {
395 $builder = $this->createManyToMany($name, $targetEntity);
396 $builder->mappedBy($mappedBy);
397
398 return $builder->build();
399 }
400
401 /**
402 * Creates a one to many association builder.
403 */
404 public function createOneToMany(string $name, string $targetEntity): OneToManyAssociationBuilder
405 {
406 return new OneToManyAssociationBuilder(
407 $this,
408 [
409 'fieldName' => $name,
410 'targetEntity' => $targetEntity,
411 ],
412 ClassMetadata::ONE_TO_MANY,
413 );
414 }
415
416 /**
417 * Adds simple OneToMany association.
418 */
419 public function addOneToMany(string $name, string $targetEntity, string $mappedBy): ClassMetadataBuilder
420 {
421 $builder = $this->createOneToMany($name, $targetEntity);
422 $builder->mappedBy($mappedBy);
423
424 return $builder->build();
425 }
426}
diff --git a/vendor/doctrine/orm/src/Mapping/Builder/EmbeddedBuilder.php b/vendor/doctrine/orm/src/Mapping/Builder/EmbeddedBuilder.php
new file mode 100644
index 0000000..b9d2127
--- /dev/null
+++ b/vendor/doctrine/orm/src/Mapping/Builder/EmbeddedBuilder.php
@@ -0,0 +1,46 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\ORM\Mapping\Builder;
6
7/**
8 * Embedded Builder
9 *
10 * @link www.doctrine-project.com
11 */
12class EmbeddedBuilder
13{
14 /** @param mixed[] $mapping */
15 public function __construct(
16 private readonly ClassMetadataBuilder $builder,
17 private array $mapping,
18 ) {
19 }
20
21 /**
22 * Sets the column prefix for all of the embedded columns.
23 *
24 * @return $this
25 */
26 public function setColumnPrefix(string $columnPrefix): static
27 {
28 $this->mapping['columnPrefix'] = $columnPrefix;
29
30 return $this;
31 }
32
33 /**
34 * Finalizes this embeddable and attach it to the ClassMetadata.
35 *
36 * Without this call an EmbeddedBuilder has no effect on the ClassMetadata.
37 */
38 public function build(): ClassMetadataBuilder
39 {
40 $cm = $this->builder->getClassMetadata();
41
42 $cm->mapEmbedded($this->mapping);
43
44 return $this->builder;
45 }
46}
diff --git a/vendor/doctrine/orm/src/Mapping/Builder/EntityListenerBuilder.php b/vendor/doctrine/orm/src/Mapping/Builder/EntityListenerBuilder.php
new file mode 100644
index 0000000..a0b14b9
--- /dev/null
+++ b/vendor/doctrine/orm/src/Mapping/Builder/EntityListenerBuilder.php
@@ -0,0 +1,55 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\ORM\Mapping\Builder;
6
7use Doctrine\ORM\Events;
8use Doctrine\ORM\Mapping\ClassMetadata;
9use Doctrine\ORM\Mapping\MappingException;
10
11use function class_exists;
12use function get_class_methods;
13
14/**
15 * Builder for entity listeners.
16 */
17class EntityListenerBuilder
18{
19 /** Hash-map to handle event names. */
20 private const EVENTS = [
21 Events::preRemove => true,
22 Events::postRemove => true,
23 Events::prePersist => true,
24 Events::postPersist => true,
25 Events::preUpdate => true,
26 Events::postUpdate => true,
27 Events::postLoad => true,
28 Events::preFlush => true,
29 ];
30
31 /**
32 * Lookup the entity class to find methods that match to event lifecycle names
33 *
34 * @param ClassMetadata $metadata The entity metadata.
35 * @param string $className The listener class name.
36 *
37 * @throws MappingException When the listener class not found.
38 */
39 public static function bindEntityListener(ClassMetadata $metadata, string $className): void
40 {
41 $class = $metadata->fullyQualifiedClassName($className);
42
43 if (! class_exists($class)) {
44 throw MappingException::entityListenerClassNotFound($class, $className);
45 }
46
47 foreach (get_class_methods($class) as $method) {
48 if (! isset(self::EVENTS[$method])) {
49 continue;
50 }
51
52 $metadata->addEntityListener($method, $class, $method);
53 }
54 }
55}
diff --git a/vendor/doctrine/orm/src/Mapping/Builder/FieldBuilder.php b/vendor/doctrine/orm/src/Mapping/Builder/FieldBuilder.php
new file mode 100644
index 0000000..8326ff5
--- /dev/null
+++ b/vendor/doctrine/orm/src/Mapping/Builder/FieldBuilder.php
@@ -0,0 +1,243 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\ORM\Mapping\Builder;
6
7use function constant;
8
9/**
10 * Field Builder
11 *
12 * @link www.doctrine-project.com
13 */
14class FieldBuilder
15{
16 private bool $version = false;
17 private string|null $generatedValue = null;
18
19 /** @var mixed[]|null */
20 private array|null $sequenceDef = null;
21
22 private string|null $customIdGenerator = null;
23
24 /** @param mixed[] $mapping */
25 public function __construct(
26 private readonly ClassMetadataBuilder $builder,
27 private array $mapping,
28 ) {
29 }
30
31 /**
32 * Sets length.
33 *
34 * @return $this
35 */
36 public function length(int $length): static
37 {
38 $this->mapping['length'] = $length;
39
40 return $this;
41 }
42
43 /**
44 * Sets nullable.
45 *
46 * @return $this
47 */
48 public function nullable(bool $flag = true): static
49 {
50 $this->mapping['nullable'] = $flag;
51
52 return $this;
53 }
54
55 /**
56 * Sets Unique.
57 *
58 * @return $this
59 */
60 public function unique(bool $flag = true): static
61 {
62 $this->mapping['unique'] = $flag;
63
64 return $this;
65 }
66
67 /**
68 * Sets column name.
69 *
70 * @return $this
71 */
72 public function columnName(string $name): static
73 {
74 $this->mapping['columnName'] = $name;
75
76 return $this;
77 }
78
79 /**
80 * Sets Precision.
81 *
82 * @return $this
83 */
84 public function precision(int $p): static
85 {
86 $this->mapping['precision'] = $p;
87
88 return $this;
89 }
90
91 /**
92 * Sets insertable.
93 *
94 * @return $this
95 */
96 public function insertable(bool $flag = true): self
97 {
98 if (! $flag) {
99 $this->mapping['notInsertable'] = true;
100 }
101
102 return $this;
103 }
104
105 /**
106 * Sets updatable.
107 *
108 * @return $this
109 */
110 public function updatable(bool $flag = true): self
111 {
112 if (! $flag) {
113 $this->mapping['notUpdatable'] = true;
114 }
115
116 return $this;
117 }
118
119 /**
120 * Sets scale.
121 *
122 * @return $this
123 */
124 public function scale(int $s): static
125 {
126 $this->mapping['scale'] = $s;
127
128 return $this;
129 }
130
131 /**
132 * Sets field as primary key.
133 *
134 * @return $this
135 */
136 public function makePrimaryKey(): static
137 {
138 $this->mapping['id'] = true;
139
140 return $this;
141 }
142
143 /**
144 * Sets an option.
145 *
146 * @return $this
147 */
148 public function option(string $name, mixed $value): static
149 {
150 $this->mapping['options'][$name] = $value;
151
152 return $this;
153 }
154
155 /** @return $this */
156 public function generatedValue(string $strategy = 'AUTO'): static
157 {
158 $this->generatedValue = $strategy;
159
160 return $this;
161 }
162
163 /**
164 * Sets field versioned.
165 *
166 * @return $this
167 */
168 public function isVersionField(): static
169 {
170 $this->version = true;
171
172 return $this;
173 }
174
175 /**
176 * Sets Sequence Generator.
177 *
178 * @return $this
179 */
180 public function setSequenceGenerator(string $sequenceName, int $allocationSize = 1, int $initialValue = 1): static
181 {
182 $this->sequenceDef = [
183 'sequenceName' => $sequenceName,
184 'allocationSize' => $allocationSize,
185 'initialValue' => $initialValue,
186 ];
187
188 return $this;
189 }
190
191 /**
192 * Sets column definition.
193 *
194 * @return $this
195 */
196 public function columnDefinition(string $def): static
197 {
198 $this->mapping['columnDefinition'] = $def;
199
200 return $this;
201 }
202
203 /**
204 * Set the FQCN of the custom ID generator.
205 * This class must extend \Doctrine\ORM\Id\AbstractIdGenerator.
206 *
207 * @return $this
208 */
209 public function setCustomIdGenerator(string $customIdGenerator): static
210 {
211 $this->customIdGenerator = $customIdGenerator;
212
213 return $this;
214 }
215
216 /**
217 * Finalizes this field and attach it to the ClassMetadata.
218 *
219 * Without this call a FieldBuilder has no effect on the ClassMetadata.
220 */
221 public function build(): ClassMetadataBuilder
222 {
223 $cm = $this->builder->getClassMetadata();
224 if ($this->generatedValue) {
225 $cm->setIdGeneratorType(constant('Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_' . $this->generatedValue));
226 }
227
228 if ($this->version) {
229 $cm->setVersionMapping($this->mapping);
230 }
231
232 $cm->mapField($this->mapping);
233 if ($this->sequenceDef) {
234 $cm->setSequenceGeneratorDefinition($this->sequenceDef);
235 }
236
237 if ($this->customIdGenerator) {
238 $cm->setCustomGeneratorDefinition(['class' => $this->customIdGenerator]);
239 }
240
241 return $this->builder;
242 }
243}
diff --git a/vendor/doctrine/orm/src/Mapping/Builder/ManyToManyAssociationBuilder.php b/vendor/doctrine/orm/src/Mapping/Builder/ManyToManyAssociationBuilder.php
new file mode 100644
index 0000000..b83a8ba
--- /dev/null
+++ b/vendor/doctrine/orm/src/Mapping/Builder/ManyToManyAssociationBuilder.php
@@ -0,0 +1,73 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\ORM\Mapping\Builder;
6
7/**
8 * ManyToMany Association Builder
9 *
10 * @link www.doctrine-project.com
11 */
12class ManyToManyAssociationBuilder extends OneToManyAssociationBuilder
13{
14 private string|null $joinTableName = null;
15
16 /** @var mixed[] */
17 private array $inverseJoinColumns = [];
18
19 /** @return $this */
20 public function setJoinTable(string $name): static
21 {
22 $this->joinTableName = $name;
23
24 return $this;
25 }
26
27 /**
28 * Adds Inverse Join Columns.
29 *
30 * @return $this
31 */
32 public function addInverseJoinColumn(
33 string $columnName,
34 string $referencedColumnName,
35 bool $nullable = true,
36 bool $unique = false,
37 string|null $onDelete = null,
38 string|null $columnDef = null,
39 ): static {
40 $this->inverseJoinColumns[] = [
41 'name' => $columnName,
42 'referencedColumnName' => $referencedColumnName,
43 'nullable' => $nullable,
44 'unique' => $unique,
45 'onDelete' => $onDelete,
46 'columnDefinition' => $columnDef,
47 ];
48
49 return $this;
50 }
51
52 public function build(): ClassMetadataBuilder
53 {
54 $mapping = $this->mapping;
55 $mapping['joinTable'] = [];
56 if ($this->joinColumns) {
57 $mapping['joinTable']['joinColumns'] = $this->joinColumns;
58 }
59
60 if ($this->inverseJoinColumns) {
61 $mapping['joinTable']['inverseJoinColumns'] = $this->inverseJoinColumns;
62 }
63
64 if ($this->joinTableName) {
65 $mapping['joinTable']['name'] = $this->joinTableName;
66 }
67
68 $cm = $this->builder->getClassMetadata();
69 $cm->mapManyToMany($mapping);
70
71 return $this->builder;
72 }
73}
diff --git a/vendor/doctrine/orm/src/Mapping/Builder/OneToManyAssociationBuilder.php b/vendor/doctrine/orm/src/Mapping/Builder/OneToManyAssociationBuilder.php
new file mode 100644
index 0000000..077c558
--- /dev/null
+++ b/vendor/doctrine/orm/src/Mapping/Builder/OneToManyAssociationBuilder.php
@@ -0,0 +1,46 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\ORM\Mapping\Builder;
6
7/**
8 * OneToMany Association Builder
9 *
10 * @link www.doctrine-project.com
11 */
12class OneToManyAssociationBuilder extends AssociationBuilder
13{
14 /**
15 * @psalm-param array<string, string> $fieldNames
16 *
17 * @return $this
18 */
19 public function setOrderBy(array $fieldNames): static
20 {
21 $this->mapping['orderBy'] = $fieldNames;
22
23 return $this;
24 }
25
26 /** @return $this */
27 public function setIndexBy(string $fieldName): static
28 {
29 $this->mapping['indexBy'] = $fieldName;
30
31 return $this;
32 }
33
34 public function build(): ClassMetadataBuilder
35 {
36 $mapping = $this->mapping;
37 if ($this->joinColumns) {
38 $mapping['joinColumns'] = $this->joinColumns;
39 }
40
41 $cm = $this->builder->getClassMetadata();
42 $cm->mapOneToMany($mapping);
43
44 return $this->builder;
45 }
46}