public static function findById($id)
{
if (!is_object($id)) {
$classname = get_called_class();
$collection = new $classname();
/** @var MongoCollection $collection */
if ($collection->getCollectionManager()->isUsingImplicitObjectIds($collection)) {
$mongoId = new ObjectID($id);
} else {
$mongoId = $id;
}
} else {
$mongoId = $id;
}
return static::findFirst([["_id" => $mongoId]]);
}