Skip to content

Instantly share code, notes, and snippets.

@loicm
Last active August 29, 2015 14:04
Show Gist options
  • Save loicm/ac568e6cde0ca9ac18b4 to your computer and use it in GitHub Desktop.
Save loicm/ac568e6cde0ca9ac18b4 to your computer and use it in GitHub Desktop.
Get MongoId
// a Foo Object
print_r($foo);
Foo Object
(
[name] => Jon
[email] => [email protected]
[_id] => MongoId Object
(
[$id] => 53c6bed12ce99716008b456f
)
)
// Access to _id
var_dump($foo->_id);
NULL
// Check $foo->_id is public
$refl = new \ReflectionObject($merchant);
$prop = $refl->getProperty('_id');
var_dump($prop->isPublic());
bool(true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment