Closed garethellis36 closed 9 years ago
I just discovered ServiceManager::setAllowOverride()
which simultaneously solved my problem and ruined my evening. Sorry to bother you!! :)
I will be updating to match how it works with Slim\Container, so in future you can pass in overrides into the constructor.
e.g.
$containerSettings = [
'invokeables' => [
'errorHandler' => My\ErrorHandler::class,
],
'settings' => [
'setting1' => true,
],
];
This will be a BC break when it happens though, so look out for it!
Hello,
I'm completely new to using Zend Service Manager and implemented it in a new Slim app I am working on after reading this blog post about abstract factories by you.
After I had done this I then wanted to set-up a custom error handler to render a nice error page with Twig and I followed the instructions in this blog post, also by you.
When I try to define
$container['errorHandler']
,Zend\ServiceManager\Exception\InvalidServiceNameException
is thrown with messageA service by the name or alias "errorHandler" already exists and cannot be overridden, please use an alternate name
.Having looked at the source for your Container class, this appears to be hard-coded to use the built-in Slim error handler. Do I understand this correctly? If so, would you consider a PR for being able to pass in some alternatives for the hard-coded handlers?