Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 81772c1

Browse filesBrowse files
Fix Doctrine deprecations
1 parent 47794a3 commit 81772c1
Copy full SHA for 81772c1

File tree

Expand file treeCollapse file tree

2 files changed

+30
-7
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+30
-7
lines changed

‎Mapping/ClassMetadata.php

Copy file name to clipboardExpand all lines: Mapping/ClassMetadata.php
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -356,16 +356,17 @@ public function mergeConstraints(self $source)
356356
$constraint->addImplicitGroupName($this->getDefaultGroup());
357357
}
358358

359-
$this->addPropertyMetadata($member);
360-
361359
if ($member instanceof MemberMetadata && !$member->isPrivate($this->name)) {
362360
$property = $member->getPropertyName();
361+
$this->members[$property] = [$member];
363362

364-
if ($member instanceof PropertyMetadata && !isset($this->properties[$property])) {
363+
if ($member instanceof PropertyMetadata) {
365364
$this->properties[$property] = $member;
366-
} elseif ($member instanceof GetterMetadata && !isset($this->getters[$property])) {
365+
} elseif ($member instanceof GetterMetadata) {
367366
$this->getters[$property] = $member;
368367
}
368+
} else {
369+
$this->addPropertyMetadata($member);
369370
}
370371
}
371372
}

‎Mapping/Loader/AnnotationLoader.php

Copy file name to clipboardExpand all lines: Mapping/Loader/AnnotationLoader.php
+25-3Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,29 +95,51 @@ public function loadClassMetadata(ClassMetadata $metadata)
9595
*/
9696
private function getAnnotations(object $reflection): iterable
9797
{
98+
$dedup = [];
99+
98100
if (\PHP_VERSION_ID >= 80000) {
99101
foreach ($reflection->getAttributes(GroupSequence::class) as $attribute) {
102+
$dedup[] = $attribute->newInstance();
100103
yield $attribute->newInstance();
101104
}
102105
foreach ($reflection->getAttributes(GroupSequenceProvider::class) as $attribute) {
106+
$dedup[] = $attribute->newInstance();
103107
yield $attribute->newInstance();
104108
}
105109
foreach ($reflection->getAttributes(Constraint::class, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) {
110+
$dedup[] = $attribute->newInstance();
106111
yield $attribute->newInstance();
107112
}
108113
}
109114
if (!$this->reader) {
110115
return;
111116
}
112117

118+
$annotations = [];
119+
113120
if ($reflection instanceof \ReflectionClass) {
114-
yield from $this->reader->getClassAnnotations($reflection);
121+
$annotations = $this->reader->getClassAnnotations($reflection);
115122
}
116123
if ($reflection instanceof \ReflectionMethod) {
117-
yield from $this->reader->getMethodAnnotations($reflection);
124+
$annotations = $this->reader->getMethodAnnotations($reflection);
118125
}
119126
if ($reflection instanceof \ReflectionProperty) {
120-
yield from $this->reader->getPropertyAnnotations($reflection);
127+
$annotations = $this->reader->getPropertyAnnotations($reflection);
128+
}
129+
130+
foreach ($dedup as $annotation) {
131+
if ($annotation instanceof Constraint) {
132+
$annotation->groups; // trigger initialization of the "groups" property
133+
}
134+
}
135+
136+
foreach ($annotations as $annotation) {
137+
if ($annotation instanceof Constraint) {
138+
$annotation->groups; // trigger initialization of the "groups" property
139+
}
140+
if (!\in_array($annotation, $dedup, false)) {
141+
yield $annotation;
142+
}
121143
}
122144
}
123145
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.