I try to create a reusable bundle with one service who implement an interface and one annotation. In DependencyInjection I create Configuration class with the method getConfigTreeBuilder
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$treeBuilder->root('sow_binding', 'array');
return $treeBuilder;
}
and Extension class who load services.yaml in config directory.
public function load(array $configs, ContainerBuilder $container)
{
$loader = new YamlFileLoader(
$container,
new FileLocator(__DIR__.'/../Resources/config')
);
$loader->load('services.yaml');
}
I created one test who create a fake class who use my annotation and my service but I get this message when I execute it :
Error : Class 'SOW\BindingBundle\Service\BindingService' not found
In my test I instantiated my service like this (with right import) :
$bindingService = new BindingService($reader, 'SOW\Annotation\Binding');
Here my services.yaml file :
parameters:
binding.annotation.class: SOW\Annotation\Binding
services:
SOW\BindingBundle\Service\BindingService:
alias: sow_binding.binder
public: true
arguments:
- "@annotations.reader"
- "%app.binding.annotation.class%"
Why my test can't find my service ?
Remove the app from binding. annotation. class as its not a valid reference.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.