Doctrine orm Zend 2和条令2-设置凭证可手动调用
我正在尝试使用Zend Framework 2和Doctrine 2对用户进行身份验证 如何在控制器的操作方法中设置或更改credentialCallable选项Doctrine orm Zend 2和条令2-设置凭证可手动调用,doctrine-orm,zend-framework2,Doctrine Orm,Zend Framework2,我正在尝试使用Zend Framework 2和Doctrine 2对用户进行身份验证 如何在控制器的操作方法中设置或更改credentialCallable选项 $adapter = $this->getAuthService()->getAdapter(); // how to set credentialCallable option here $adapter->setIdentityValue($data['username']); $adapter->setC
$adapter = $this->getAuthService()->getAdapter();
// how to set credentialCallable option here
$adapter->setIdentityValue($data['username']);
$adapter->setCredentialValue($data['password']);
$result = $this->getAuthService()->authenticate();
顺便说一下,我知道如何在配置文件中设置它。(参见文档)我认为这应该是可行的:
$options = new \DoctrineModule\Options\Authentication;
$options->setCredentialCallable(function (User $user, $passwordGiven) { //body });
$adapter->setOptions($options);