mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
vendor/bin/doctrine won't work, reporting missing 'doctrine.php' #6664
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @roo7cause on GitHub (Mar 26, 2021).
I was following the doctrine2-ORM Getting Started Guide (just learning about Doctrine) where I encountered a following issue.
ERROR MESSAGE:
DOCTRINE CODE:
This code returns
include(doctrine.php), however, this will of course not work, becausedoctrine.phpis NOT present in the current directory where we are executing thevendor/bin/doctrine.However, when I commented out the
if block, the code executed as expected. I assume this works because the$binPathcorrectly holds the absolute path to wheredoctrine.phpis present.This raises the question, why do we even do
eval()in this script block? including the absolute path todoctrine.phpseems to work just nice.@greg0ire commented on GitHub (Mar 26, 2021):
Thanks for reporting this, but bear in mind that this script is generated by Composer so even if we (Doctrine) don't need the eval, the fix for that will not happen in
doctrine/ormbut incomposer/composer.However, when I look at the excerpt of code you are showing, it looks like this could be fixed by using
__DIR__. Would you kindly editvendor/doctrine/orm/doctrineso that it looks like this:And then report back?
@roo7cause commented on GitHub (Mar 26, 2021):
Hey @greg0ire, thanks for comming back to me on this. First, I apologize for opening this issue in Doctrine Project, rather than Composer - thought it was part of the Doctrine.
And yes, if I do the change like you said, it works.
Do you believe this is worth reporting as a some sort of a Bug in Composer ?
@greg0ire commented on GitHub (Mar 26, 2021):
Oh no you're in the right place actually, because as you just proved to yourself it can be fixed here.
Then please send a PR
I'm not sure. When you remove the if block, you said it worked, but doesn't it also print the shebang to the output?
#!/usr/bin/env php<-- that's the shebang@roo7cause commented on GitHub (Mar 26, 2021):
When I execute this:
$ vendor/bin/doctrine orm:schema-tool:createwith
if-blockcommented out, it outputs:[OK] No Metadata Classes to process.This is (at the moment) expected output. I do not see the shebang part though, at least not in my CMD console. Do you expect the shebang output elsewhere?
@roo7cause commented on GitHub (Mar 26, 2021):
@greg0ire I believe that the shebang part is only because of fetching the file contents from the
/doctrine/orm/bin/doctrine.But as for the usage of the script, I am not sure if this is necessary at all. We just need the
$binPathto thedoctrine.phpfile., as we want to include it in our project. Maybe this feature is needed for some other OS?If not, I believe better fix is actually removing all of the
REGEXandIFand just send the$binPathto theincludestatement, which will eventually include thedoctrine.phpfile.@greg0ire commented on GitHub (Mar 26, 2021):
I was expecting the shebang to be wrongly output, but it looks like it isn't. So maybe you can try reporting that to Composer.
@roo7cause commented on GitHub (Mar 26, 2021):
Will try reaching out. Thanks.
With this I believe we can close this issue at Doctrine's site. :)