/** * Initialize the authentication, picking up on session data if possible. * * @return bool */ public function initialize() { if ($this->checkAuthentication()) { $data = $this->getAuthenticationData(); $userId = $data['user_id']; $user = $this->toolkit->getRepository(\Model\User::class)->getById($userId); if (!$user) { $this->setAuthenticated(false); $this->setAuthenticationData([]); return false; } $this->setUser($user); return true; } return false; }
/** * Magic get function to pass through all calls to DI-able classes. * * @param string $property * * @return null|object */ public function __get($property) { $mappedProperty = $this->toolkit->getResourceMapping(ucfirst($property)); if ($mappedProperty) { return \Parable\DI\Container::get($mappedProperty); } return null; }