Contao\FrontendUser::setUserFromDb PHP Method

setUserFromDb() protected method

Set all user properties from a database record
protected setUserFromDb ( )
    protected function setUserFromDb()
    {
        $this->intId = $this->id;
        // Unserialize values
        foreach ($this->arrData as $k => $v) {
            if (!is_numeric($v)) {
                $this->{$k} = \StringUtil::deserialize($v);
            }
        }
        // Set language
        if ($this->language != '') {
            \System::getContainer()->get('request_stack')->getCurrentRequest()->setLocale($this->language);
            \System::getContainer()->get('translator')->setLocale($this->language);
            // Deprecated since Contao 4.0, to be removed in Contao 5.0
            $GLOBALS['TL_LANGUAGE'] = str_replace('_', '-', $this->language);
        }
        $GLOBALS['TL_USERNAME'] = $this->username;
        // Make sure that groups is an array
        if (!is_array($this->groups)) {
            $this->groups = $this->groups != '' ? array($this->groups) : array();
        }
        // Skip inactive groups
        if (($objGroups = \MemberGroupModel::findAllActive()) !== null) {
            $this->groups = array_intersect($this->groups, $objGroups->fetchEach('id'));
        }
        // Get the group login page
        if ($this->groups[0] > 0) {
            $objGroup = \MemberGroupModel::findPublishedById($this->groups[0]);
            if ($objGroup !== null && $objGroup->redirect && $objGroup->jumpTo) {
                $this->strLoginPage = $objGroup->jumpTo;
            }
        }
    }