Mongolid\Model\DocumentEmbedder::getId PHP Метод

getId() защищенный Метод

Gets the _id of the given object or array. If there is no _id in it a new _id will be generated and set on the object (while still returning it).
protected getId ( mixed &$object ) : MongoDB\BSON\ObjectID | mixed
$object mixed The object|array that the _id will be retrieved from.
Результат MongoDB\BSON\ObjectID | mixed
    protected function getId(&$object)
    {
        if (is_array($object)) {
            if (isset($object['_id']) && $object['_id']) {
                return $object['_id'];
            }
            return $object['_id'] = new ObjectID();
        }
        if (is_object($object) && !$object instanceof ObjectID) {
            if (isset($object->_id) && $object->_id) {
                return $object->_id;
            }
            return $object->_id = new ObjectID();
        }
        return $object;
    }