public function startSession($user_id)
    {
        $this->deleteOldSessions();

        $user_id = (int)$user_id;
        $sid = $this->generateUserSid($user_id);

        $session = UsersSessionEntityRepository::findOneEntityByCriteria([
            'sid'     => $sid,
            'user_id' => $user_id,
        ]);
        if (!$session) {
            $session = new UsersSessionEntity();
        }
        $session->setSid($sid);
        $session->setUserId($user_id);
        $session->save();

        return $sid;
    }
public function startSession($user_id)
    {
        $this->deleteOldSessions();

        $user_id = (int)$user_id;
        $sid = $this->generateUserSid($user_id);

        $session = UsersSessionEntityRepository::findOneEntityByCriteria([
            'sid'     => $sid,
            'user_id' => $user_id,
        ]);
        if (!$session) {
            $session = new UsersSessionEntity();
        }
        $session->setSid($sid);
        $session->setUserId($user_id);
        $session->save();

        return $sid;
    }
public function startSession ( $ user_id ) { $ this -> deleteOldSessions ( ) ; $ user_id = ( int ) $ user_id ; $ sid = $ this -> generateUserSid ( $ user_id ) ; $ session = UsersSessionEntityRepository :: findOneEntityByCriteria ( [ 'sid' => $ sid , 'user_id' => $ user_id , ] ) ; if ( ! $ session ) { $ session = new UsersSessionEntity ( ) ; } $ session -> setSid ( $ sid ) ; $ session -> setUserId ( $ user_id ) ; $ session -> save ( ) ; return $ sid ; }
Starts session for admin user

@param int $user_id

@return string session id
Starts session for admin user