我创建了以下捆绑包。
{
"name": "team/test-service-bundle",
"description": "bundle to work with the test service",
"type": "symfony-bundle",
"license" : [
"proprietary"
],
"autoload": {
"psr-4": {
"Print\\TestServiceBundle\\": "src/"
},
"classmap": [
"app/AppKernel.php",
"app/AppCache.php"
]
},
}
现在,我想在另一个symfony项目中使用它。因此,我在symfony项目中运行了以下命令。
sudo ln -s / opt / lampp / htdocs / testabc / test-service-bundle 供应商/团队/测试服务捆绑
Symfony项目中的AppKernal.php,
<?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
...
new \Print\TestServiceBundle\PrintTestServiceBundle(),
];
}
}
我遇到以下错误,
PHP致命错误:未捕获 Symfony \ Component \ Debug \ Exception \ ClassNotFoundException:尝试执行 从名称空间加载类“ PrintTestServiceBundle” “ Print \ TestServiceBundle”。