hpaul/mongor

mongoauth problem

Opened this issue · 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();
}