doctrine / doctrine/annotations

Uncaught exception 'Doctrine\Common\Annotations\AnnotationException'

Open
#80 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
6.7k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

_From @cedrictailly on August 20, 2013 19:45_

Hi,

I found a bug on a this call :

``` php
$reader = $em->getConfiguration()->getMetadataDriverImpl()->getReader();

(...)

$reader->getClassMetadata($classname)
```

...were $em is the EntityManager and $classname a string, here is the error :

> [Semantical Error] The class "Annotation" is not annotated with @Annotation. Are you sure this class can be used as annotation? If so, then you need to add @Annotation to the _class_ doc comment of "Annotation". If it is indeed no annotation, then you need to add @IgnoreAnnotation("Annotation") to the _class_ doc comment of class @Doctrine\ORM\Mapping\Entity.

The context is too complex to reproduce but after a session of debugging, it seems there is a miss on a condition in class Doctrine\Common\Annotations\DocParser, in :

``` php
if (self::$annotationMetadata[$name]['is_annotation'] === false) {
if ($this->ignoreNotImportedAnnotations || isset($this->ignoredAnnotationNames[$originalName])) {
return false;
}
```

...replacing :

``` php
isset($this->ignoredAnnotationNames[$originalName])
```

...by :

``` php
$this->ignoreNotImportedAnnotations || isset($this->ignoredAnnotationNames[$originalName])
```

...should correct the problem.

_Copied from original issue: doctrine/common#292_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.