Revision #4                                    has been created by 
 Néstor Acevedo                                    on Aug 30, 2024, 10:47:27 PM with the memo:
                                
                                
                                    Adding a return null if the parameter $id is empty due to accessing as guest.                                
                                                                    « previous (#3)                                                                                            
                            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;[...]