[MODM-63] More errors when persisting gridfs files Created: 28/Aug/10  Updated: 24/Nov/10  Resolved: 24/Nov/10

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

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


 Description   

Getting following errors when trying to persist GridFS file.

Trying to get property of non-object in file Doctrine\ODM\MongoDB\MongoCollection.php on line 196 
Undefined index: _id in file Doctrine\ODM\MongoDB\Persisters\BasicDocumentPersister.php on line 163 

Unfortunately couldn't create reproducable test-case yet, but if that is not an obvious issue, please let me know, I'll try to dig deeper and get the test case.



 Comments   
Comment by Jonathan H. Wage [ 30/Aug/10 ]

We'll need a test case, always. Or atleast some kind of pasted code that I can use to produce the issue.

Comment by Jonathan H. Wage [ 30/Aug/10 ]

Can you just paste the code that causes the error? Like you have done in previous issues. I can't seem to replicate this one.

Comment by Vladimir Razuvaev [ 31/Aug/10 ]

I've found a case when it happens. It is an exceptional situation when someone is trying to persist file without property $file being set.

E.g. the case:

/** @Document(db="tests", collection="fs") */
class a
{
    /** @Id */
    protected $id;

    /** @File */
    protected $file; // note, file is not set

    /** @String */
    protected $c = 'tmp';
}

$a = new a();
$dm->persist($a);
$dm->flush();

This test case produces notices and warnings. My guess is that it should end up with Exception?

Comment by Jonathan H. Wage [ 24/Nov/10 ]

This should be fixed now.

Generated at Wed Apr 16 05:23:13 UTC 2014 using JIRA 5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5.