WebinoImageThumb icon indicating copy to clipboard operation
WebinoImageThumb copied to clipboard

Trying to inject on controller ServiceNotFoundException

Open apoca opened this issue 8 years ago • 1 comments

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(); }

}

apoca avatar May 02 '16 14:05 apoca

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

bacinsky avatar Jun 08 '16 09:06 bacinsky