Created
October 30, 2015 01:18
-
-
Save oviniciusfeitosa/d97ec58bc6adf7b2183f to your computer and use it in GitHub Desktop.
[FIXED] ZF2 invokable ServiceNotFoundException Error
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
// Se você está tentando registrar um invokable e obteve um erro lançado por uma exception "ServiceNotFoundException" informando que sua classe não foi encontrada, não se preocupe eu tenho a solução para esse problema. | |
# If you are trying to register an invokable and got an error thrown by an exception "ServiceNotFoundException" stating that her class was not found, do not worry I have the solution to this problem. | |
// Utilizemos o código abaixo como referência: | |
# Lets use the code below for reference: | |
/** | |
* Register View Helper | |
*/ | |
public function getViewHelperConfig() { | |
return array( | |
'invokables' => array( | |
'UserIdentity' => new View\Helper\UserIdentity() | |
) | |
); | |
} | |
// Da maneira acima, lançará uma "ServiceNotFoundException". Para corrigir isso basta fazer o mesmo que fiz abaixo: | |
# The way up, will launch a "ServiceNotFoundException". To fix this just do what I did below: | |
/** | |
* Register View Helper | |
*/ | |
public function getViewHelperConfig() { | |
return array( | |
'invokables' => array( | |
'UserIdentity' => 'Usuario\View\Helper\UserIdentity' | |
) | |
); | |
} | |
// Boa sorte! | |
# Good Luck! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment