Last active
December 15, 2015 13:09
-
-
Save leup/5265067 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
) | |
), | |
/* ... */ | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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