Last active
August 29, 2015 14:04
-
-
Save loicm/ac568e6cde0ca9ac18b4 to your computer and use it in GitHub Desktop.
Get MongoId
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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