i've troube with the autoloading of composer as the autoloader can't resolve Doctrine\ORM\Mapping\Table. For the Unittests i have created doctrine entity classes with typical Annotations:
<?php
namespace OmniSearchTest\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Picture
*
* @ORM\Table(name="picture")
* @ORM\Entity
*/
class Picture
{
and created a new entity manager by using this entities. But im getting The Message:
Doctrine\Common\Annotations\AnnotationException: [Semantical Error] The annotation "@Doctrine\ORM\Mapping\Table" in class OmniSearchTest\Entity\Picture does not exist, or could not be auto-loaded.
For some Unittests
First, i have the following project structure:
/src
/OmniSearch
SomeClass.php
/tests
/OmniSearchTest
SomeClassTest.php
/composer.json
/phpunit.xml.dist
My composer.json looks like this:
{
/* ... */
"require": {
"php": ">=5.4",
"doctrine/orm": "2.*"
},
"require-dev": {
"phpunit/phpunit": "4.*"
},
"autoload": {
"psr-0": {
"OmniSearch\\": "src/"
}
},
"autoload-dev": {
"psr-0": {
"OmniSearchTest\\": "tests/"
}
}
}
While my phpunit looks excactly like this:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
strict="true"
verbose="true">
<testsuites>
<testsuite name="omnisearch">
<directory>./tests/OmniSearchTest</directory>
</testsuite>
</testsuites>
</phpunit>
I cutted off this project from another zf2 project of mine where the autoloading was working fine. Im not sure what exactly went wrong because the autogenerated autoload_namespaces.php contains the the mapping:
'Doctrine\\ORM\\' => array($vendorDir . '/doctrine/orm/lib'),