After I created a βmotorβ database in MySQL, I configured the database in Symfony with this command:
$ php symfony configure:database "mysql:host=localhost;dbname=motor" root <mypassword>
In appname/config/doctrine/ I have a schema.yml file.
In this file, I defined the following table:
Car: actAs: { Timestampable: ~ } columns: brand: { type: string(255), notnull: true } model: { type: string(255), notnull: true } version: { type: string(255), notnull: true } url: { type: string(255), notnull: true } year: { type: string(4), notnull: true } info: { type: string(10000), notnull: true } updated_at: { type: timestamp, notnull: true } created_at: { type: timestamp, notnull: true }
Then I ran the command:
$ php symfony doctrine:build --model
Which gave me the following result:
>> doctrine generating model classes >> file+ /tmp/doctrine_schema_57936.yml >> tokens /home/username/webapps/www/appname/lib/model/doctrine/CarTable.class.php >> tokens /home/username/webapps/www/appname/lib/model/doctrine/Car.class.php >> tokens /home/username/webapps/www/appname/lib/model/doctrine/base/BaseCar.class.php >> autoload Resetting application autoloaders >> file- /home/username/webapps/www/appname/cache/frontend/dev/config/config_autoload.yml.php
After that, I started generating sql with this command:
$ php symfony doctrine:build --sql
Output:
>> doctrine generating model classes >> file+ /tmp/doctrine_schema_89541.yml >> tokens /home/username/webapps/www/motor/lib/model/doctrine/base/BaseCar.class.php >> autoload Resetting application autoloaders >> file- /home/username/webapps/www/motor/cache/frontend/dev/config/config_autoload.yml.php >> doctrine generating sql for models >> doctrine Generated SQL successfully for models
However, in appname/data/sql/ generated schema.sql file schema.sql empty.
So, this $ php symfony doctrine:insert-sql command did not create any table in my database. However, he gave a successful message output:
>> doctrine creating tables >> doctrine created tables successfully
The $ php symfony doctrine:build --all does not work either.
Any idea what I can do wrong?