Changes
Title
unchanged
Using multiple models in an identity
Category
unchanged
How-tos
Yii version
unchanged
2.0
Tags
unchanged
authentication,identity
Content
changed
[...]
private $_authkey;
private $_passwordHash;
public static function findIdentity($id)
{
// We are going to login, so `$id` will be an empty string
// `if (\count($parts) !== 2)` will raise an error because the parameter $id is empty
if (strlen($id) === 0) {
return null;
}
$parts = explode('-', $id);
if (\count($parts) !== 2) {
throw new InvalidCallException('id should be in form of Type-number');
}
[$type, $number] = $parts;[...]