php - Fatal error: Call to undefined method DoctrineModule\Authentication\Adapter\ObjectRepository::setIdentityValue() -


i'm trying implement authentication module in zf2 application, did found in official docs, i'm getting error:

fatal error: call undefined method doctrinemodule\authentication\adapter\objectrepository::setidentityvalue() in docroot/module/login/src/login/controller/indexcontroller.php on line 33 

i put in module.config.php:

'doctrine' => array(     'driver' => array(         __namespace__ . '_driver' => array(             'class' => 'doctrine\orm\mapping\driver\annotationdriver',             'cache' => 'array',             'paths' => array(__dir__ . '/../src/' . __namespace__ . '/entity')         ),         'orm_default' => array(             'drivers' => array(                 __namespace__ . '\entity' => __namespace__ . '_driver'             )         )     ),     'authentication' => array(         'orm_default' => array(             'object_manager' => 'doctrine\orm\entitymanager',             'identity_class' => 'login\entity\user',             'identity_property' => 'email',             'credential_property' => 'password',         ),     ), ) 

in module.php:

public function getserviceconfig() {     return array(         'factories' => array(             'zend\authentication\authenticationservice' => function($servicemanager) {                 return $servicemanager->get('doctrine.authenticationservice.orm_default');             }         )     ); } 

and controller:

namespace login\controller;  use zend\mvc\controller\abstractactioncontroller; use zend\view\model\viewmodel;  class indexcontroller extends abstractactioncontroller{  public function indexaction(){     if ($this->getrequest()->ispost())  {         if($this->authenticate()){             return new viewmodel(array(                 'error' => 'your authentication credentials valid!',             ));         }else{             return new viewmodel(array(                 'error' => 'your authentication credentials not valid',             ));         }      }else{         return new viewmodel(array('error' => ''));     } }  public function authenticate(){      $data = $this->getrequest()->getpost();      $authservice = $this->getservicelocator()->get('zend\authentication\authenticationservice');      $adapter = $authservice->getadapter();     $adapter->setidentityvalue($data['email']);     $adapter->setcredentialvalue($data['password']);     $authresult = $authservice->authenticate();     if ($authresult->isvalid()) {         return true;     }else{         return false;     } }  } 

any glue?

ok, found answer. seems method setidentityvalue() , setcredentialvalue() (getters well) doesn't exists anymore. instead set these values have call setidentity() , setcredential(). seems changed recently, cause found nothing it, , application used work , suddenly, stop working cause these changes. how realized methods changed sign:

$authservice = $this->getservicelocator() >get('zend\authentication\authenticationservice');` $adapter = $authservice->getadapter(); $class_methods = get_class_methods($adapter); echo "<pre>";print_r($class_methods);exit; 

and output:

array (     [0] => __construct     [1] => setoptions     [2] => getoptions     [3] => authenticate     [4] => getcredential     [5] => setcredential     [6] => getidentity     [7] => setidentity ) 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -