मैं सिद्धांत 2 और ZF2 का उपयोग करके प्रमाणीकरण करना चाहता हूं। कुछ मदद पाने के लिए मैंने Zend 2 + doctrine 2 Auth Adapter का उपयोग किया, लेकिन हर बार जब मैं $authService->authenticate($adapter);
पर कॉल करता हूं तो मुझे एक त्रुटि मिलती है कि वर्ग '' मौजूद नहीं है।Zend2 + Doctrine2 प्रमाणीकरण
ऐसा लगता है कि मेरे module.config.php से कॉन्फ़िगर # टी का उपयोग नहीं किया गया। यह इस तरह दिखाता है:
'authenticationadapter' => array(
'orm_default' => array(
'objectManager' => 'doctrine.entitymanager.orm_default',
'identityClass' => 'Profile\Entity\User',
'identityProperty' => 'username',
'credentialProperty' => 'password',
),
),
लेकिन अगर मैंने authService पर var_dump बनाया है तो सभी सेट शून्य हैं। मेरी सेवा में, जहां मैं लॉगिन करना चाहते हैं मैं
$authAdapter = $this->getAuthAdapter();
$authAdapter->setIdentityValue($username);
$authAdapter->setCredentialValue($password);
फोन $ authAdapter से एक डंप मुझसे कहता है कि IdentityValue और CredentialValue सही ढंग से स्थापित कर रहे हैं।
$ authAdabter में अन्य बातों के कर रहे हैं:
protected 'options' =>
object(DoctrineModule\Options\Authentication)[281]
protected 'objectManager' =>
object(Doctrine\ORM\EntityManager)[248]
private 'config' =>
object(Doctrine\ORM\Configuration)[250]
...
private 'conn' =>
object(Doctrine\DBAL\Connection)[252]
...
private 'metadataFactory' =>
object(Doctrine\ORM\Mapping\ClassMetadataFactory)[266]
...
private 'repositories' =>
array (size=0)
...
private 'unitOfWork' =>
object(Doctrine\ORM\UnitOfWork)[267]
...
private 'eventManager' =>
object(Doctrine\Common\EventManager)[242]
...
private 'hydrators' =>
array (size=0)
...
private 'proxyFactory' =>
object(Doctrine\ORM\Proxy\ProxyFactory)[268]
...
private 'expressionBuilder' => null
private 'closed' => boolean false
private 'filterCollection' => null
protected 'objectRepository' => null
protected 'identityClass' => null
protected 'identityProperty' => null
protected 'credentialProperty' => null
protected 'credentialCallable' => null
protected 'classMetadata' => null
protected 'storage' => null
protected '__strictMode__' => boolean true
protected 'authenticationResultInfo' => null
getAuthAdapter इस तरह पता चलता है:
public function getAuthAdapter()
{
if (null === $this->authAdapter) {
$this->authAdapter = $this->getServiceManager()
->get('doctrine.authenticationadapter.ormdefault');
}
return $this->authAdapter;
}
तो कुछ एक मुझे बताओ कैसे सही ढंग से विकल्प सेट करने के कर सकते हैं?
ठीक है मैं बदलने के लिए:
तो फिर तुम भी यह नियंत्रक में एक समान तरीके से उपयोग करें: इस प्रकार BjyAuthorize प्राप्त करने के लिए के साथ बदलने के सिद्धांत पहचान का उपयोग करना (या जोड़ें) 'zfcuser_auth_service' लेकिन अब यह मुझे 'ज़ेंड \ ServiceManager \ ServiceManager :: बताता है कि getctine.authentication.orm_default' के लिए कोई उदाहरण लाने या बनाने में असमर्थ था। मैं गेटटर को 'पब्लिक फ़ंक्शन getAuthAdapter() { (null === $ this-> authAdapter) { $ यह-> authAdapter = $ this-> getServiceManager() -> प्राप्त करें (' doctrine.authentication ।orm_default '); } $ 2-> authAdapter; ' –
अद्यतन उत्तर – hohner
आपकी सहायता के लिए धन्यवाद देखें। अब केवल एक समस्या बाकी है। '$ AuthResult = $ authService-> प्रमाणीकरण() के बाद; 'मुझे एक खाली पृष्ठ मिलता है। कोई त्रुटि नहीं, कुछ भी नहीं। –