Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where is the Driver namespace? #55

Closed
mvatansever opened this issue Dec 4, 2015 · 7 comments
Closed

Where is the Driver namespace? #55

mvatansever opened this issue Dec 4, 2015 · 7 comments

Comments

@mvatansever
Copy link

I have installed this package from composer and despite the use of Driver namespace it's not defined.

@bjori
Copy link
Contributor

bjori commented Dec 4, 2015

I'm not sure what you mean.

What exactly isn't defined? Can you paste the exact error message?

I suspect maybe you didn't install the driver itself properly, try:

pecl install mongodb

@mdoelker
Copy link

You also need to remove the old mongo extension for it to work properly.

@jmikola
Copy link
Member

jmikola commented Dec 28, 2015

You also need to remove the old mongo extension for it to work properly.

That should not be necessary as both extensions occupy different namespaces (top-level for legacy and MongoDB\Driver for new) and should not conflict.

@pashadude
Copy link

I had some problems with BSON and Driver namespaces. My IDE (PhpStorm) says that those namespaces are undefined. MongoDb extension definetly is being loaded by PHP interpreter theIDE uses. I don't have old mongo anywhere in the system and don't have any links to old mongo anywhere in the configs or libraries. I have installed mongodb via pecl. - But the problem was in the IDE itself - it uses only official libraries for syntaxis analysis. So it highlights namespaces as undefined even though the code itself works. may be @beyazkurt has the same issue.

@deividaspetraitis
Copy link

The same problem and for me. IDE says that namespaces are undefined. I have installed driver by pecl as in described in instructions. IDE is PHPStorm.

@mdoelker
Copy link

mdoelker commented Jan 4, 2016

That should not be necessary as both extensions occupy different namespaces (top-level for legacy and MongoDB\Driver for new) and should not conflict.

I thought the same, but the classes would not be available until i disabled the old extension.

The same problem and for me. IDE says that namespaces are undefined. I have installed driver by pecl as in described in instructions. IDE is PHPStorm.

The current version of PHPStorm doesn't include the stubs for the new extension yet. You can add the stub file to your project though to get the autocomplete until it officially arrives in an update. Get it from here: https://raw.githubusercontent.com/JetBrains/phpstorm-stubs/master/mongodb.php

@jmikola
Copy link
Member

jmikola commented Jan 6, 2016

IDE stubs are currently being left to the community and IDE authors, so I'm going to close this out.

Note that the extension does have reflection info defined to assist with stub generation. Any discrepancies between that info and reality (or PHP.net docs) are definitely a bug that we'll gladly look into. We've had a few reports already, which were fixed and should appear in any recently generated stubs.

@jmikola jmikola closed this as completed Jan 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants