Questions tagged [doctrine-odm]

Doctrine Object Document Mapper is built for PHP 5.3.2+ and provides transparent persistence between PHP objects and data stores such as MongoDB, CouchDB, OrientDB, and PHPCR.

Doctrine Object Document Mapper is built for PHP 5.3.2+ and provides transparent persistence between PHP objects and data stores such as MongoDB, CouchDB, OrientDB, and PHPCR.

Related links

538 questions
3
votes
1 answer

How to truncate a MongoDB collection via the DoctrineMongoDBBundle?

I have a mongoDB collection and I want to programatically truncate it (remove all documents in this collection). I did this: $collection = $this ->container ->get('doctrine_mongodb') ->getRepository('AppBundle:User'); …
msniezko
  • 321
  • 1
  • 3
  • 11
3
votes
1 answer

Doctrine 2 ODM: Querying ID field with MongoRegex with LIKE

I have a bigger project using Doctrine 2 ODM in a Symfony context. Given a simple ODM entity as this (XML definition):
narcoticfresh
  • 257
  • 4
  • 10
3
votes
1 answer

Clone not working on embeded document in zf2 DoctrineMongoODMModule

This is my document /** @ODM\Field(type="string") */ private $Name; /** @ODM\Field(type="string") */ private $NormalizedName; /** @ODM\EmbedMany(targetDocument="BaselineBudget\Document\BaselineBudgetItems") */ private $BaselineBudgetItems =…
Navneet Garg
  • 1,364
  • 12
  • 29
3
votes
1 answer

Retrieve Document form CouchDb With DoctrineODM

I'm Using this bundle to manage my data I'm able to create the document, but I can't retrieve them I tried with $dm = $this->container->get('doctrine_couchdb.odm.default_document_manager'); $users =…
monkeyUser
  • 4,301
  • 7
  • 46
  • 95
3
votes
1 answer

Save update of one Doctrine document from preUpdate hook of another document?

I have an event subscriber for DocumentA. DocumentA has associated documents of type DocumentB. During the preUpdate lifecycle event hook for DocumentA, I'd like to refresh a value on its DocumentB. I have code like so: public function…
beth
  • 1,916
  • 4
  • 23
  • 39
3
votes
0 answers

Is it possible to use Value Object as id for Entity with Doctrine ODM?

I have Subscription entity, which represents one of many-to-many relations between users in Twitter-like following model. It has surrogate ID to ensure the uniqueness of relation, which is represented by Value Object SubscriptionId. SubscriptionId…
Vitaly Chirkov
  • 1,692
  • 3
  • 17
  • 33
3
votes
2 answers

Doctrine - How to hydrate a collection when using query builder

A previous question I asked was to do with hydrating a result set when using Doctrine and query builder. My issue was how to return an array and their sub-sets: This was for a single result set and the answer was quite simple: $qb =…
HappyCoder
  • 5,985
  • 6
  • 42
  • 73
3
votes
1 answer

MongoDB Doctrine: $in needs an array - Many to Many Relation

I have some categories which contain products, whereas you can add products to a category. This is a many to many relation, whereas products do not know of their relation to a category (as it is only saved inside a category). I will first post my…
tester
  • 3,977
  • 5
  • 39
  • 59
3
votes
1 answer

How to set up a Doctrine MongoDB respository in the Symfony 2 service container

How do I correctly set up the service container in my Symfony 2 application to support custom Document repositories? What I have so far is: services: acme.repository_user: class: Acme\Repository\UserRepository arguments:…
Luke
  • 20,878
  • 35
  • 119
  • 178
3
votes
1 answer

ClassNotFoundException: Attempted to load class "FlattenException" from namespace

I am developing an application using Symfony 2.4 and doctrine mongodb bundle. I have faced an annoying error saying: ClassNotFoundException: Attempted to load class "FlattenException" from namespace "Symfony\Component\Debug\Exception" in…
zeitnot
  • 1,304
  • 12
  • 28
3
votes
1 answer

MongoDb and Symfony2.4 file is not stored in Gridfs

I have implemented the file upload functionality with reference to this link http://www.slideshare.net/mongodb/mongo-db-bangalore-2012-15070802 But the file is not stored into the Gridfs. I had done some research for the same and also with…
asdwinner
  • 31
  • 5
3
votes
1 answer

Doctrine Mongo cascade remove children when child is the owning side

I have a parent/child OneToMany reference : /** * @ODM\Document */ class Parent { // ... /** * @var \Doctrine\Common\Collections\ArrayCollection * @ODM\ReferenceMany(targetDocument="Child", mappedBy="parent") */ …
Julien
  • 9,312
  • 10
  • 63
  • 86
3
votes
1 answer

Symfony 2 Doctrine ODM with reference

So I have two following documents: Wallpapers /** * @MongoDB\Document( * collection="wallpapers", * repositoryClass="Application\Bundle\DefaultBundle\Repository\WallpaperRepository" * ) */ class Wallpaper { /** *…
Alexandr Lensky
  • 233
  • 1
  • 8
3
votes
2 answers

Doctrine ODM Distinct With Limit

I have the following problem: I can't limit number of results when using distinct. Exemple : $stores = $this->dm->createQueryBuilder('Application\Document\Item') ->distinct('storeName') ->limit(10) ->getQuery() ->execute(); This query…
Siol
  • 311
  • 8
  • 21
3
votes
1 answer

Doctrine MongoDB delete reference only onRemove

I have a OneToMany Relationship between a ChartPage and a BaseChart: 1 ChartPage holds 1 BaseChart and 1 BaseChart holds many ChartPages Charts are managed in a different bundle of my application, so they can be removed individually. What I like to…
con
  • 2,358
  • 25
  • 33