unique_key() public method

Allows a model use both email and username as unique identifiers for login
public unique_key ( $value ) : string
return string field name
Exemplo n.º 1
0
	/**
	 * Allows a model to use a user id, in addition to email and username, as unique identifier.
	 *
	 * @param   mixed   unique value
	 * @return  string  field name
	 */
	public function unique_key($value)
	{
		return (is_int($value)) ? 'id' : parent::unique_key($value);
	}
Exemplo n.º 2
0
 /**
  * 
  * @dataProvider  provider_unique_key
  */
 public function test_unique_key($value, $expected_attribute)
 {
     $this->assertEquals($expected_attribute, Model_Auth_User::unique_key($value));
 }