How to generate entities from database with doctrine command utilities? How to generate entities from database with doctrine command utilities? codeigniter codeigniter

How to generate entities from database with doctrine command utilities?


$db['default']['username'] = 'root';$db['default']['password'] = '';

because default password for the local host will blank


After digging into the problem i found that MAMP PRO settings were causing issues between the communication of doctrine and my DBMS (mysql).

To solve the problem i tried 3 different things (i'm running a mac)

  1. Add shortcuts for the socket into tmp folder and var/mysql folder as you can see below

sudo mkdir /var/mysql sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock

  1. Add mysql to environment variables
Open Terminal      Type in:          touch ~/.bash_profile; open ~/.bash_profile          "this will open a text editor with all the environment variables"      Alternative          vim ~/.bash_profile      Add the following line          /Applications/MAMP/Library/bin      SAVE CHANGES      Type in (into command line)          source ~/.bash_profile
  1. To generate the entities from the database we just have to type the following command into our terminal

cd to/root/folder

php vendor/bin/doctrine orm:generate-entities application/models/Entities

Output => Processing entity "Message"Entity classes generated to "/Applications/MAMP/htdocs/DoctrineTest/application/models/Entities"

application/models/Entities is where i want the generated models to be located.That all