I'm trying to import a database structure to mapping with Symfony/Doctrine.
I followed the tutorial here and it gives the command to create mapping files from existing databases:
php app/console doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm --from-database --force
But the PHP interpreter exits instantly:
PHP Fatal error: Option inconnue --from-database in Unknown on line 0
Could not startup.
(Option inconnue means unknown option in french)
I can understand that PHP do not pass the arguments to app/console script.
If I try with HHVM, the arguments are sent to the PHP script (so, it runs fine).
PHP version: PHP 5.5.12-2ubuntu4.1
EDIT: Problem solved, see my answer below. I will accept it tomorrow (StackOverflow limitation).
Because of the shebang in the console script, you can omit the php interpreter call in the command line by doing:
chmod +x app/console
./app/console doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm --from-database --force
or, alternatively, you can do:
php app/console -- doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm --from-database --force
Please note the separating additional -- after the script input filename, that tell the php interpreter that each successive argument should be led to the script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With