This solve Exceptions below :
- Doctrine\Common\Annotations\AnnotationException : [Semantical Error] The annotation "..." in property Class::$property does not exist, or could not be auto-loaded.
- Doctrine\ORM\Mapping\MappingException : Class "..." is not a valid entity or mapped super class.
composer require doctrine/orm
composer require symfony/validator
composer require zircote/swagger-php
// Composer autoloader class
$loader = require '/vendor/autoload.php'; // replace according the project
// tells AnnotationRegistry to use the Composer autoloader class
\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader([$loader, 'loadClass']);
// Doctrine ORM configuration
$config = ORM\Tools\Setup::createAnnotationMetadataConfiguration(
'/src/Resources', // replace according the project
App::isDevEnv(), // replace according the project
'/cache/doctrine/proxies', // replace according the project
$cache, // replace according the project
false // MUST BE SET TO 'false'
);
// ...
// later call to Swagger
$OA = \Swagger\scan(['/src/App.php', '/src/Resources']);
header('Content-Type: application/json');
echo $OA;
exit;
You saved my long day, thank you!