Questions tagged [doctrine-mongodb]

Doctrine MongoDB Object Document Mapper provides transparent persistence for PHP objects to the MongoDB database.

Doctrine MongoDB Object Document Mapper is built for PHP 5.3.0+ and provides transparent persistence for PHP objects to the popular MongoDB database by 10gen.

76 questions
2
votes
2 answers

references class "Doctrine\ODM\MongoDB\UnitOfWork" but no such service exists

I'm currently using Symfony 4 with Doctrine MongoDB Bundle, following the instruction from this link: DoctrineMongoDBBundle. So, I have a UserDocument: src/Document/UserDocument.php /** @MongoDB\Document(collection="user",…
Hope
  • 97
  • 1
  • 9
2
votes
1 answer

Attempted to load class "ObjectID" from namespace "MongoDB\BSON"

I'm trying to use DoctrineMongoDBBundle but it gives me this error : Attempted to load class "ObjectID" from namespace "MongoDB\BSON". Did you forget a "use" statement for another namespace? I've searched all over for a reason, but I could not…
user8958506
2
votes
1 answer

Is it possible to use two diffrent document managers with different databases for the same bundle in Symfony?

My goal is to have two different document managers connected to different databases that share the same database models. I have heavily changed my database model and I would like to write a custom migration script that retrieves objects from the…
matyas
  • 2,696
  • 23
  • 29
2
votes
2 answers

ZF2, doctrine-mongodb and PHP7

I update a simple skeleton project ZF2 to PHP7 and I install the libraries for mongodb in php7 sudo pecl install mongodb And I add in cli php.in the line extension=mongodb.so I do a phpinfo and the extension of mongodb is 1.1.3-dev. I try to…
2
votes
1 answer

Efficiently check if document has children

I'm trying to build a lazy loading tree using Doctrine MongoDB. My document is structured as follows: /** * @ODM\Document(repositoryClass="CmsPage\Repository\PageRepository") */ class Page { /** * @ODM\String * @var string */ …
Bram Gerritsen
  • 7,178
  • 4
  • 35
  • 45
2
votes
1 answer

How to get a Custom User Provider working in Silex?

I could really use a second pair of eyes. I am attempting to create a custom user provider using Silex's SecurityServiceProvider in conjunction with Doctrine MongoDB ODM, and I keep receiving the following error when attempting to log…
Brett
  • 721
  • 2
  • 10
  • 20
2
votes
1 answer

Creating/persisting new document while preUpdate event in doctrine-mongodb

I'm using doctrine-mongodb-odm-1.0.0-BETA10 and trying to provide some custom logic based on \InitialDocument while preUpdate event running. Lets say \InitialDocument obtained some state which must behave as initial one for new \StateDocument. I'm…
lazycommit
  • 414
  • 5
  • 18
2
votes
1 answer

DoctrineMongoDB : How to set annotation in a document to store a specific structure?

I am implementing a php class that must model this : /** @Document */ classMember { /** @String */ protected $fname; /** @String */ protected $lname; /** @String */ protected $email; /** @Int */ protected $cell; …
ABS
  • 2,626
  • 3
  • 28
  • 44
2
votes
1 answer

DoctrineMongoDB : How to create classes from database?

It's possible to generate database from classes that have writeen by this command doctrine:mongodb:schema:create Is there any way to do this inversely? I mean generate classes from database?
ABS
  • 2,626
  • 3
  • 28
  • 44
2
votes
0 answers

Class is not a valid document or mapped super class

So I use my fork of CalendarBundle (http://github.com/permanaj/CalendarBundle), I install it, configure it, and extend it, because it usually the way to use a bundle. But when I try to run command it return error: …
Permana
  • 1,972
  • 2
  • 33
  • 51
2
votes
1 answer

Symfony2 and MongoDB Annotations / Mapping not recognized

I followed the steps descriped in the cookbook. But when i run doctrine:mapping:info or doctrine:generate:entities doctrine ignores my file. Here is the code, maybe someone has an advice. autoload.php use…
2
votes
1 answer

Changing the MongoDB collection on run time in symfony2 + doctrine

I'm using Symfony2 MongoDB + Doctrine and I want to tell doctrine to save my objects in collections with different name from the name of the class that defines the object. Also the name of the new collection should be the id of an object in…
Kik Minev
  • 103
  • 1
  • 3
  • 9
2
votes
1 answer

Unable to increment value in a doctrine mongo query

Looking at the example at: http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/query-builder-api.html I am unable to do a simple increment. That is the value of "votes" never changes. My document ID ($postID) is…
kratos
  • 2,465
  • 2
  • 27
  • 45
2
votes
2 answers

Document serialization with Doctrine MongoDB ODM

I'm trying to code a class handling serialization of documents by reading their metadata. I got inspired by this implementation for entities with Doctrine ORM and modified it to match how Doctrine ODM handles documents. Unfortunatly something is not…
2
votes
0 answers

DUPLICATE KEY ERROR same error message on different value

I get the same message error (duplicate key error index with same id on different value) when I would like to insert value after a failed. Key exist for value 15 to 17 in MONGODB, exception will be thrown. It's normal uses case but I get the same…