I use CodeIgniter 2 with doctrine 2 and this is the project that I am working in
https://github.com/wildlyinaccurate/CodeIgniter-2-with-Doctrine-2
I need to generate Entity classes from existing Database
so I configured the Doctrine to be in development mode and I set the Database on the CodeIgniter
after that I write this command
php doctrine orm:convert-mapping --from-database annotation models/generated
the classes generated correctly from database but without any method,after that I write this command for generating entities
php doctrine orm:generate-entities --regenerate-entities="1" models/generated
but I find this error "No Metadata classes to process"
Thanks.
In the entity files generated, you neet do delete "use Doctrine\ORM\Mapping as ORM;"
and replace "ORM\" with ""
In Doctrine.php in libraries folder add these lines, to load the driver:
$driver = new \Doctrine\ORM\Mapping\Driver\PHPDriver(APPPATH.'models/Mappings');
$config->setMetadataDriverImpl($driver);
Create your Mapping files.
And generate entities:
php cli-doctrine.php orm:generate-entities models --generate-annotations=true
Now you can create tables in your db:
php cli-doctrine.php orm:schema-tool:create
Most of doctrine documentation and tutorials are not correct. You should use this command:
php doctrine orm:generate:entities --generate-annotations=true models/generated
Here is correct line of code try now:
php doctrine orm:generate-entities --generate-annotations=true models/generated