เมื่อเราทำการ Created Tables ส่วนการสร้างตารางโดยการ Generate entity กันไปเเล้วหลังจากนั้นเราต้องทำการ Update Tables เพื่อทำการสร้างตารางของเราไปยัง http://localhost/phpmyadmin
ในขั้นตอนนี้เราจะใช้คำสั่ง Command
doctrine:schema:update
จากนั้นให้ทำการคลิกที่ Run
ATTENTION: This operation should not be executed in a production environment.
Use the incremental update to detect changes during development and use
the SQL DDL provided to manually update your database in production.
The Schema-Tool would execute "1" queries to update the database.
Please run the operation by passing one - or both - of the following options:
doctrine:schema:update --force to execute the command
doctrine:schema:update --dump-sql to dump the SQL statements to the screen
ถ้าขึ้นในลักษณะแบบนี้จะยังไม่สามารถ update tables ได้ ปัญหาเกิดจาก เกิดขึ้นจากเราเปิด public site (App.php)
วิธีแก้ไข
1. จะต้องไปปิด public site ศึกษาได้จากหัวข้อ Production and Development Environment ในตอนต้น
2. จากนั้นให้ทำการลบ Cache ก่อน
3.จากนั้น Run command
doctrine:schema:update –force
ใส่ Parameters –force บังคับมันไปด้วย
ผลที่ได้