Skip to content

Instantly share code, notes, and snippets.

@leup
Last active December 15, 2015 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leup/5265067 to your computer and use it in GitHub Desktop.
Save leup/5265067 to your computer and use it in GitHub Desktop.
Error message I get.
Zend\ServiceManager\Exception\ServiceNotFoundException
File:
\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php:456
Message:
Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for thumbnailfilter
I tried a few things to make my filter factory known from the service manager but I can't make it work.
class Image extends \Zend\Form\Element\File implements ExFormElementInterface
{
public function getInputSpecification() {
$specs = parent::getInputSpecification();
if (!isset($specs['filters']) || !is_array($specs['filters'])) {
$specs['filters'] = array();
}
$specs['filters'][] = array(
'name' => 'thumbnailfilter'
);
return $specs;
}
}
array(
/* ... */
/* Services */
'service_manager' => array(
'factories' => array(
'thumbnailfilter' => function($sm) {
$config = $sm->get('config');
$uploadpath = $config['uploads']['path'];
$thumbnailer = $sm->get('WebinoImageThumb');
return new Filter\Thumbnail($uploadpath, $thumbnailer);
}
)
),
/* Trying the filtermanager */
'filters' => array(
'factories' => array(
'thumbnailfilter' => function($sm) {
$config = $sm->get('config');
$uploadpath = $config['uploads']['path'];
$thumbnailer = $sm->get('WebinoImageThumb');
return new Filter\Thumbnail($uploadpath, $thumbnailer);
}
)
),
/* ... */
);
class Module
{
/* ... */
public function getFilterConfig()
{
return array(
'factories' => array(
'thumbnailfilter' => function($sm) {
$config = $sm->get('config');
$uploadpath = $config['uploads']['path'];
$thumbnailer = $sm->get('WebinoImageThumb');
return new Filter\Thumbnail($uploadpath, $thumbnailer);
}
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment