setting Identity properties

Notice: This thread is very old.
Member | 21

Hello there,

I have more or less dumb question.
I have following piece of code in signInFormSucceeded method (almost default SignPresenter.php):

$this->getUser()->login($values->username, $values->username);
$this->user->Identity->username = 'foo';

but in debuger I get this message:
Creating default object from empty value

what should I do to be able to create custom properties of Identity?

Thank you,
Kind regards.

EDIT: nette 2.2.2, using UserManager. New to PHP, new to Nette.
Today I found I can use “$user->getIdentity()->/database_column_name/”. Can I add some extraordinary object to Identity->Data? How?

Last edited by ydenda (2014-08-21 21:17)

Member | 118


  • identity should start with lowercase i, you can use $this->user->identity or $this->user->getIdentity()
  • you should build your identity inside the authenticator – build a custom authenticator, returning your implementation of Nette\Security\IIdentity with your desired custom properties. See…cess-control#…