[MODM-125] Doctrine\ODM\MongoDB\MongoCollection::findOne does not invoke postFindOne event handlers doing query against MongoGridFS collection Created: 18/Feb/11  Updated: 04/Mar/11  Resolved: 04/Mar/11

Status: Resolved
Project: Doctrine MongoDB ODM
Component/s: Mongo, MongoCollection, MongoCursor
Affects Version/s: 1.0.0BETA2
Fix Version/s: 1.0.0BETA3

Type: Bug Priority: Major
Reporter: Vitaliy Kaplich Assignee: Jonathan H. Wage
Resolution: Cannot Reproduce Votes: 0
Labels: None
Environment:

CentOS, PHP 5.3



 Description   

subj

it happens because the code goes out of the function at line 334 in file
\Doctrine\ODM\MongoDB\MongoCollection.php
without invoking appropriate event handlers

thanks!



 Comments   
Comment by Vitaliy Kaplich [ 18/Feb/11 ]

And the same bug with Doctrine\ODM\MongoDB\MongoCollection::getDBRef method as well

Comment by Jonathan H. Wage [ 04/Mar/11 ]

Which version are you using? I don't see this behavior any longer. Can you confirm?

Comment by Jonathan H. Wage [ 04/Mar/11 ]

Also, getDBRef() notifies the pre/postGetDBRef events.

Comment by Jonathan H. Wage [ 04/Mar/11 ]

If you can still reproduce the issue can you provide a test case for us to run?

Comment by Vitaliy Kaplich [ 04/Mar/11 ]

I'm using 1.0.0BETA1

https://github.com/doctrine/mongodb-odm/blob/1.0.0BETA1/lib/Doctrine/ODM/MongoDB/MongoCollection.php

there is a "return" at line 338

so the function invoke "preFindOne" but not "postFindOne"





[MODM-124] ClassMetadata shouldn't store defaultDb value Created: 18/Feb/11  Updated: 04/Mar/11  Resolved: 04/Mar/11

Status: Resolved
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA2
Fix Version/s: 1.0.0BETA3

Type: Bug Priority: Major
Reporter: Vladimir Razuvaev Assignee: Jonathan H. Wage
Resolution: Fixed Votes: 0
Labels: None


 Description   

Currently if document doesn't have "db" mapping, it is taken from defaultDb configuration and assigned to classmetadata (in ClassMetadataFactory).

But if we have two documentManagers with different defaultDb configuration, second manager's configuration will be ignored, because "db" value is already set in classMetadata (when the 1st manager was created).

It gets worse with metadata caching, as defaultDb setting is only taken in account when metadata is stored in cache.

This affects a common use-case, when each customer has his own database and defaultDb is defined at runtime.



 Comments   
Comment by Jonathan H. Wage [ 04/Mar/11 ]

Hi, this is fixed here https://github.com/doctrine/mongodb-odm/commit/6b91d944e68bbf94702a38351f03c74b7d6a057a

Thanks for reporting the issue.





[MODM-105] inversedBy as ORM Created: 07/Jan/11  Updated: 04/Mar/11  Resolved: 04/Mar/11

Status: Resolved
Project: Doctrine MongoDB ODM
Component/s: None
Affects Version/s: 1.0.0BETA2
Fix Version/s: 1.0.0BETA3

Type: New Feature Priority: Major
Reporter: Henrik Bjornskov Assignee: Jonathan H. Wage
Resolution: Fixed Votes: 0
Labels: None


 Description   

A way to specify "inversedBy" when mapping referenceOne and referenceMany as the ORM have it.



 Comments   
Comment by Jonathan H. Wage [ 11/Feb/11 ]

hmm. I am not sure if having inversedBy makes sense for the mongodb odm based on how references currently work. What would it be used for? relationships in the odm don't work like they do in the orm. We don't use foreign keys to get a reference, we store a reference document on the document that is doing the referencing.

Comment by Jonathan H. Wage [ 19/Feb/11 ]

Thinking about this more:

/** @Document */
class Product
{
    /** @ReferenceOne(targetDocument="Seller") */
    private $seller;
}

/** @Document */
class Seller
{
    /** @ReferenceMany(targetDocument="Product", inversedBy="seller") */
    private $products;
}

Now the $products association will be loaded by running a query like this:

db.products.find({ 'seller.$id' : seller.id })

Is this what you mean?

Comment by Henrik Bjornskov [ 20/Feb/11 ]

Sorry not getting back to you about this sooner. But that is exactly what i mean can also be done for reference one i think

Comment by Jonathan H. Wage [ 20/Feb/11 ]

Can you help me think through the other scenariors where it can be used? and how mappedBy would be used. We just need to be sure to think through all the semantics and define it all before I start trying to implement it.

Comment by Jonathan H. Wage [ 20/Feb/11 ]

I implemented this here https://github.com/doctrine/mongodb-odm/commit/d1bffbd6bb7b7b690e25f1314f1bf6b69f1e41a6

Can you check it out and give some feedback?

Comment by Henrik Bjornskov [ 21/Feb/11 ]

Yes i will play around with it later today





Generated at Tue Nov 25 00:44:23 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.