2

I'm trying to use a Symfony service in a legacy app.

An extract of the file:

<?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');

But then getContainer() returns null. How can I workaround this?

JorgeeFG
  • 5,651
  • 12
  • 59
  • 92

0 Answers0