Zend_Auth and Firebird DB

A short question for PRO. Can Zend_Auth_Adapter_DbTable be used with ZendX_Db_Adapter? I've tried this:

$adapter = new Zend_Auth_Adapter_DbTable(
    Zend_Registry::get('db')
);
$adapter->setTableName('USERS')
    ->setIdentityColumn('username')
    ->setCredentialColumn('password')
    ->setIdentity('FOO')
    ->setCredential('BAR');
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate();

      

But that won't work. ErrorMsg: Truncated fatal error: argument 1 passed to Zend_Auth :: authenticate () must implement Zend_Auth_Adapter_Interface, none of the above, called in D: \ xampp \ htdocs \ liquidisales-online \ application \ controllers \ IndexController.php on line 35 and defined in D: \ xampp \ htdocs \ liquidisales-online \ library \ Zend \ Auth.php on line 115

Any hints? Btw. ZendX_Db_Adapter ist registered in application.ini

resources.db.adapter = Firebird
resources.db.params.dbname = "/var/db/liquisales.FDB"
resources.db.params.host = "127.0.0.1"
resources.db.params.username = sysdba
resources.db.params.password = masterkey
resources.db.params.adapterNamespace = "ZendX_Db_Adapter"

      

+2


source to share


2 answers


Ok, here's the correct way to use Firebird DB with Zend_Auth. At first, we had to use capitol letters for the column names. Also, I forgot to pass the adapter.

Here's the correct code.



$adapter = new Zend_Auth_Adapter_DbTable(
    Zend_Registry::get('db')
);
$adapter->setTableName('USERS')
    ->setIdentityColumn('USERNAME')
    ->setCredentialColumn('PASSWORD')
    ->setIdentity($loginForm->getValue('kunummer'))
    ->setCredential($loginForm->getValue('passwd'));
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($adapter);

      

+2


source


it seems like your adapter doesn't implement all the required methods .... so you have to code the authentication yourself.



+1


source







All Articles