I must use \\Doctrine\\Common\\Annotations\\AnnotationRegistry::registerFile
to access the annotation registry in entity files.
This part is required to use
It seems your AnnotationRegistry
isn't set up.
Add the following to your script:
use Doctrine\Common\Annotations\AnnotationRegistry;
AnnotationRegistry::registerFile("/path/to/doctrine/lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php");
see Doctrine manual on Annotations for the detailed explanation.
In short: to read the annotations PSR-0 and spl autoloading can't do the job, you have to use their solution.