Closed camohub closed 4 years ago
I found out it is related to Nette Authenticator where identity cant contain relations. In my implentation is this piece code, where the user->roles M:M relation hrows this error:
$rolesArr = [];
foreach ( $user->roles as $role ) {
$rolesArr[] = $role->name;
}
$userArr = $user->toArray();
// unset($userArr['roles']); // This M:M relation is the problem if it is stored as a thidr param of next Identity constructor. I am not sure if it is bug or how to solve it.
return new Nette\Security\Identity( $userArr['id'], $rolesArr, $userArr );
Ok I have it.
$userArr = $user->toArray(ToArrayConverter::RELATIONSHIP_AS_ARRAY);
Generally, we encourage users NOT to store entity (neither their all data) in session (Indentity), but rather store the primary key and fetch the entity again during each request.
Hi, I have a simple sign in form which throws me a weird error after success which seems to be related to Nextras/Orm. System configuration looks like: php: 7.2.25 "nextras/orm": "^3.1", "nette/application": "^3.0", "nette/bootstrap": "^3.0", "nette/caching": "^3.0", "nette/database": "^3.0", "nette/di": "^3.0", "nette/finder": "^2.5", "nette/forms": "^3.0", "nette/http": "^3.0", "nette/mail": "^3.0", "nette/robot-loader": "^3.0", "nette/security": "^3.0", "nette/utils": "^3.0", "latte/latte": "^2.5", "tracy/tracy": "^2.6", "kdyby/translation": "^3.0",
Its a new aplication so the packages should be the latest...
The one weird thing is Tracy does not catch the error it is like a PHP text. Here is an error message: