Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to inject on controller ServiceNotFoundException #16

Open
apoca opened this issue May 2, 2016 · 1 comment
Open

Trying to inject on controller ServiceNotFoundException #16

apoca opened this issue May 2, 2016 · 1 comment
Labels

Comments

@apoca
Copy link
Contributor

apoca commented May 2, 2016

Zend\ServiceManager\Exception\ServiceNotFoundException

Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for WebinoImageThumb
/Applications/MAMP/htdocs/esolidar-1.0.0/vendor/zendframework/zend-servicemanager/src/ServiceManager.php in get at line 555

throw new Exception\ServiceNotFoundException(sprintf(
/Applications/MAMP/htdocs/esolidar-1.0.0/module/Application/src/Application/Controller/Factory/AjaxControllerFactory.php in __invoke at line 76

$thumbnailer = $container->get('WebinoImageThumb');

I followed your example like in testes:

in my controller:

// External Services
use WebinoImageThumb\Service\ImageThumb as WebinoImageThumb;

FooController(WebinoImageThumb $thumbnailer) { $this->thumbnailer = $thumbnailer; }

use Interop\Container\ContainerInterface;

FooControllerFactory(ContainerInterface $container){
public function __invoke(ContainerInterface $container)
{
// This works for both ZF2 and ZF3 and can be used in all managers (including ServiceManager)
// TODO: Can be removed in ZF3
if ($container instanceof ServiceManager) {
$container = $container->getServiceLocator();
}

}

@bacinsky
Copy link
Member

bacinsky commented Jun 8, 2016

Thank you for your report, currently I'm too busy to check this, but I will do.

@bacinsky bacinsky added the bug label Jun 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants