I would like to use a custom helper in my application.
I created the file Myhelper.php in Bundle/Helper/Myhelper.php with
namespace ProjectBundleHelper;
class Myhelper {
public function __construct($doctrine) {
$this->doctrine = $doctrine;
}
function testMyHelper () {
return "hi";
}
}
And I tried to call it in my controller:
$myHelper = $this->get('Myhelper');
But I have the following error:
An exception has been thrown during the rendering of a template ("You have requested a non-existent service "myhelper".")
Must I declare it in a specific config file ?
Thx
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…