我正在尝试在 symfony 2 应用程序中创建我的第一个服务,但出现此错误:
InvalidArgumentException: There is no extension able to load the
configuration for "my_app.myservice" (in
/path/to/src/MyApp/MyBundle/DependencyInjection/../Resources/config/services.yml).
Looked for namespace "my_app.myservice", found none.
我的配置似乎有问题,但我不明白它是什么。
这是我的services.yml
services:
my_app.myservice:
class: MyApp\MyBundle\Service\MyService
我的服务看起来像这样
<?php
namespace MyApp\MyBundle\Service;
class MyService
{
public function run()
{
echo "hello world";
}
}
感谢帮助 !