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

MongoDB ODM Indexing : How to Index multiple Compound index on a documnt that have EmbeddedDocument in itself?

I have this classes: /** * @ODM\Document * @Indexes({ * @Index(keys={"status"="asc", "regDate"="desc", "expDate"="asc", "isFeatured"="asc"}), * @Index(keys={"status"="asc", "visits.total"="asc", "visists.today"="asc"}), * …
ABS
  • 2,626
  • 3
  • 28
  • 44
4
votes
1 answer

Doctrine Query from Mysql

I want to create a Doctrine Query: (Doctrine 2.3) SELECT * FROM `car` WHERE `plate` like '%' AND (`datetime` BETWEEN '2013-03-13 22:20:18' AND '2013-03-13 22:20:20') OR (`datetime` BETWEEN '2013-03-13 15:10:18' AND '2013-03-13 15:10:16') I tried…
DonOfDen
  • 3,968
  • 11
  • 62
  • 112
4
votes
2 answers

FOSRestBundle and JMS Serializer, error when geting JSON

I have been trying out Symfony 2.2, the FOSRest Bundle (using JMS Serializer), and Doctrine ODM using MongoDB. After many hours of trying to figure out how to correctly setup the FOSRest Bundle I'm still having some trouble: I have a very simple…
Onema
  • 7,331
  • 12
  • 66
  • 102
4
votes
2 answers

Why is fetching MongoDB results slow when actual query took only few milliseconds?

I'm using Doctrine MongoDB ODM to fetch a small number of documents from a remote MongoDB database. I confirmed the query took only 1ms to find about 12 matching docs. (i.e. 'millis':1 from explain ouput). But iterating through the results took…
Jaepil
  • 390
  • 5
  • 20
4
votes
3 answers

Testing for unset or missing fields in MongoDB

Is there a way when querying a MongoDB database to test for fields that either: Haven't been set yet Are set to null ...and as a bonus, are an array that contain null as one of their values?
Alexander Trauzzi
  • 7,277
  • 13
  • 68
  • 112
4
votes
2 answers

Doctrine MongoDB ODM nullable=false not working

I'm using the master branch of Doctrine MongoDB ODM and Symfony2 from the git repositories along with mongo extension 1.2.10. I've created a number of classes/documents with annotations similar to: namespace Acme\StoreBundle\Document; use…
CrEOF
  • 121
  • 1
  • 8
4
votes
1 answer

How can I set my own MongoId with Doctrine ODM for MongoDB?

use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; /** * @ODM\Document() */ class My_Doctrine_Model { /** @ODM\id */ protected $id; public function getId() { return $this->id; } public function setId($value) …
Oscar
  • 130
  • 1
  • 8
3
votes
1 answer

Doctrine2 ODM - [Semantical Error]

I keep getting this error: PHP Fatal error: Uncaught exception 'Doctrine\Common\Annotations\AnnotationException' with message '[Semantical Error] The annotation "@Document" in class Documents\Translation was never imported.' in …
Bryan M.
  • 33
  • 4
3
votes
4 answers

Doctrine ODM / PHP / MongoDB - Can't query Referenced Elements

I have an Event, that has a Privilege and this Privilege references a User. I'm trying to get all the events associated with a User, but I can't seem to get doctrine working as I'd like. Here is my Mongo Schema Array ( [_id] =>…
remi
  • 121
  • 1
  • 7
3
votes
1 answer

api-platform odm iri reference won't be converted into objects in json

I want to create a model like this. { "id": 7653, "name": "Vortl 123", "category": [ { "name": "Electronic", "url": "electronic", "id": 1 }, { "name": "Phone", "url": "phone", "id": 2 }, { …
nogabemist
  • 402
  • 5
  • 29
3
votes
1 answer

Symfony 4 Voters - Roles and Permissions Questions

I started working on a Voter System to secure my URLs and I have many questions. First, I don't know if I have to work with "Roles" or with "Permissions". By "Roles" I mean something like Role_User, Role_Manager, etc. And by "Permissions", I mean…
Etshy
  • 870
  • 7
  • 25
3
votes
0 answers

Doctrine: ODM vs. ORM

I consider using ODM/ORM/mixing ODM and ORM entities in my new Doctrine 2.0 project. When should I use ORM (MySQL InnoDB) and when ODM (MongoDB)? Should I mix it in one project? Pseudo structure of my app (Google Reader like): user { id, login,…
elniño
  • 121
  • 1
  • 7
3
votes
1 answer

Doctrine MongoDB ODM - Return only matched embedded document using query builder

I am having trouble in returning only the matched embedded document using MongoDB ODM query builder in PHP. Each embedded document has a MongoID generated at the time of creation. Following is my document structure of collection Project: { …
Seeker
  • 1,877
  • 4
  • 32
  • 56
3
votes
0 answers

Doctrine Mongodb : How to use collation in queries

It looks like mongodb already supports collation: https://docs.mongodb.com/manual/reference/collation/, and by using that on collection level, we can perform case insensitive queries. Is there a way to use this collation feature in Doctrine ODM? I…
EastSw
  • 927
  • 1
  • 9
  • 28
3
votes
1 answer

Sonata Doctrine Phpcr Admin Bundle: Change parent of node

I have problem with changing parent of document inside sonata admin. My document has property like this: /** * @PHPCRODM\Children(filter="teaserimage*", cascade="persist") * @var Image[] */ protected $teaserImages; .... /** *…