Getting MongoId from PHP object returns NULL

332 Views Asked by At

I'm a bit stumped here.

I've upgraded an Ubuntu 13.10 dev machine to PHP 5.5.3 with the PECL Mongo driver 1.5.5.

Previously on 5.3.6 with 1.3.2.

All of my objects store their MongoId() on $class->_id;

Randomly, I'm getting that class variable now return as NULL, such as:

$log = new EmailEventLog;
$log->data = $event;
$log->email = $email->_id;
$log->save();

print_r(var_dump($log));        // contains correct ->_id variable

print_r(var_dump($log->_id));   // NULL

Nothing happens in between those two printouts, but I cannot access it!

FYI the class EmailEventLog extends M which has a public $_id; set on it. I've tried bringing that up to the natural class and it's not working still.

Thanks

EDIT - weirdly, closing the object and then getting the _id from the clone returns it as expected!

0

There are 0 best solutions below