Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Facing "Undefined index: (fieldname) in Doctrine/ODM/MongoDB/UnitOfWork.php line 736" #433

Open
vmattila opened this Issue · 1 comment

2 participants

@vmattila

Hi,

I have recently faced very strange error when trying to update my documents with 1.0.0-beta6 version. The common code for all my trials is as follows:

$dm = $this->get('doctrine_mongodb.odm.default_document_manager');
$session = $dm->getRepository('BrowserSession')->find($this->get('session')->getId());
$session->incrementRequests();

// Continues with one of the code snippets below

1) If I try to call $dm->persist($session); $dm->flush(); an exception "Undefined index: requests in Doctrine/ODM/MongoDB/UnitOfWork.php line 736" is thrown.

2) $dm->flush($session); works properly.

3) $dm->flush(); does not do anything.

I am slightly confused what's going on. Previously, code snippet 1 has worked properly.

The document:

/**
 * @MongoDB\Document()
 * @MongoDB\ChangeTrackingPolicy("DEFERRED_EXPLICIT") 
 */
class BrowserSession
{

    // ID and other fields are here

    /**
     * @MongoDB\Increment
     * @var integer
     */
    protected $requests = 0;

    public function incrementRequests() { $this->requests++; }
}
@jmikola
Owner

This may be related to #483 (assuming the field name, and not type, is the problem in that issue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.