here's my getter:
public function __get($field)
{
if ($field == 'userId'):
return $this->uid;
else:
return $this->fields[$field];
endif;
}
here's my constructor
public function __construct()
{
$this->uid = null;
$this->fields = array(
'username' => '',
'password' => '',
'firstname' => '',
'lastname' => '',
'email' => '',
'is_active' => false
);
$this->session = Session::Instance();
$this->profiler = new Profiler();
$this->encrypt = new Encrypt();
}
everytime i access this function:
private function handle_pass($password, $username=null, $encrypt=true)
{
if ($encrypt) :
return $this->encrypt->encode($password);
else:
$query = ORM::factory('user');
$result = $query
->select('password')
->where('username', $username)
->find();
$compare_pass = $this->encrypt->decode($password);
return ($compare_pass === $result->password);
endif;
}
i get this error
application/libraries/User.php: Undefined index: encrypt // this is the error message
application/libraries/User.php:User->__get( encrypt ) // this is the last method executed