Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I understand you want to generate a set of entity classes and mapping information from a database. With Doctrine you need both the entity classes and the mapping information for them. The mapping information is basically a bunch of .yml or .xml files. Both things can be generated from a database using the tools provided by Doctrine. This is usually done once at the beginning of your project. From the mapping information Doctrine can automatically generate PHP classes you can use in your code (e.g to persist entitites). The mapping information can also be added as pseudo-annotations in classes but I don't have experience with that so I won't get into that.</p> <p>The command you're looking for is</p> <pre><code>php doctrine orm:convert-mapping --from-database yml /path/to/mapping-path-converted-to-yml </code></pre> <p>This assumes you have configured Doctrine to access your database already. </p> <p>Once you have done this you can generate the entities with</p> <pre><code>php doctrine orm:generate-entities </code></pre> <p>This should create the classes used for CRUD operations. To use the classes you just need to include them in your code and then use an EntityManager object to operate on them.</p> <p>More information on reverse engineering can be found here: <a href="http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/tools.html#reverse-engineering" rel="noreferrer">http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/tools.html#reverse-engineering</a></p> <p>By the way, if you have a schema in a MySQL Workbench file there are scripts that can generate entity classes and the mapping information from it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload