summaryrefslogtreecommitdiff
path: root/vendor/doctrine/orm/src/Mapping/AssociationOverride.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/doctrine/orm/src/Mapping/AssociationOverride.php')
-rw-r--r--vendor/doctrine/orm/src/Mapping/AssociationOverride.php51
1 files changed, 51 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Mapping/AssociationOverride.php b/vendor/doctrine/orm/src/Mapping/AssociationOverride.php
new file mode 100644
index 0000000..e0ebc07
--- /dev/null
+++ b/vendor/doctrine/orm/src/Mapping/AssociationOverride.php
@@ -0,0 +1,51 @@
1<?php
2
3declare(strict_types=1);
4
5namespace Doctrine\ORM\Mapping;
6
7/** This attribute is used to override association mapping of property for an entity relationship. */
8final class AssociationOverride implements MappingAttribute
9{
10 /**
11 * The join column that is being mapped to the persistent attribute.
12 *
13 * @var array<JoinColumn>|null
14 */
15 public readonly array|null $joinColumns;
16
17 /**
18 * The join column that is being mapped to the persistent attribute.
19 *
20 * @var array<JoinColumn>|null
21 */
22 public readonly array|null $inverseJoinColumns;
23
24 /**
25 * @param string $name The name of the relationship property whose mapping is being overridden.
26 * @param JoinColumn|array<JoinColumn> $joinColumns
27 * @param JoinColumn|array<JoinColumn> $inverseJoinColumns
28 * @param JoinTable|null $joinTable The join table that maps the relationship.
29 * @param string|null $inversedBy The name of the association-field on the inverse-side.
30 * @psalm-param 'LAZY'|'EAGER'|'EXTRA_LAZY'|null $fetch
31 */
32 public function __construct(
33 public readonly string $name,
34 array|JoinColumn|null $joinColumns = null,
35 array|JoinColumn|null $inverseJoinColumns = null,
36 public readonly JoinTable|null $joinTable = null,
37 public readonly string|null $inversedBy = null,
38 public readonly string|null $fetch = null,
39 ) {
40 if ($joinColumns instanceof JoinColumn) {
41 $joinColumns = [$joinColumns];
42 }
43
44 if ($inverseJoinColumns instanceof JoinColumn) {
45 $inverseJoinColumns = [$inverseJoinColumns];
46 }
47
48 $this->joinColumns = $joinColumns;
49 $this->inverseJoinColumns = $inverseJoinColumns;
50 }
51}