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

Symfony mongodb objectID error #376

Closed
didslm opened this issue Aug 4, 2016 · 4 comments
Closed

Symfony mongodb objectID error #376

didslm opened this issue Aug 4, 2016 · 4 comments

Comments

@didslm
Copy link

didslm commented Aug 4, 2016

Im trying to insert data into mongodb from symfony, and i got the error like

Attempted to load class "ObjectID" from namespace "MongoDB\BSON".
Did you forget a "use" statement for another namespace?
i checked the file MongoId.php and the else part new ObjectID(); requires a parameter but there is none
in vendor/alcaeus/mongo-php-adapter/lib/Mongo/MongoId.php at line 215

} elseif ($id instanceof self || $id instanceof ObjectID) { $this->objectID = new ObjectID((string) $id); } else { $this->objectID = new ObjectId(); } } catch (\Exception $e) { throw new MongoException('Invalid object ID', 19);

@alcaeus
Copy link
Member

alcaeus commented Aug 4, 2016

This looks like it could be an issue in mongo-php-adapter. I've created an issue there and will take a look at it later today. Thanks for the report!

@alcaeus alcaeus closed this as completed Aug 4, 2016
@alcaeus
Copy link
Member

alcaeus commented Aug 5, 2016

I've fixed this in mongo-php-adapter - could you give dev-1.0.x a quick test run?

@thmohd
Copy link

thmohd commented May 19, 2017

I am still having same issue:

Attempted to load class "ObjectID" from namespace "MongoDB\BSON".
Did you forget a "use" statement for another namespace?
} elseif ($id instanceof self || $id instanceof ObjectID) {
$this->objectID = new ObjectID((string) $id);
} else {
$this->objectID = new ObjectID();
}
} catch (\Exception $e) {
throw new MongoException('Invalid object ID', 19);

@alcaeus
Copy link
Member

alcaeus commented May 19, 2017

Please create a ticket at https://github.com/alcaeus/mongo-php-adapter/issues along with the following information:

  • Version of mongo-php-adapter used
  • Version of ext-mongodb used
  • Your operating system

I'm locking this ticket since this is not an issue with the bundle or with MongoDB ODM, so future issues will be directed to the adapter directly.

@doctrine doctrine locked and limited conversation to collaborators May 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants