AbdelMalek
AbdelMalek

Reputation: 2844

doctrine 2 with CodeIgniter 2 No Metadata classes to process

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.

Upvotes: 2

Views: 1428

Answers (4)

flik
flik

Reputation: 3633

Here is correct line of code try now:

php doctrine orm:generate-entities --generate-annotations=true models/generated

Upvotes: 0

flik
flik

Reputation: 3633

Most of doctrine documentation and tutorials are not correct. You should use this command:

php doctrine orm:generate:entities --generate-annotations=true models/generated

Upvotes: 0

Luca Mori Polpettini
Luca Mori Polpettini

Reputation: 596

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

Upvotes: 0

Jordi Romero
Jordi Romero

Reputation: 11

In the entity files generated, you neet do delete "use Doctrine\ORM\Mapping as ORM;"

and replace "ORM\" with ""

Upvotes: 1

Related Questions