How to add credential column in authentication adepter using ZF
My开发者_运维知识库 auth adapter is like below
$authAdapter->setTableName('register')
->setIdentityColumn('username')
->setCredentialColumn('pwd');
It's working fine :
but now i want to check status column active/inactive also.
How can we add one more credential column here ?
You could use setCredentialTreatment()
method
$authAdapter->setTableName('register')
->setIdentityColumn('username')
->setCredentialColumn('pwd')
->setCredentialTreatment('? AND status = "active"');
$select = $authAdapter->getDbSelect();
$select->where('status = "active"');
$authAdapter->authenticate();
Have a look at the documentation, under the Advanced Usage By Example heading.
精彩评论