linkorb / openkvk-php

OpenKvk PHP Client Library + Command-line utility
14 stars 5 forks source link

bin/openkvk cannot find autoload.php #3

Closed nicwortel closed 10 years ago

nicwortel commented 10 years ago

When I tried the command line interface i got the following error:

PHP Warning: require_once(C:\path\to\project\vendor\linkorb\openkvk\bin/../vendor/autoload.php): failed to open stream: No such file or directory in C:\path\to\project\vendor\linkorb\openkvk\bin\openkvk on line 6

Changing line 6 to:

require_once(__DIR__ . "/../../../autoload.php");

fixed it for me.

nicwortel commented 10 years ago

@joostfaassen can you confirm this bug? Or am I doing something wrong?

joostfaassen commented 10 years ago

Hi @nicwortel,

I'm not sure yet... The .. path works if you use this repo standalone. (so git clone the repo, and run ./bin/openkvk) However, if you use this as a package in your own project, then yes, the fix you described is needed (as it's new located in vendor). I need to find out how other packages deal with this.. will get back to you about this.

In anycase, if you're using this as a library in your own project, you can probably better call the library directly, and not go through bin/openkvk :-)

nicwortel commented 10 years ago

Ah, ok, that makes sense.

I found this line in Doctrine ORM's CLI:

(@include_once __DIR__ . '/../vendor/autoload.php') || @include_once __DIR__ . '/../../../autoload.php';

I think that could be the solution!

joostfaassen commented 10 years ago

@nicwortel Good find! If you want you can make a pull-request for it, otherwise see if i can add it next week.. thanks!

joostfaassen commented 10 years ago

Merged pr 4