1

I am working on symfony2 and trying to create entities from database .My problem is that I have 12 tables in database but only 10 entities are getting generated .

Those two tables are not getting imported even when I am trying to import them individually.

I have tried commands mentioned in thread

But when I run command

php app/console doctrine:mapping:import AppMyBundle \
    metadata_format --filter="Yourtablename"

it says

   Database does not have any mapping information.

Sorry I am new to symfony and doctrine .Please suggest me what should I do?

Community
  • 1
  • 1
alwaysLearn
  • 6,882
  • 7
  • 39
  • 67

1 Answers1

0

At first, try to convert annotation with --from-database argument, as described in this answer:

Step1

php app/console doctrine:mapping:convert annotation  /src/App/MyBundle/Resources/config/doctrine --from-database --filter="table_name"

Step2 Now you can apply importing

php app/console doctrine:mapping:import AppMyBundle annotation --filter="table_name"

Step3

php app/console doctrine:generate:entities AppMyBundle --no-backup
Community
  • 1
  • 1
sentenza
  • 1,608
  • 3
  • 29
  • 51
  • Ok , So after little more search I got that those entites were not getting generated because they have composite keys,but still I am able to get how to handle those table using doctrine.Should I add auto incriment key or is there some way in doctrine to handle such entities So what do you suggest now ? – alwaysLearn Sep 30 '15 at 09:22
  • Ok , so here is the current scenario .. I have changed the complex key to single auto incrimented key .. and when I run command no 1 .. I am getting message as `No Metadata Classes to process.` – alwaysLearn Sep 30 '15 at 11:24
  • Probably entity manager has not created the correct metadata for you. In order to solve this problem you need to clear the cache for the environment you're using. Make sure the bundle is registered on `AppKernel.php`, and finally that entity manager's `automapping` is true. – sentenza Sep 30 '15 at 12:21