Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
A plugin by the name "getServiceLocator" was not found in the plugin manager Zend\Mvc\Controller\PluginManager #369
A plugin by the name "getServiceLocator" was not found in the plugin manager Zend\Mvc\Controller\PluginManager
i have modules from zf2 to zf3
i am having this error with the getServiceLocator:
$this->em = $this->getServiceLocator()->get('Doctrine\ORM\EntityManager');
i am using getServiceLocator all over the module
i cannot find a good tutorial to upgrade this to zf3
That was been removed in ZF3. All dependencies now must come through constructor. For starters look at https://zendframework.github.io/zend-servicemanager/migration/#factories
BTW, if you are using DoctrineORMModule it is not fully migrated to MVC yet, but its not too horrible to create as a service manually
That will unfortunately be beyond purpose of skeleton because there are too many different case specific ways to do this. I got a video tutorial in production due out today or tomorrow on this subject of service manager, that will also have a link to tutorial repository extending this skeleton repository with just that. I will add a section for controller dependency management, which I forgot about.
As promissed, see if this example helps: https://github.com/alextech/zendframework-tutorial-en/tree/3.1-SM-MVC_Controller. Top 3 commits show stages of migration.
And explanation at https://www.youtube.com/watch?v=15enXq3p7aE