我正在尝试在旧版应用中使用Symfony服务。
文件摘录:
<?php
use AppBundle\Services\HealthCoverageValidation\GenericCancellationRequest;
use AppBundle\Services\HealthCoverageValidation\Transaction;
use Symfony\Component\HttpFoundation\Response;
/**
* @var Composer\Autoload\ClassLoader
*/
$loader = require __DIR__.'/../app/autoload.php';
$kernel = new AppKernel('dev', true);
class Test extends \Symfony\Bundle\FrameworkBundle\Controller\Controller {
public function testAutorizacion() {
global $kernel;
$validator = $kernel->getContainer()->get('nano.services.health_coverage.validator');
但是getContainer()
返回null。我该如何解决这个问题?