如何修復它(zend版本2.5)?ZF2:ServiceLocatorAwareInterface已棄用,將在3.0版中被刪除
ServiceLocatorAwareInterface已棄用,將在版本3.0中與ServiceLocatorAwareInitializer一起被刪除。請更新您的班主任\控制器\ TeacherController刪除的實施,並開始通過注射出廠你的依賴,而不是
我想:
class TeacherControllerFactory implements FactoryInterface
{
public function __invoke(ContainerInterface $container, $name, array $options = null)
{
return new TeacherController(
$container->getServiceLocator()->get(TeacherService::class)
);
}
/**
* Create and return TeacherController instance
*
* For use with zend-servicemanager v2; proxies to __invoke().
*
* @param ServiceLocatorInterface $container
* @return TeacherController
*/
public function createService(ServiceLocatorInterface $container)
{
return $this($container, TeacherController::class);
}
}
的error_reporting(E_ALL&〜E_USER_DEPRECATED); –