doctrine/mongodb-odm — Issue #262: The annotation @Id was never imported.
Author: GedRap
Created: 2012-02-25 00:03:21+00:00
State: open

I use Doctrine 2.1.6, because the code in "Getting started" section is not working under 2.2 (reported this issue).

PHP code I use:

```
name = $name;
}

public function getId()
{
return $this->id;
}

public function getName()
{
return $this->name;
}

public function setName($name)
{
$this->name = $name;
return $this;
}
}
?>
```

The error I get is:

```
Fatal error: Uncaught exception 'Doctrine\Common\Annotations\AnnotationException' with message '[Semantical Error] The annotation "@ORM\Id" in property Documents\Channel::$id was never imported. Did you maybe forget to add a "use" statement for this annotation?'
```

Also, in bootstrap (copy&pasted fro getting started) I added
```
AnnotationDriver::registerAnnotationClasses();
```
before creating the reader, without it get this error:

```
Fatal error: Uncaught exception 'Doctrine\Common\Annotations\AnnotationException' with message '[Semantical Error] The annotation "@Doctrine\ODM\MongoDB\Mapping\Annotations\Document" in class Documents\User does not exist, or could not be auto-loaded.
```