I have converted a ObjectID to string which acts as a dropdown list value. When posted I need to take this string and convert it back to a ObjectID in the cleanest fashion.
What would be the best way of doing this?
I have converted a ObjectID to string which acts as a dropdown list value. When posted I need to take this string and convert it back to a ObjectID in the cleanest fashion.
What would be the best way of doing this?
It seems that MongoID class accepts a string in the constructor:
public MongoId::__construct ([ string $id = NULL ] )
id
A string to use as the id. Must be 24 hexidecimal characters. If an invalid string is passed to this constructor, the constructor will ignore it and create a new id value.