Here is the problem. I have an eshop with users, they do not need to create account when ordering something, but they have a chance for it. I have a user that he first time refuse registering (I also save his data into User table with his email for order porpouses) but now he confirm and register account with new order he made. So what happens.. now he has two accounts in my db with same emails..(dont know why yet, it shouldnt). I have column in my db called active, if user is registered then active is 1. How can i tell ZendAuth to only choose this type of account?
Zend Error message now: More than one record matches the supplied identity.
My code:
$db = Zend_Registry::get('db');
$authAdapter = new Zend_Auth_Adapter_DbTable($db);
$authAdapter->setTableName('user');
$authAdapter->setCredentialColumn('password');
$authAdapter->setIdentityColumn('email');
$authAdapter->setCredential($password);
$authAdapter->setIdentity($email);
I´am looking for something like $authAdapter->setContition('active = 1'); any suggestion?
You can use the
getDbSelectmethod ofZend_Auth_Adapter_DbTableto access the adapter'sZend_Db_Selectinstance and set your additional criteria on it. The docs show exactly your case in the last example.If possible you should consider adding a unique index for the email column.