I have a MySQL database with a massive schema already in place and used a plugin for MySQL Workbench to export the structure to a .yml file for Doctrine2
Example of exported YML file:
twitter:
columns:
TwitterId:
type: integer(4)
primary: true
notnull: true
UserId:
type: integer(4)
notnull: true
relations:
User:
class: user
local: UserId
foreign: UserId
foreignAlias: twitters
indexes:
FK_Twitter_User:
fields: [UserId]
I am using the Doctrine2 CLI and wondering how I can use Doctrine2 to map and auto generate models and entities, etc?
I figured this out! I ran
php doctrine-cli.php orm:convert-mapping --from-database yml /(your destination folder)/
It auto generated entity classes based on my already in place DB schema
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.