Uploaded image for project: 'Doctrine MongoDB ODM'
  1. Doctrine MongoDB ODM
  2. MODM-63

More errors when persisting gridfs files

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.0BETA2
    • Component/s: Persister
    • 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.

        Activity

        Hide
        jwage Jonathan H. Wage added a comment -

        This should be fixed now.

        Show
        jwage Jonathan H. Wage added a comment - This should be fixed now.
        Hide
        vladar Vladimir Razuvaev added a comment -

        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?

        Show
        vladar Vladimir Razuvaev added a comment - 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?
        Hide
        jwage Jonathan H. Wage added a comment -

        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.

        Show
        jwage Jonathan H. Wage added a comment - 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.
        Hide
        jwage Jonathan H. Wage added a comment -

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

        Show
        jwage Jonathan H. Wage added a comment - We'll need a test case, always. Or atleast some kind of pasted code that I can use to produce the issue.

          People

          • Assignee:
            jwage Jonathan H. Wage
            Reporter:
            vladar Vladimir Razuvaev
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: