/** * Save the container $this->objUserGeolocation into the Session */ protected function saveSession() { $this->objUserGeolocation->setIP(preg_replace("/\\.\\d?\\d?\\d?\$/", ".0", $this->objUserGeolocation->getIP())); // Save all data from the container to the session. $arrData = $this->objUserGeolocation->asArray(); // See #6747 in contao core. $arrSessionData = $this->Session->getData(); if (empty($arrSessionData)) { $this->Session->setData(array('geolocation' => $arrData)); } else { $this->Session->appendData(array('geolocation' => $arrData)); } }