从数据库表生成实体
1. 由数据库生成模型:
php bin/console doctrine:mapping:convert --from-database yml D:\db\
(模型要改第一行路径)
2.实例所有表结构
php bin/console doctrine:generate:entities AppBundle/Entity/ --path src/
实例单个表结构(SiteChannel)
php bin/console doctrine:generate:entities AppBundle/Entity/SiteChannel --path src/
数据库迁移(symfony本地迁移到数据库):
开启数据库迁移:composer require doctrine/doctrine-migrations-bundle "^1.0"
实体更新到数据库
Resources->Entity
(比较)
php bin/console doctrine:migrations:diff
(迁移)
php bin/console doctrine:migrations:migrate
时间: 2024-11-04 11:04:51