2016-06-17 73 views
1

我最近張貼的問題上Symfony3 LDAP組件:ldap questionSymfony3 LDAP組件AdapterInterface錯誤

我爲它找到了解決方案,但因爲前面的問題是如此之大,不同我決定問另一個,並將它們連接在一起。希望這是允許的。

快速介紹:我正在編寫一個需要ldap身份驗證的Symfony3應用程序。安裝Symfony3 LDAP組件遵循的文檔,但我結束了這個錯誤:

Catchable Fatal Error: Argument 1 passed to 

Symfony\Component\Ldap\Ldap::__construct() must be an instance of 

Symfony\Component\Ldap\Adapter\AdapterInterface, string given, called in 

/Users/user.name/Dev/ldapTest/var/cache/dev/appDevDebugProjectContainer.php 
on line 1644 and defined 

所有的細節都在前面的問題檢查上面的鏈接。

更新

代碼弗羅姆線1644:

/** 
* Gets the 'ldap' service. 
* 
* This service is shared. 
* This method always returns the same instance of the service. 
* 
* @return \Symfony\Component\Ldap\Ldap A Symfony\Component\Ldap\Ldap instance. 
*/ 
protected function getLdapService() 
{ 
    return $this->services['ldap'] = new \Symfony\Component\Ldap\Ldap('ldap.forumsys.com', 389, 3, false, true); 
} 
+0

你是否在第1644行有問題的代碼,所以我們可以看到可能是什麼問題? –

+0

確定檢查我的更新 – John

回答

0

我相信這是調用它的正確方法:

protected function getLdapService() 
{ 
    return $this->services['ldap'] = new \Symfony\Component\Ldap\LdapClient('ldap.forumsys.com', 389, 3, false, true); 
} 

試試吧,沒有一定的雖然。