Skip to content

Commit

Permalink
Merge pull request #34 from alexander-schranz/enhancement/autoload-do…
Browse files Browse the repository at this point in the history
…ctrine-annotations

Fix Symfony 6.3 compatibility by use autoloading for doctrine annotations
  • Loading branch information
chirimoya authored Jun 13, 2023
2 parents f41f2f3 + 6056a04 commit ab0f1ad
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 29 deletions.
28 changes: 0 additions & 28 deletions Mapping/DocumentParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public function __construct(Reader $reader, DocumentFinder $finder)
{
$this->reader = $reader;
$this->finder = $finder;
$this->registerAnnotations();
}

/**
Expand Down Expand Up @@ -389,33 +388,6 @@ private function getMutatorMethods(\ReflectionClass $reflectionClass, $property,
throw new \LogicException($message);
}

/**
* Registers annotations to registry so that it could be used by reader.
*/
private function registerAnnotations()
{
$annotations = [
'Document',
'Property',
'Embedded',
'ObjectType',
'Nested',
'Id',
'ParentDocument',
'Routing',
'Version',
'HashMap',
];

foreach ($annotations as $annotation) {
AnnotationRegistry::registerFile(__DIR__ . "/../Annotation/{$annotation}.php");
}

if (version_compare(PHP_VERSION, '7.2.0') < 0) {
AnnotationRegistry::registerFile(__DIR__ . "/../Annotation/Object.php");
}
}

/**
* Returns document type.
*
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"symfony/stopwatch": "^2.8|^3.0|^4|^5|^6",
"symfony/templating": "^2.8|^3.0|^4|^5|^6",
"symfony/asset": "^2.8|^3.0|^4|^5|^6",
"doctrine/annotations": "~1.2",
"doctrine/annotations": "^1.10",
"doctrine/inflector": "^1.0 || ^2.0",
"doctrine/cache": "~1.4",
"doctrine/collections": "~1.4",
Expand Down

0 comments on commit ab0f1ad

Please sign in to comment.