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
2
votes
1 answer

Remove item from array in a mongodb document using Doctrine ODM

I have a mongoDB document comprising the following structure: { "_id" : ObjectId("537b9731fa4634134c8b45aa"), "kpis" : [ { "id" : 4, "value" : 3.78, …
Lee Davis
  • 4,685
  • 3
  • 28
  • 39
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

Weird Doctrine ODM exception when using references together with inheritance

I've got three classes. The File-Class has a reference to Foobar and Game inherits from Foobar. There are some other Classes which also inherit from Foobar but i left them out as they aren't relevant here. I also left out some unrelevant fields and…
Gigala
  • 143
  • 2
  • 10
2
votes
2 answers

Injecting Logger in Symfony 2 ODM Documents

I am currently developing a Symfony 2 Application and I want to log when some setters are called in my Models. As I see, there is no way to inject the logger by default or access it via a static registry in Symfony 2, so my approach is as follows: I…
Paul Weber
  • 6,518
  • 3
  • 43
  • 52
2
votes
0 answers

Doctrine ODM clone document with referenceMany

I have a problem when i want persist my clone document. The clone is ok but when i persist a document i lose the referenceMany. Why? All variable are persist except the variable with @MongoDB\ReferenceMany is skip. /** * @MongoDB\Document */ class…
vinzcoco
  • 89
  • 1
  • 9
2
votes
1 answer

Named collection keys in ArrayCollection

I'm looking for a way to have an associative array keys for a ODM ArrayCollection. The entity has the following mapping: /** * $fields * * The entities fields * * @ODM\ReferenceMany(targetDocument="JobboardEntity\Entity\EntityField",…
AlexP
  • 9,906
  • 1
  • 24
  • 43
2
votes
1 answer

AND and OR expression in Doctrine ODM

I need to transform a SQL request into a DQL request : SELECT * FROM object WHERE stardate >= GETDATE() AND enddate <= GETDATE() OR stardate >= GETDATE() AND enddate IS NULL I tried with : $now = new \DateTime(); $qb = $this->createQueryBuilder() …
Cyril F
  • 1,247
  • 3
  • 16
  • 31
2
votes
2 answers

Doctrine and Multiple Entity associations

Using Doctrine 2 and Symfony here. I'm fairly new to Doctrine and can't find what I'm looking for in their docs, so I'm looking for some guidance on a situation. I have these entities: 1. Profile (profile of a person, a person can have many…
Bob
  • 209
  • 2
  • 11
2
votes
1 answer

Doctrine mongo odm, annotate and query mongo ObjectId?

Hey There Im trying to map some documents in a mongodb and everything works perfect like this /** * @MongoDB\Id */ protected $id; /** * @MongoDB\Field(type="string",name="text") */ protected $text; but what if i have a field with a refference…
john Smith
  • 17,409
  • 11
  • 76
  • 117
2
votes
0 answers

Doctrine Mongo ODM - select distinct values

I need to select distinct values from a mongoDB collection. As is described in docs here for this can be used "distinct". But it returns only the fields that was used in distinct condition (ArrayIterator object), not as loggable cursor object: …
user2623505
  • 309
  • 5
  • 14
2
votes
0 answers

JMSSerializerBundle, MongoDB, and XML Metadata

I've been wracking my brain over this all night it seems. Every time I try to serialize the results from a document query, I receive a result of bool(false). Presumably this means that the serialization is failing (great! Perhaps you'd be willing to…
Sean Quinn
  • 2,131
  • 1
  • 18
  • 48
2
votes
1 answer

Setting TTL for collection using Doctrine MongoDB ODM

Since MongoDB 2.2 it is possible to "Expire Data from Collections Using a TTL" which is implemented as a special index type. The latest version of Doctrine ORM supports this Index Option. Unfortunately I have not been able to find how to correctly…
Onema
  • 7,331
  • 12
  • 66
  • 102
2
votes
1 answer

Symfony2 unique constraint with multiple fields and mongodb

I've started working with Symfony2 and MongoDB (Doctrine ODM) and am having difficulty getting the unique validator constraint to work on multiple fields (one field references another MongoDB document with DBRef). In my validation.yml file, I…
burr
  • 303
  • 2
  • 9
2
votes
1 answer

ODM Annotation : What is "strategy" attribute?

What is strategy attribute in @EmbedOne annotation? And what is the difference between its values? set , pushAll I not find any good explain in references about Annotation in ODM,like Annotations Reference , ... Is there a complete reference,cheat…
ABS
  • 2,626
  • 3
  • 28
  • 44
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