mongor icon indicating copy to clipboard operation
mongor copied to clipboard

mongoauth problem

Open themars opened this issue 12 years ago • 0 comments

Method "retrieve" in MongoAuth works not good enough. When session ends var $id will be string not a MongoId object, to fix this just do next:

public function retrieve($id)
{
    if (is_null($id) || $id == '')
    {
        return NULL;
    }

    if (is_string($id))
    {
        $id = new \MongoId($id);
    }

    return $this->model()->where("_id", $id)->first();
}

themars avatar Oct 04 '12 16:10 themars