Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php vendor/bin/doctrine [Warning] The use of this script is discouraged. - Why?

Tags:

php

orm

doctrine

I'm using Doctrine ORM in my PHP project and I ran the following command to validate my schema:

php vendor/bin/doctrine orm:validate-schema

After running the command, I received a warning that says:

[Warning] The use of this script is discouraged. See [https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/tools.html#doctrine-console](https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/tools.html#doctrine-console) for instructions on bootstrapping the console runner.

This happens for any Doctrine command I try to run, not just orm:validate-schema.

I've checked the Doctrine documentation but couldn't find clear information on why this warning is displayed or what the recommended best practices are.

Why is this script usage discouraged and what is the suggested alternative?

like image 840
Unlucky Avatar asked Nov 01 '25 05:11

Unlucky


1 Answers

It is discouraged to use the script /vendor/bin/doctrine because it is generated by composer and all of your changes to that script (e.g. adding custom commands) might get overwritten on composer update or might be excluded from version control (as the /vendor directory usually is).

Best practice is to add your own doctrine script (inside /bin/ for example) and make it executable. The warning will then be gone.

like image 68
volkerschulz Avatar answered Nov 03 '25 21:11

volkerschulz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!