Skip to content

Commit

Permalink
Deprecation notice when using Indexes annotation on a property
Browse files Browse the repository at this point in the history
This was missed when Indexes was originally deprecated in 7435e66.

The Indexes attribute omits Attribute::TARGET_PROPERTY, but it may still target a property via an annotation.
  • Loading branch information
jmikola committed Apr 17, 2024
1 parent 1e41cd1 commit 2451e0a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/Doctrine/ODM/MongoDB/Mapping/Driver/AttributeDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad
}

if ($propertyAttribute instanceof ODM\Indexes) {
trigger_deprecation(
'doctrine/mongodb-odm',
'2.2',
'The "@Indexes" attribute used in property "%s" of class "%s" is deprecated. Specify all "@Index" and "@UniqueIndex" attributes on the class.',
$property->getName(),
$className,
);

$value = $propertyAttribute->value;
foreach (is_array($value) ? $value : [$value] as $index) {
$indexes[] = $index;
Expand Down

0 comments on commit 2451e0a

Please sign in to comment.